From e0b9a3fa505fdcdb1a3f37a73717d52ab6f13436 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Wed, 29 Sep 2021 20:07:42 +0200 Subject: [PATCH] create e2ee identity also when storage got cleared without backup --- src/matrix/Session.js | 4 ++++ src/matrix/SessionContainer.js | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/matrix/Session.js b/src/matrix/Session.js index 63aece42..87a3150c 100644 --- a/src/matrix/Session.js +++ b/src/matrix/Session.js @@ -237,6 +237,10 @@ export class Session { return this._sessionBackup; } + get hasIdentity() { + return !!this._e2eeAccount; + } + /** @internal */ async createIdentity(log) { if (this._olm) { diff --git a/src/matrix/SessionContainer.js b/src/matrix/SessionContainer.js index 7248e11e..479bb7a8 100644 --- a/src/matrix/SessionContainer.js +++ b/src/matrix/SessionContainer.js @@ -233,8 +233,7 @@ export class SessionContainer { platform: this._platform, }); await this._session.load(log); - // TODO: check instead storage doesn't have an identity - if (isNewLogin) { + if (!this._session.hasIdentity) { this._status.set(LoadStatus.SessionSetup); await log.wrap("createIdentity", log => this._session.createIdentity(log)); }