[bug] Store vault data in memory (#1470)

This commit is contained in:
Addison Beck 2022-02-11 03:21:51 -05:00 committed by GitHub
parent 45a39f6200
commit 1712ed53be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 59 additions and 0 deletions

View File

@ -7,6 +7,11 @@ import { StateService as StateServiceAbstraction } from "../abstractions/state.s
import { StorageOptions } from "jslib-common/models/domain/storageOptions";
import { CipherData } from "jslib-common/models/data/cipherData";
import { CollectionData } from "jslib-common/models/data/collectionData";
import { FolderData } from "jslib-common/models/data/folderData";
import { SendData } from "jslib-common/models/data/sendData";
export class StateService
extends BaseStateService<GlobalState, Account>
implements StateServiceAbstraction
@ -33,4 +38,58 @@ export class StateService
this.reconcileOptions(options, await this.defaultOnDiskLocalOptions())
);
}
async getEncryptedCiphers(options?: StorageOptions): Promise<{ [id: string]: CipherData }> {
options = this.reconcileOptions(options, this.defaultInMemoryOptions);
return await super.getEncryptedCiphers(options);
}
async setEncryptedCiphers(
value: { [id: string]: CipherData },
options?: StorageOptions
): Promise<void> {
options = this.reconcileOptions(options, this.defaultInMemoryOptions);
return await super.setEncryptedCiphers(value, options);
}
async getEncryptedCollections(
options?: StorageOptions
): Promise<{ [id: string]: CollectionData }> {
options = this.reconcileOptions(options, this.defaultInMemoryOptions);
return await super.getEncryptedCollections(options);
}
async setEncryptedCollections(
value: { [id: string]: CollectionData },
options?: StorageOptions
): Promise<void> {
options = this.reconcileOptions(options, this.defaultInMemoryOptions);
return await super.setEncryptedCollections(value, options);
}
async getEncryptedFolders(options?: StorageOptions): Promise<{ [id: string]: FolderData }> {
options = this.reconcileOptions(options, this.defaultInMemoryOptions);
return await super.getEncryptedFolders(options);
}
async setEncryptedFolders(
value: { [id: string]: FolderData },
options?: StorageOptions
): Promise<void> {
options = this.reconcileOptions(options, this.defaultInMemoryOptions);
return await super.setEncryptedFolders(value, options);
}
async getEncryptedSends(options?: StorageOptions): Promise<{ [id: string]: SendData }> {
options = this.reconcileOptions(options, this.defaultInMemoryOptions);
return await super.getEncryptedSends(options);
}
async setEncryptedSends(
value: { [id: string]: SendData },
options?: StorageOptions
): Promise<void> {
options = this.reconcileOptions(options, this.defaultInMemoryOptions);
return await super.setEncryptedSends(value, options);
}
}