SDK Reference
Methods
DecryptMessage

decryptMessage

Decrypts an encrypted message.

How to use?

content can be obtained with a call to getMessages.

const res = await orbis.decryptMessage(content);

Parameters

  • content: object which contains the full content of the message
    • conversation_id: string (stream) ID of the conversation the message is from
    • encryptedMessage: object object containing the encryption details
      • encryptedString: string Encrypted string generated by Lit Protocol
      • encryptedSymmetricKey: string Encrypted symmetric key generated by Lit Protocol
      • accessControlConditions: string Array of access control conditions stored as a string

Returns

{
  result: "Content of the decrypted message"
}

Examples

Retrieve and decrypt messages from a conversation

/** Retrieve an array messages from a conversation */
const { data: messages } = await orbis.getMessages("k...");
 
/** Loop through the message array and log decrypted contents */
for(const message of messages){
    const decryptedMessage = await orbis.decryptMessage(message.content)
    console.log(decryptedMessage.result)
}