document return type

This commit is contained in:
Bruno Windels 2020-09-08 10:51:45 +02:00
parent 4cf3b3569d
commit 40ed66dc5e

View File

@ -26,6 +26,14 @@ export class Encryption {
this._ownDeviceId = ownDeviceId; this._ownDeviceId = ownDeviceId;
} }
/**
* Encrypts a message with megolm
* @param {string} roomId
* @param {string} type event type to encrypt
* @param {string} content content to encrypt
* @param {object} encryptionParams the content of the m.room.encryption event
* @return {Promise<EncryptionResult>}
*/
async encrypt(roomId, type, content, encryptionParams) { async encrypt(roomId, type, content, encryptionParams) {
let session = new this._olm.OutboundGroupSession(); let session = new this._olm.OutboundGroupSession();
try { try {
@ -145,6 +153,14 @@ export class Encryption {
} }
} }
/**
* @property {object?} roomKeyMessage if encrypting this message
* created a new outbound session,
* this contains the content of the m.room_key message
* that should be sent out over olm.
* @property {object} content the encrypted message as the content of
* the m.room.encrypted event that should be sent out
*/
class EncryptionResult { class EncryptionResult {
constructor(content, roomKeyMessage) { constructor(content, roomKeyMessage) {
this.content = content; this.content = content;