1
0
mirror of https://github.com/bitwarden/jslib synced 2025-12-26 05:03:41 +00:00

[bug] Scaffold secure storage service when building storage objects on init

This commit is contained in:
addison
2021-11-16 10:12:08 -05:00
parent 76577c4507
commit 27ab7f97b5

View File

@@ -1298,11 +1298,15 @@ export class StateService implements StateServiceAbstraction {
storedState.accounts[account.userId] = account;
await this.storageService.save('state', storedState, await this.defaultOnDiskLocalOptions());
await this.storageService.save('state', storedState, await this.defaultOnDiskMemoryOptions());
await this.storageService.save('state', storedState);
await this.storageService.save('state', storedState, await this.defaultOnDiskOptions());
if (await this.secureStorageService.get<State>('state') == null) {
await this.secureStorageService.save('state', storedState);
}
await this.scaffoldNewAccountSecureStorage(account);
}
private async scaffoldNewAccountSecureStorage(account: Account): Promise<void> {
const storedState = await this.secureStorageService.get<State>('state', await this.defaultSecureStorageOptions()) ?? new State();
storedState.accounts[account.userId] = account;
await this.secureStorageService.save('state', storedState);
}
private async pushAccounts(): Promise<void> {