mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
create outbound olm session from account
also better error handling
This commit is contained in:
parent
6c60381d54
commit
bd64aaf029
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user