diff --git a/libs/common/src/abstractions/crypto.service.ts b/libs/common/src/abstractions/crypto.service.ts index 3bd652727c..2e5bcd08eb 100644 --- a/libs/common/src/abstractions/crypto.service.ts +++ b/libs/common/src/abstractions/crypto.service.ts @@ -27,6 +27,14 @@ export abstract class CryptoService { getKeyHash: () => Promise; compareAndUpdateKeyHash: (masterPassword: string, key: SymmetricCryptoKey) => Promise; getEncKey: (key?: SymmetricCryptoKey) => Promise; + getPublicKey: () => Promise; + getPrivateKey: () => Promise; + getFingerprint: (userId: string, publicKey?: ArrayBuffer) => Promise; + getOrgKeys: () => Promise>; + getOrgKey: (orgId: string) => Promise; + getProviderKey: (providerId: string) => Promise; + + // New key getters: to refactor getKeyForDecryptionAttachment: ( orgId: string, attachment: AttachmentView, @@ -36,12 +44,6 @@ export abstract class CryptoService { encryptedThing: EncString | EncArrayBuffer, orgId?: string ) => Promise; - getPublicKey: () => Promise; - getPrivateKey: () => Promise; - getFingerprint: (userId: string, publicKey?: ArrayBuffer) => Promise; - getOrgKeys: () => Promise>; - getOrgKey: (orgId: string) => Promise; - getProviderKey: (providerId: string) => Promise; // Has keys hasKey: () => Promise; @@ -93,13 +95,15 @@ export abstract class CryptoService { key: SymmetricCryptoKey, encKey?: SymmetricCryptoKey ) => Promise<[SymmetricCryptoKey, EncString]>; + validateKey: (key: SymmetricCryptoKey) => Promise; // Encrypt + // TODO: move to encryptService encrypt: (plainValue: string | ArrayBuffer, key?: SymmetricCryptoKey) => Promise; encryptToBytes: (plainValue: ArrayBuffer, key?: SymmetricCryptoKey) => Promise; rsaEncrypt: (data: ArrayBuffer, publicKey?: ArrayBuffer) => Promise; // Helpers + // TODO: where does this belong? randomNumber: (min: number, max: number) => Promise; - validateKey: (key: SymmetricCryptoKey) => Promise; }