Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

Commit

Permalink
[bug] Store vault data in memory (#1470)
Browse files Browse the repository at this point in the history
  • Loading branch information
addisonbeck committed Feb 11, 2022
1 parent aab25d5 commit d948580
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions src/services/state.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
}
}

0 comments on commit d948580

Please sign in to comment.