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:
objectobject containing the encryption details- encryptedString:
stringEncrypted string generated by Lit Protocol - encryptedSymmetricKey:
stringEncrypted symmetric key generated by Lit Protocol - accessControlConditions:
stringArray of access control conditions stored as a string
- encryptedString:
- conversation_id:
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)
}