forked from mystiq/hydrogen-web
create outbound olm session from account
also better error handling
This commit is contained in:
parent
6c60381d54
commit
bd64aaf029
1 changed files with 18 additions and 2 deletions
|
@ -126,8 +126,24 @@ export class Account {
|
||||||
|
|
||||||
createInboundOlmSession(senderKey, body) {
|
createInboundOlmSession(senderKey, body) {
|
||||||
const newSession = new this._olm.Session();
|
const newSession = new this._olm.Session();
|
||||||
|
try {
|
||||||
newSession.create_inbound_from(this._account, senderKey, body);
|
newSession.create_inbound_from(this._account, senderKey, body);
|
||||||
return newSession;
|
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) {
|
writeRemoveOneTimeKey(session, txn) {
|
||||||
|
|
Loading…
Reference in a new issue