import { EncArrayBuffer } from '../models/domain/encArrayBuffer'; import { EncString } from '../models/domain/encString'; import { SymmetricCryptoKey } from '../models/domain/symmetricCryptoKey'; import { ProfileOrganizationResponse } from '../models/response/profileOrganizationResponse'; import { HashPurpose } from '../enums/hashPurpose'; import { KdfType } from '../enums/kdfType'; import { KeySuffixOptions } from './storage.service'; export abstract class CryptoService { setKey: (key: SymmetricCryptoKey) => Promise; setKeyHash: (keyHash: string) => Promise<{}>; setEncKey: (encKey: string) => Promise<{}>; setEncPrivateKey: (encPrivateKey: string) => Promise<{}>; setOrgKeys: (orgs: ProfileOrganizationResponse[]) => Promise<{}>; getKey: (keySuffix?: KeySuffixOptions) => Promise; getKeyFromStorage: (keySuffix: KeySuffixOptions) => Promise; getKeyHash: () => Promise; getEncKey: (key?: SymmetricCryptoKey) => Promise; getPublicKey: () => Promise; getPrivateKey: () => Promise; getFingerprint: (userId: string, publicKey?: ArrayBuffer) => Promise; getOrgKeys: () => Promise>; getOrgKey: (orgId: string) => Promise; hasKey: () => Promise; hasKeyInMemory: () => boolean; hasKeyStored: (keySuffix?: KeySuffixOptions) => Promise; hasEncKey: () => Promise; clearKey: (clearSecretStorage?: boolean) => Promise; clearKeyHash: () => Promise; clearEncKey: (memoryOnly?: boolean) => Promise; clearKeyPair: (memoryOnly?: boolean) => Promise; clearOrgKeys: (memoryOnly?: boolean) => Promise; clearPinProtectedKey: () => Promise; clearKeys: () => Promise; toggleKey: () => Promise; makeKey: (password: string, salt: string, kdf: KdfType, kdfIterations: number) => Promise; makeKeyFromPin: (pin: string, salt: string, kdf: KdfType, kdfIterations: number, protectedKeyCs?: EncString) => Promise; makeShareKey: () => Promise<[EncString, SymmetricCryptoKey]>; makeKeyPair: (key?: SymmetricCryptoKey) => Promise<[string, EncString]>; makePinKey: (pin: string, salt: string, kdf: KdfType, kdfIterations: number) => Promise; makeSendKey: (keyMaterial: ArrayBuffer) => Promise; hashPassword: (password: string, key: SymmetricCryptoKey, hashPurpose?: HashPurpose) => Promise; makeEncKey: (key: SymmetricCryptoKey) => Promise<[SymmetricCryptoKey, EncString]>; remakeEncKey: (key: SymmetricCryptoKey, encKey?: SymmetricCryptoKey) => Promise<[SymmetricCryptoKey, EncString]>; encrypt: (plainValue: string | ArrayBuffer, key?: SymmetricCryptoKey) => Promise; encryptToBytes: (plainValue: ArrayBuffer, key?: SymmetricCryptoKey) => Promise; rsaEncrypt: (data: ArrayBuffer, publicKey?: ArrayBuffer) => Promise; rsaDecrypt: (encValue: string, privateKeyValue?: ArrayBuffer) => Promise; decryptToBytes: (encString: EncString, key?: SymmetricCryptoKey) => Promise; decryptToUtf8: (encString: EncString, key?: SymmetricCryptoKey) => Promise; decryptFromBytes: (encBuf: ArrayBuffer, key: SymmetricCryptoKey) => Promise; randomNumber: (min: number, max: number) => Promise; validateKey: (key: SymmetricCryptoKey) => Promise; }