From ff0af125c4fb7b7d68eab3ab1fa88665c3117b69 Mon Sep 17 00:00:00 2001 From: addison Date: Wed, 3 Nov 2021 19:53:50 -0400 Subject: [PATCH] [style] Fix lint complaints --- common/src/services/cipher.service.ts | 2 +- common/src/services/collection.service.ts | 2 +- common/src/services/crypto.service.ts | 38 ++++++++++----------- common/src/services/folder.service.ts | 2 +- common/src/services/state.service.ts | 2 +- common/src/services/vaultTimeout.service.ts | 4 +-- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/common/src/services/cipher.service.ts b/common/src/services/cipher.service.ts index 15523b80..66758dbb 100644 --- a/common/src/services/cipher.service.ts +++ b/common/src/services/cipher.service.ts @@ -1099,7 +1099,7 @@ export class CipherService implements CipherServiceAbstraction { } private async clearDecryptedCiphersState(userId?: string) { - await this.stateService.setDecryptedCiphers(null, { userId }); + await this.stateService.setDecryptedCiphers(null, { userId: userId }); this.clearSortedCiphers(); } diff --git a/common/src/services/collection.service.ts b/common/src/services/collection.service.ts index 89c3efec..791e64bb 100644 --- a/common/src/services/collection.service.ts +++ b/common/src/services/collection.service.ts @@ -21,7 +21,7 @@ export class CollectionService implements CollectionServiceAbstraction { } async clearCache(userId?: string): Promise { - await this.stateService.setDecryptedCollections(null, { userId }); + await this.stateService.setDecryptedCollections(null, { userId: userId }); } async encrypt(model: CollectionView): Promise { diff --git a/common/src/services/crypto.service.ts b/common/src/services/crypto.service.ts index a2e13ebc..5092fae7 100644 --- a/common/src/services/crypto.service.ts +++ b/common/src/services/crypto.service.ts @@ -31,7 +31,7 @@ export class CryptoService implements CryptoServiceAbstraction { } async setKey(key: SymmetricCryptoKey, userId?: string): Promise { - await this.stateService.setCryptoMasterKey(key, { userId }); + await this.stateService.setCryptoMasterKey(key, { userId: userId }); await this.storeKey(key, userId); } @@ -86,7 +86,7 @@ export class CryptoService implements CryptoServiceAbstraction { async getKey(keySuffix?: KeySuffixOptions, userId?: string): Promise { const inMemoryKey = await this.stateService.getCryptoMasterKey( - userId ? { userId } : + userId ? { userId: userId } : null ); @@ -333,7 +333,7 @@ export class CryptoService implements CryptoServiceAbstraction { } async hasKeyStored(keySuffix: KeySuffixOptions, userId?: string): Promise { - return await this.stateService.getCryptoMasterKeyB64({ keySuffix: keySuffix, userId }) != null; + return await this.stateService.getCryptoMasterKeyB64({ keySuffix: keySuffix, userId: userId }) != null; } async hasEncKey(): Promise { @@ -341,8 +341,8 @@ export class CryptoService implements CryptoServiceAbstraction { } async clearKey(clearSecretStorage: boolean = true, userId?: string): Promise { - await this.stateService.setCryptoMasterKey(null, { userId }); - await this.stateService.setLegacyEtmKey(null, { userId }); + await this.stateService.setCryptoMasterKey(null, { userId: userId }); + await this.stateService.setLegacyEtmKey(null, { userId: userId }); if (clearSecretStorage) { await this.clearSecretKeyStore(userId); } @@ -357,27 +357,27 @@ export class CryptoService implements CryptoServiceAbstraction { } async clearEncKey(memoryOnly?: boolean, userId?: string): Promise { - await this.stateService.setDecryptedCryptoSymmetricKey(null, { userId }); + await this.stateService.setDecryptedCryptoSymmetricKey(null, { userId: userId }); if (!memoryOnly) { - await this.stateService.setEncryptedCryptoSymmetricKey(null, { userId }); + await this.stateService.setEncryptedCryptoSymmetricKey(null, { userId: userId }); } } async clearKeyPair(memoryOnly?: boolean, userId?: string): Promise { const keysToClear: Promise[] = [ - this.stateService.setDecryptedPrivateKey(null, { userId }), - this.stateService.setPublicKey(null, { userId }), + this.stateService.setDecryptedPrivateKey(null, { userId: userId }), + this.stateService.setPublicKey(null, { userId: userId }), ]; if (!memoryOnly) { - keysToClear.push(this.stateService.setEncryptedPrivateKey(null, { userId })); + keysToClear.push(this.stateService.setEncryptedPrivateKey(null, { userId: userId })); } return Promise.all(keysToClear); } async clearOrgKeys(memoryOnly?: boolean, userId?: string): Promise { - await this.stateService.setDecryptedOrganizationKeys(null, { userId }); + await this.stateService.setDecryptedOrganizationKeys(null, { userId: userId }); if (!memoryOnly) { - await this.stateService.setEncryptedOrganizationKeys(null, { userId }); + await this.stateService.setEncryptedOrganizationKeys(null, { userId: userId }); } } @@ -706,17 +706,17 @@ export class CryptoService implements CryptoServiceAbstraction { protected async shouldStoreKey(keySuffix: KeySuffixOptions, userId?: string) { let shouldStoreKey = false; if (keySuffix === KeySuffixOptions.Auto) { - const vaultTimeout = await this.stateService.getVaultTimeout({ userId }); + const vaultTimeout = await this.stateService.getVaultTimeout({ userId: userId }); shouldStoreKey = vaultTimeout == null; } else if (keySuffix === KeySuffixOptions.Biometric) { - const biometricUnlock = await this.stateService.getBiometricUnlock({ userId }); + const biometricUnlock = await this.stateService.getBiometricUnlock({ userId: userId }); shouldStoreKey = biometricUnlock && this.platformUtilService.supportsSecureStorage(); } return shouldStoreKey; } protected async retrieveKeyFromStorage(keySuffix: KeySuffixOptions, userId?: string) { - return await this.stateService.getCryptoMasterKeyB64({ keySuffix: keySuffix, userId }); + return await this.stateService.getCryptoMasterKeyB64({ keySuffix: keySuffix, userId: userId }); } private async aesEncrypt(data: ArrayBuffer, key: SymmetricCryptoKey): Promise { @@ -876,16 +876,16 @@ export class CryptoService implements CryptoServiceAbstraction { } private async clearSecretKeyStore(userId?: string): Promise { - await this.stateService.setCryptoMasterKeyB64(null, { keySuffix: KeySuffixOptions.Auto, userId }); - await this.stateService.setCryptoMasterKeyB64(null, { keySuffix: KeySuffixOptions.Biometric, userId }); + await this.stateService.setCryptoMasterKeyB64(null, { keySuffix: KeySuffixOptions.Auto, userId: userId }); + await this.stateService.setCryptoMasterKeyB64(null, { keySuffix: KeySuffixOptions.Biometric, userId: userId }); } private async storeKey(key: SymmetricCryptoKey, userId?: string) { const shouldStoreAuto = await this.shouldStoreKey(KeySuffixOptions.Auto, userId); - await this.stateService.setCryptoMasterKeyB64(shouldStoreAuto ? key.keyB64 : null, { userId, keySuffix: KeySuffixOptions.Auto}); + await this.stateService.setCryptoMasterKeyB64(shouldStoreAuto ? key.keyB64 : null, { userId: userId, keySuffix: KeySuffixOptions.Auto}); const shouldStoreBiometric = await this.shouldStoreKey(KeySuffixOptions.Biometric, userId); - await this.stateService.setCryptoMasterKeyB64(shouldStoreBiometric ? key.keyB64 : null, { userId, keySuffix: KeySuffixOptions.Biometric }); + await this.stateService.setCryptoMasterKeyB64(shouldStoreBiometric ? key.keyB64 : null, { userId: userId, keySuffix: KeySuffixOptions.Biometric }); } } diff --git a/common/src/services/folder.service.ts b/common/src/services/folder.service.ts index 1615dc9e..0520db72 100644 --- a/common/src/services/folder.service.ts +++ b/common/src/services/folder.service.ts @@ -30,7 +30,7 @@ export class FolderService implements FolderServiceAbstraction { private stateService: StateService) { } async clearCache(userId?: string): Promise { - await this.stateService.setDecryptedFolders(null, { userId }); + await this.stateService.setDecryptedFolders(null, { userId: userId }); } async encrypt(model: FolderView, key?: SymmetricCryptoKey): Promise { diff --git a/common/src/services/state.service.ts b/common/src/services/state.service.ts index 52cfe370..cbbc7eb0 100644 --- a/common/src/services/state.service.ts +++ b/common/src/services/state.service.ts @@ -1328,7 +1328,7 @@ export class StateService implements StateServiceAbstraction { if (requestedOptions == null) { return defaultOptions; } - requestedOptions.userId = requestedOptions?.userId ?? defaultOptions.userId; + requestedOptions.userId = requestedOptions?.userId ?? defaultOptions.userId; requestedOptions.storageLocation = requestedOptions?.storageLocation ?? defaultOptions.storageLocation; requestedOptions.keySuffix = requestedOptions?.keySuffix ?? defaultOptions.keySuffix; requestedOptions.useSecureStorage = requestedOptions?.useSecureStorage ?? defaultOptions.useSecureStorage; diff --git a/common/src/services/vaultTimeout.service.ts b/common/src/services/vaultTimeout.service.ts index b849a240..95287040 100644 --- a/common/src/services/vaultTimeout.service.ts +++ b/common/src/services/vaultTimeout.service.ts @@ -106,9 +106,9 @@ export class VaultTimeoutService implements VaultTimeoutServiceAbstraction { await this.cryptoService.clearOrgKeys(true, userId); await this.cryptoService.clearKeyPair(true, userId); await this.cryptoService.clearEncKey(true, userId); - await this.stateService.setBiometricLocked(true, { userId }); + await this.stateService.setBiometricLocked(true, { userId: userId }); - this.messagingService.send('locked', { userId }); + this.messagingService.send('locked', { userId: userId }); if (this.lockedCallback != null) { await this.lockedCallback(); }