1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-26 12:25:20 +01:00

pm-5273 Update references

This commit is contained in:
Carlos Gonçalves 2024-03-09 09:53:14 +00:00
parent b6b7ea283c
commit 1145201549
No known key found for this signature in database
GPG Key ID: 8147F618E732EF25
16 changed files with 54 additions and 45 deletions

View File

@ -710,7 +710,7 @@ describe("NotificationBackground", () => {
); );
tabSendMessageSpy = jest.spyOn(BrowserApi, "tabSendMessage").mockImplementation(); tabSendMessageSpy = jest.spyOn(BrowserApi, "tabSendMessage").mockImplementation();
editItemSpy = jest.spyOn(notificationBackground as any, "editItem"); editItemSpy = jest.spyOn(notificationBackground as any, "editItem");
setAddEditCipherInfoSpy = jest.spyOn(stateService, "setAddEditCipherInfo"); setAddEditCipherInfoSpy = jest.spyOn(cipherService, "setAddEditCipherInfo");
openAddEditVaultItemPopoutSpy = jest.spyOn( openAddEditVaultItemPopoutSpy = jest.spyOn(
notificationBackground as any, notificationBackground as any,
"openAddEditVaultItemPopout", "openAddEditVaultItemPopout",

View File

@ -575,14 +575,14 @@ export default class NotificationBackground {
} }
/** /**
* Sets the add/edit cipher info in the state service * Sets the add/edit cipher info in the cipher service
* and opens the add/edit vault item popout. * and opens the add/edit vault item popout.
* *
* @param cipherView - The cipher to edit * @param cipherView - The cipher to edit
* @param senderTab - The tab that the message was sent from * @param senderTab - The tab that the message was sent from
*/ */
private async editItem(cipherView: CipherView, senderTab: chrome.tabs.Tab) { private async editItem(cipherView: CipherView, senderTab: chrome.tabs.Tab) {
await this.stateService.setAddEditCipherInfo({ await this.cipherService.setAddEditCipherInfo({
cipher: cipherView, cipher: cipherView,
collectionIds: cipherView.collectionIds, collectionIds: cipherView.collectionIds,
}); });

View File

@ -562,7 +562,7 @@ describe("OverlayBackground", () => {
beforeEach(() => { beforeEach(() => {
sender = mock<chrome.runtime.MessageSender>({ tab: { id: 1 } }); sender = mock<chrome.runtime.MessageSender>({ tab: { id: 1 } });
jest jest
.spyOn(overlayBackground["stateService"], "setAddEditCipherInfo") .spyOn(overlayBackground["cipherService"], "setAddEditCipherInfo")
.mockImplementation(); .mockImplementation();
jest.spyOn(overlayBackground as any, "openAddEditVaultItemPopout").mockImplementation(); jest.spyOn(overlayBackground as any, "openAddEditVaultItemPopout").mockImplementation();
}); });
@ -570,7 +570,7 @@ describe("OverlayBackground", () => {
it("will not open the add edit popout window if the message does not have a login cipher provided", () => { it("will not open the add edit popout window if the message does not have a login cipher provided", () => {
sendExtensionRuntimeMessage({ command: "autofillOverlayAddNewVaultItem" }, sender); sendExtensionRuntimeMessage({ command: "autofillOverlayAddNewVaultItem" }, sender);
expect(overlayBackground["stateService"].setAddEditCipherInfo).not.toHaveBeenCalled(); expect(overlayBackground["cipherService"].setAddEditCipherInfo).not.toHaveBeenCalled();
expect(overlayBackground["openAddEditVaultItemPopout"]).not.toHaveBeenCalled(); expect(overlayBackground["openAddEditVaultItemPopout"]).not.toHaveBeenCalled();
}); });
@ -591,7 +591,7 @@ describe("OverlayBackground", () => {
); );
await flushPromises(); await flushPromises();
expect(overlayBackground["stateService"].setAddEditCipherInfo).toHaveBeenCalled(); expect(overlayBackground["cipherService"].setAddEditCipherInfo).toHaveBeenCalled();
expect(BrowserApi.sendMessage).toHaveBeenCalledWith( expect(BrowserApi.sendMessage).toHaveBeenCalledWith(
"inlineAutofillMenuRefreshAddEditCipher", "inlineAutofillMenuRefreshAddEditCipher",
); );

View File

@ -626,7 +626,7 @@ class OverlayBackground implements OverlayBackgroundInterface {
cipherView.type = CipherType.Login; cipherView.type = CipherType.Login;
cipherView.login = loginView; cipherView.login = loginView;
await this.stateService.setAddEditCipherInfo({ await this.cipherService.setAddEditCipherInfo({
cipher: cipherView, cipher: cipherView,
collectionIds: cipherView.collectionIds, collectionIds: cipherView.collectionIds,
}); });

View File

@ -16,6 +16,7 @@ import { BroadcasterService } from "@bitwarden/common/platform/abstractions/broa
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service"; import { MessagingService } from "@bitwarden/common/platform/abstractions/messaging.service";
import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service"; import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
import { DialogService, SimpleDialogOptions } from "@bitwarden/components"; import { DialogService, SimpleDialogOptions } from "@bitwarden/components";
import { BrowserApi } from "../platform/browser/browser-api"; import { BrowserApi } from "../platform/browser/browser-api";
@ -46,6 +47,7 @@ export class AppComponent implements OnInit, OnDestroy {
private i18nService: I18nService, private i18nService: I18nService,
private router: Router, private router: Router,
private stateService: BrowserStateService, private stateService: BrowserStateService,
private cipherService: CipherService,
private messagingService: MessagingService, private messagingService: MessagingService,
private changeDetectorRef: ChangeDetectorRef, private changeDetectorRef: ChangeDetectorRef,
private ngZone: NgZone, private ngZone: NgZone,
@ -166,7 +168,7 @@ export class AppComponent implements OnInit, OnDestroy {
await this.clearComponentStates(); await this.clearComponentStates();
} }
if (url.startsWith("/tabs/")) { if (url.startsWith("/tabs/")) {
await this.stateService.setAddEditCipherInfo(null); await this.cipherService.setAddEditCipherInfo(null);
} }
(window as any).previousPopupUrl = url; (window as any).previousPopupUrl = url;

View File

@ -9,6 +9,7 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl
import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password"; import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password";
import { UsernameGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/username"; import { UsernameGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/username";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view"; import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
import { AddEditCipherInfo } from "@bitwarden/common/vault/types/add-edit-cipher-info"; import { AddEditCipherInfo } from "@bitwarden/common/vault/types/add-edit-cipher-info";
@ -26,6 +27,7 @@ export class GeneratorComponent extends BaseGeneratorComponent {
platformUtilsService: PlatformUtilsService, platformUtilsService: PlatformUtilsService,
i18nService: I18nService, i18nService: I18nService,
stateService: StateService, stateService: StateService,
cipherService: CipherService,
route: ActivatedRoute, route: ActivatedRoute,
logService: LogService, logService: LogService,
private location: Location, private location: Location,
@ -35,6 +37,7 @@ export class GeneratorComponent extends BaseGeneratorComponent {
usernameGenerationService, usernameGenerationService,
platformUtilsService, platformUtilsService,
stateService, stateService,
cipherService,
i18nService, i18nService,
logService, logService,
route, route,
@ -43,7 +46,7 @@ export class GeneratorComponent extends BaseGeneratorComponent {
} }
async ngOnInit() { async ngOnInit() {
this.addEditCipherInfo = await this.stateService.getAddEditCipherInfo(); this.addEditCipherInfo = await this.cipherService.getAddEditCipherInfo();
if (this.addEditCipherInfo != null) { if (this.addEditCipherInfo != null) {
this.cipherState = this.addEditCipherInfo.cipher; this.cipherState = this.addEditCipherInfo.cipher;
} }
@ -64,7 +67,7 @@ export class GeneratorComponent extends BaseGeneratorComponent {
this.addEditCipherInfo.cipher = this.cipherState; this.addEditCipherInfo.cipher = this.cipherState;
// FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling. // FIXME: Verify that this floating promise is intentional. If it is, add an explanatory comment and ensure there is proper error handling.
// eslint-disable-next-line @typescript-eslint/no-floating-promises // eslint-disable-next-line @typescript-eslint/no-floating-promises
this.stateService.setAddEditCipherInfo(this.addEditCipherInfo); this.cipherService.setAddEditCipherInfo(this.addEditCipherInfo);
this.close(); this.close();
} }

View File

@ -304,7 +304,7 @@ export class AddEditComponent extends BaseAddEditComponent {
} }
private saveCipherState() { private saveCipherState() {
return this.stateService.setAddEditCipherInfo({ return this.cipherService.setAddEditCipherInfo({
cipher: this.cipher, cipher: this.cipher,
collectionIds: collectionIds:
this.collections == null this.collections == null

View File

@ -10,6 +10,7 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl
import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password"; import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password";
import { UsernameGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/username"; import { UsernameGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/username";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
import { GeneratorComponent } from "./generator.component"; import { GeneratorComponent } from "./generator.component";
@ -54,6 +55,10 @@ describe("GeneratorComponent", () => {
provide: LogService, provide: LogService,
useValue: mock<LogService>(), useValue: mock<LogService>(),
}, },
{
provide: CipherService,
useValue: mock<CipherService>(),
},
], ],
schemas: [NO_ERRORS_SCHEMA], schemas: [NO_ERRORS_SCHEMA],
}).compileComponents(); }).compileComponents();

View File

@ -8,6 +8,7 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl
import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password"; import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password";
import { UsernameGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/username"; import { UsernameGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/username";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
@Component({ @Component({
selector: "app-generator", selector: "app-generator",
@ -18,6 +19,7 @@ export class GeneratorComponent extends BaseGeneratorComponent {
passwordGenerationService: PasswordGenerationServiceAbstraction, passwordGenerationService: PasswordGenerationServiceAbstraction,
usernameGenerationService: UsernameGenerationServiceAbstraction, usernameGenerationService: UsernameGenerationServiceAbstraction,
stateService: StateService, stateService: StateService,
cipherService: CipherService,
platformUtilsService: PlatformUtilsService, platformUtilsService: PlatformUtilsService,
i18nService: I18nService, i18nService: I18nService,
route: ActivatedRoute, route: ActivatedRoute,
@ -28,6 +30,7 @@ export class GeneratorComponent extends BaseGeneratorComponent {
usernameGenerationService, usernameGenerationService,
platformUtilsService, platformUtilsService,
stateService, stateService,
cipherService,
i18nService, i18nService,
logService, logService,
route, route,

View File

@ -8,6 +8,7 @@ import { PlatformUtilsService } from "@bitwarden/common/platform/abstractions/pl
import { StateService } from "@bitwarden/common/platform/abstractions/state.service"; import { StateService } from "@bitwarden/common/platform/abstractions/state.service";
import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password"; import { PasswordGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/password";
import { UsernameGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/username"; import { UsernameGenerationServiceAbstraction } from "@bitwarden/common/tools/generator/username";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
import { DialogService } from "@bitwarden/components"; import { DialogService } from "@bitwarden/components";
import { PasswordGeneratorHistoryComponent } from "./password-generator-history.component"; import { PasswordGeneratorHistoryComponent } from "./password-generator-history.component";
@ -21,6 +22,7 @@ export class GeneratorComponent extends BaseGeneratorComponent {
passwordGenerationService: PasswordGenerationServiceAbstraction, passwordGenerationService: PasswordGenerationServiceAbstraction,
usernameGenerationService: UsernameGenerationServiceAbstraction, usernameGenerationService: UsernameGenerationServiceAbstraction,
stateService: StateService, stateService: StateService,
cipherService: CipherService,
platformUtilsService: PlatformUtilsService, platformUtilsService: PlatformUtilsService,
i18nService: I18nService, i18nService: I18nService,
logService: LogService, logService: LogService,
@ -32,6 +34,7 @@ export class GeneratorComponent extends BaseGeneratorComponent {
usernameGenerationService, usernameGenerationService,
platformUtilsService, platformUtilsService,
stateService, stateService,
cipherService,
i18nService, i18nService,
logService, logService,
route, route,

View File

@ -19,6 +19,7 @@ import {
UsernameGeneratorOptions, UsernameGeneratorOptions,
} from "@bitwarden/common/tools/generator/username"; } from "@bitwarden/common/tools/generator/username";
import { EmailForwarderOptions } from "@bitwarden/common/tools/models/domain/email-forwarder-options"; import { EmailForwarderOptions } from "@bitwarden/common/tools/models/domain/email-forwarder-options";
import { CipherService } from "@bitwarden/common/vault/abstractions/cipher.service";
@Directive() @Directive()
export class GeneratorComponent implements OnInit { export class GeneratorComponent implements OnInit {
@ -57,6 +58,7 @@ export class GeneratorComponent implements OnInit {
protected usernameGenerationService: UsernameGenerationServiceAbstraction, protected usernameGenerationService: UsernameGenerationServiceAbstraction,
protected platformUtilsService: PlatformUtilsService, protected platformUtilsService: PlatformUtilsService,
protected stateService: StateService, protected stateService: StateService,
protected cipherService: CipherService,
protected i18nService: I18nService, protected i18nService: I18nService,
protected logService: LogService, protected logService: LogService,
protected route: ActivatedRoute, protected route: ActivatedRoute,

View File

@ -678,7 +678,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
} }
async loadAddEditCipherInfo(): Promise<boolean> { async loadAddEditCipherInfo(): Promise<boolean> {
const addEditCipherInfo: any = await this.stateService.getAddEditCipherInfo(); const addEditCipherInfo: any = await this.cipherService.getAddEditCipherInfo();
const loadedSavedInfo = addEditCipherInfo != null; const loadedSavedInfo = addEditCipherInfo != null;
if (loadedSavedInfo) { if (loadedSavedInfo) {
@ -691,7 +691,7 @@ export class AddEditComponent implements OnInit, OnDestroy {
} }
} }
await this.stateService.setAddEditCipherInfo(null); await this.cipherService.setAddEditCipherInfo(null);
return loadedSavedInfo; return loadedSavedInfo;
} }

View File

@ -20,7 +20,6 @@ import { UriMatchType } from "../../vault/enums";
import { CipherData } from "../../vault/models/data/cipher.data"; import { CipherData } from "../../vault/models/data/cipher.data";
import { LocalData } from "../../vault/models/data/local.data"; import { LocalData } from "../../vault/models/data/local.data";
import { CipherView } from "../../vault/models/view/cipher.view"; import { CipherView } from "../../vault/models/view/cipher.view";
import { AddEditCipherInfo } from "../../vault/types/add-edit-cipher-info";
import { KdfType, ThemeType } from "../enums"; import { KdfType, ThemeType } from "../enums";
import { ServerConfigData } from "../models/data/server-config.data"; import { ServerConfigData } from "../models/data/server-config.data";
import { import {
@ -61,8 +60,6 @@ export abstract class StateService<T extends Account = Account> {
getAccessToken: (options?: StorageOptions) => Promise<string>; getAccessToken: (options?: StorageOptions) => Promise<string>;
setAccessToken: (value: string, options?: StorageOptions) => Promise<void>; setAccessToken: (value: string, options?: StorageOptions) => Promise<void>;
getAddEditCipherInfo: (options?: StorageOptions) => Promise<AddEditCipherInfo>;
setAddEditCipherInfo: (value: AddEditCipherInfo, options?: StorageOptions) => Promise<void>;
getAlwaysShowDock: (options?: StorageOptions) => Promise<boolean>; getAlwaysShowDock: (options?: StorageOptions) => Promise<boolean>;
setAlwaysShowDock: (value: boolean, options?: StorageOptions) => Promise<void>; setAlwaysShowDock: (value: boolean, options?: StorageOptions) => Promise<void>;
getApiKeyClientId: (options?: StorageOptions) => Promise<string>; getApiKeyClientId: (options?: StorageOptions) => Promise<string>;

View File

@ -24,7 +24,6 @@ import { UriMatchType } from "../../vault/enums";
import { CipherData } from "../../vault/models/data/cipher.data"; import { CipherData } from "../../vault/models/data/cipher.data";
import { LocalData } from "../../vault/models/data/local.data"; import { LocalData } from "../../vault/models/data/local.data";
import { CipherView } from "../../vault/models/view/cipher.view"; import { CipherView } from "../../vault/models/view/cipher.view";
import { AddEditCipherInfo } from "../../vault/types/add-edit-cipher-info";
import { EnvironmentService } from "../abstractions/environment.service"; import { EnvironmentService } from "../abstractions/environment.service";
import { LogService } from "../abstractions/log.service"; import { LogService } from "../abstractions/log.service";
import { import {
@ -271,34 +270,6 @@ export class StateService<
await this.saveAccount(account, options); await this.saveAccount(account, options);
} }
async getAddEditCipherInfo(options?: StorageOptions): Promise<AddEditCipherInfo> {
const account = await this.getAccount(
this.reconcileOptions(options, await this.defaultInMemoryOptions()),
);
// ensure prototype on cipher
const raw = account?.data?.addEditCipherInfo;
return raw == null
? null
: {
cipher:
raw?.cipher.toJSON != null
? raw.cipher
: CipherView.fromJSON(raw?.cipher as Jsonify<CipherView>),
collectionIds: raw?.collectionIds,
};
}
async setAddEditCipherInfo(value: AddEditCipherInfo, options?: StorageOptions): Promise<void> {
const account = await this.getAccount(
this.reconcileOptions(options, await this.defaultInMemoryOptions()),
);
account.data.addEditCipherInfo = value;
await this.saveAccount(
account,
this.reconcileOptions(options, await this.defaultInMemoryOptions()),
);
}
async getAlwaysShowDock(options?: StorageOptions): Promise<boolean> { async getAlwaysShowDock(options?: StorageOptions): Promise<boolean> {
return ( return (
(await this.getGlobals(this.reconcileOptions(options, await this.defaultOnDiskOptions()))) (await this.getGlobals(this.reconcileOptions(options, await this.defaultOnDiskOptions())))

View File

@ -6,6 +6,7 @@ import { Cipher } from "../models/domain/cipher";
import { Field } from "../models/domain/field"; import { Field } from "../models/domain/field";
import { CipherView } from "../models/view/cipher.view"; import { CipherView } from "../models/view/cipher.view";
import { FieldView } from "../models/view/field.view"; import { FieldView } from "../models/view/field.view";
import { AddEditCipherInfo } from "../types/add-edit-cipher-info";
export abstract class CipherService { export abstract class CipherService {
clearCache: (userId?: string) => Promise<void>; clearCache: (userId?: string) => Promise<void>;
@ -89,4 +90,6 @@ export abstract class CipherService {
) => Promise<void>; ) => Promise<void>;
getKeyForCipherKeyDecryption: (cipher: Cipher) => Promise<any>; getKeyForCipherKeyDecryption: (cipher: Cipher) => Promise<any>;
decryptCiphers: (ciphers: Cipher[]) => Promise<CipherView[]>; decryptCiphers: (ciphers: Cipher[]) => Promise<CipherView[]>;
getAddEditCipherInfo: () => Promise<AddEditCipherInfo>;
setAddEditCipherInfo: (value: AddEditCipherInfo) => Promise<void>;
} }

View File

@ -59,6 +59,7 @@ import { AttachmentView } from "../models/view/attachment.view";
import { CipherView } from "../models/view/cipher.view"; import { CipherView } from "../models/view/cipher.view";
import { FieldView } from "../models/view/field.view"; import { FieldView } from "../models/view/field.view";
import { PasswordHistoryView } from "../models/view/password-history.view"; import { PasswordHistoryView } from "../models/view/password-history.view";
import { AddEditCipherInfo } from "../types/add-edit-cipher-info";
import { DECRYPTED_CIPHERS, ENCRYPTED_CIPHERS } from "./key-state/ciphers.state"; import { DECRYPTED_CIPHERS, ENCRYPTED_CIPHERS } from "./key-state/ciphers.state";
@ -68,6 +69,12 @@ const CIPHERS_DISK_KEY = new KeyDefinition<Record<string, LocalData>>(CIPHERS_DI
deserializer: (obj) => obj, deserializer: (obj) => obj,
}); });
const ADD_EDIT_CIPHER_INFO_KEY = new KeyDefinition<AddEditCipherInfo>(
CIPHERS_DISK,
"addEditCipherInfo",
{ deserializer: (obj) => obj },
);
export class CipherService implements CipherServiceAbstraction { export class CipherService implements CipherServiceAbstraction {
private sortedCiphersCache: SortedCiphersCache = new SortedCiphersCache( private sortedCiphersCache: SortedCiphersCache = new SortedCiphersCache(
this.sortCiphersByLastUsed, this.sortCiphersByLastUsed,
@ -76,10 +83,12 @@ export class CipherService implements CipherServiceAbstraction {
localData$: Observable<Record<string, LocalData>>; localData$: Observable<Record<string, LocalData>>;
ciphers$: Observable<Record<string, CipherData>>; ciphers$: Observable<Record<string, CipherData>>;
cipherViews$: Observable<CipherView[]>; cipherViews$: Observable<CipherView[]>;
addEditCipherInfo$: Observable<AddEditCipherInfo>;
private localDataState: ActiveUserState<Record<string, LocalData>>; private localDataState: ActiveUserState<Record<string, LocalData>>;
private encryptedCiphersState: ActiveUserState<Record<string, CipherData>>; private encryptedCiphersState: ActiveUserState<Record<string, CipherData>>;
private decryptedCiphersState: DerivedState<CipherView[]>; private decryptedCiphersState: DerivedState<CipherView[]>;
private addEditCipherInfoState: ActiveUserState<AddEditCipherInfo>;
constructor( constructor(
private cryptoService: CryptoService, private cryptoService: CryptoService,
@ -101,10 +110,12 @@ export class CipherService implements CipherServiceAbstraction {
DECRYPTED_CIPHERS, DECRYPTED_CIPHERS,
{ cipherService: this }, { cipherService: this },
); );
this.addEditCipherInfoState = this.stateProvider.getActive(ADD_EDIT_CIPHER_INFO_KEY);
this.localData$ = this.localDataState.state$; this.localData$ = this.localDataState.state$;
this.ciphers$ = this.encryptedCiphersState.state$; this.ciphers$ = this.encryptedCiphersState.state$;
this.cipherViews$ = this.decryptedCiphersState.state$; this.cipherViews$ = this.decryptedCiphersState.state$;
this.addEditCipherInfo$ = this.addEditCipherInfoState.state$;
} }
async getDecryptedCipherCache(): Promise<CipherView[]> { async getDecryptedCipherCache(): Promise<CipherView[]> {
@ -1045,6 +1056,15 @@ export class CipherService implements CipherServiceAbstraction {
); );
} }
async getAddEditCipherInfo(): Promise<AddEditCipherInfo> {
const info = await firstValueFrom(this.addEditCipherInfo$);
return info;
}
async setAddEditCipherInfo(value: AddEditCipherInfo) {
await this.addEditCipherInfoState.update(() => value);
}
// Helpers // Helpers
// In the case of a cipher that is being shared with an organization, we want to decrypt the // In the case of a cipher that is being shared with an organization, we want to decrypt the