create e2ee identity also when storage got cleared without backup

This commit is contained in:
Bruno Windels 2021-09-29 20:07:42 +02:00
parent a1c66738db
commit e0b9a3fa50
2 changed files with 5 additions and 2 deletions

View file

@ -237,6 +237,10 @@ export class Session {
return this._sessionBackup; return this._sessionBackup;
} }
get hasIdentity() {
return !!this._e2eeAccount;
}
/** @internal */ /** @internal */
async createIdentity(log) { async createIdentity(log) {
if (this._olm) { if (this._olm) {

View file

@ -233,8 +233,7 @@ export class SessionContainer {
platform: this._platform, platform: this._platform,
}); });
await this._session.load(log); await this._session.load(log);
// TODO: check instead storage doesn't have an identity if (!this._session.hasIdentity) {
if (isNewLogin) {
this._status.set(LoadStatus.SessionSetup); this._status.set(LoadStatus.SessionSetup);
await log.wrap("createIdentity", log => this._session.createIdentity(log)); await log.wrap("createIdentity", log => this._session.createIdentity(log));
} }