create outbound olm session from account

also better error handling
This commit is contained in:
Bruno Windels 2020-09-02 17:37:13 +02:00
parent 6c60381d54
commit bd64aaf029

View file

@ -126,8 +126,24 @@ export class Account {
createInboundOlmSession(senderKey, body) {
const newSession = new this._olm.Session();
newSession.create_inbound_from(this._account, senderKey, body);
return newSession;
try {
newSession.create_inbound_from(this._account, senderKey, body);
return newSession;
} catch (err) {
newSession.free();
throw err;
}
}
createOutboundOlmSession(theirIdentityKey, theirOneTimeKey) {
const newSession = new this._olm.Session();
try {
newSession.create_outbound_from(this._account, theirIdentityKey, theirOneTimeKey);
return newSession;
} catch (err) {
newSession.free();
throw err;
}
}
writeRemoveOneTimeKey(session, txn) {