Annotate cryptoService abstraction
This commit is contained in:
parent
03af238b56
commit
98fe486644
|
@ -27,6 +27,14 @@ export abstract class CryptoService {
|
||||||
getKeyHash: () => Promise<string>;
|
getKeyHash: () => Promise<string>;
|
||||||
compareAndUpdateKeyHash: (masterPassword: string, key: SymmetricCryptoKey) => Promise<boolean>;
|
compareAndUpdateKeyHash: (masterPassword: string, key: SymmetricCryptoKey) => Promise<boolean>;
|
||||||
getEncKey: (key?: SymmetricCryptoKey) => Promise<SymmetricCryptoKey>;
|
getEncKey: (key?: SymmetricCryptoKey) => Promise<SymmetricCryptoKey>;
|
||||||
|
getPublicKey: () => Promise<ArrayBuffer>;
|
||||||
|
getPrivateKey: () => Promise<ArrayBuffer>;
|
||||||
|
getFingerprint: (userId: string, publicKey?: ArrayBuffer) => Promise<string[]>;
|
||||||
|
getOrgKeys: () => Promise<Map<string, SymmetricCryptoKey>>;
|
||||||
|
getOrgKey: (orgId: string) => Promise<SymmetricCryptoKey>;
|
||||||
|
getProviderKey: (providerId: string) => Promise<SymmetricCryptoKey>;
|
||||||
|
|
||||||
|
// New key getters: to refactor
|
||||||
getKeyForDecryptionAttachment: (
|
getKeyForDecryptionAttachment: (
|
||||||
orgId: string,
|
orgId: string,
|
||||||
attachment: AttachmentView,
|
attachment: AttachmentView,
|
||||||
|
@ -36,12 +44,6 @@ export abstract class CryptoService {
|
||||||
encryptedThing: EncString | EncArrayBuffer,
|
encryptedThing: EncString | EncArrayBuffer,
|
||||||
orgId?: string
|
orgId?: string
|
||||||
) => Promise<SymmetricCryptoKey>;
|
) => Promise<SymmetricCryptoKey>;
|
||||||
getPublicKey: () => Promise<ArrayBuffer>;
|
|
||||||
getPrivateKey: () => Promise<ArrayBuffer>;
|
|
||||||
getFingerprint: (userId: string, publicKey?: ArrayBuffer) => Promise<string[]>;
|
|
||||||
getOrgKeys: () => Promise<Map<string, SymmetricCryptoKey>>;
|
|
||||||
getOrgKey: (orgId: string) => Promise<SymmetricCryptoKey>;
|
|
||||||
getProviderKey: (providerId: string) => Promise<SymmetricCryptoKey>;
|
|
||||||
|
|
||||||
// Has keys
|
// Has keys
|
||||||
hasKey: () => Promise<boolean>;
|
hasKey: () => Promise<boolean>;
|
||||||
|
@ -93,13 +95,15 @@ export abstract class CryptoService {
|
||||||
key: SymmetricCryptoKey,
|
key: SymmetricCryptoKey,
|
||||||
encKey?: SymmetricCryptoKey
|
encKey?: SymmetricCryptoKey
|
||||||
) => Promise<[SymmetricCryptoKey, EncString]>;
|
) => Promise<[SymmetricCryptoKey, EncString]>;
|
||||||
|
validateKey: (key: SymmetricCryptoKey) => Promise<boolean>;
|
||||||
|
|
||||||
// Encrypt
|
// Encrypt
|
||||||
|
// TODO: move to encryptService
|
||||||
encrypt: (plainValue: string | ArrayBuffer, key?: SymmetricCryptoKey) => Promise<EncString>;
|
encrypt: (plainValue: string | ArrayBuffer, key?: SymmetricCryptoKey) => Promise<EncString>;
|
||||||
encryptToBytes: (plainValue: ArrayBuffer, key?: SymmetricCryptoKey) => Promise<EncArrayBuffer>;
|
encryptToBytes: (plainValue: ArrayBuffer, key?: SymmetricCryptoKey) => Promise<EncArrayBuffer>;
|
||||||
rsaEncrypt: (data: ArrayBuffer, publicKey?: ArrayBuffer) => Promise<EncString>;
|
rsaEncrypt: (data: ArrayBuffer, publicKey?: ArrayBuffer) => Promise<EncString>;
|
||||||
|
|
||||||
// Helpers
|
// Helpers
|
||||||
|
// TODO: where does this belong?
|
||||||
randomNumber: (min: number, max: number) => Promise<number>;
|
randomNumber: (min: number, max: number) => Promise<number>;
|
||||||
validateKey: (key: SymmetricCryptoKey) => Promise<boolean>;
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue