import { HashPurpose } from "../enums/hashPurpose"; import { KdfType } from "../enums/kdfType"; import { KeySuffixOptions } from "../enums/keySuffixOptions"; import { EncArrayBuffer } from "../models/domain/enc-array-buffer"; import { EncString } from "../models/domain/enc-string"; import { SymmetricCryptoKey } from "../models/domain/symmetric-crypto-key"; import { ProfileOrganizationResponse } from "../models/response/profile-organization.response"; import { ProfileProviderOrganizationResponse } from "../models/response/profile-provider-organization.response"; import { ProfileProviderResponse } from "../models/response/profile-provider.response"; export abstract class CryptoService { setKey: (key: SymmetricCryptoKey) => Promise; setKeyHash: (keyHash: string) => Promise; setEncKey: (encKey: string) => Promise; setEncPrivateKey: (encPrivateKey: string) => Promise; setOrgKeys: ( orgs: ProfileOrganizationResponse[], providerOrgs: ProfileProviderOrganizationResponse[] ) => Promise; setProviderKeys: (orgs: ProfileProviderResponse[]) => Promise; getKey: (keySuffix?: KeySuffixOptions, userId?: string) => Promise; getKeyFromStorage: (keySuffix: KeySuffixOptions, userId?: string) => Promise; 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; getKeyForUserEncryption: (key?: SymmetricCryptoKey) => Promise; hasKey: () => Promise; hasKeyInMemory: (userId?: string) => Promise; hasKeyStored: (keySuffix?: KeySuffixOptions, userId?: string) => Promise; hasEncKey: () => Promise; clearKey: (clearSecretStorage?: boolean, userId?: string) => Promise; clearKeyHash: () => Promise; clearEncKey: (memoryOnly?: boolean, userId?: string) => Promise; clearKeyPair: (memoryOnly?: boolean, userId?: string) => Promise; clearOrgKeys: (memoryOnly?: boolean, userId?: string) => Promise; clearProviderKeys: (memoryOnly?: boolean) => Promise; clearPinProtectedKey: () => Promise; clearKeys: (userId?: string) => 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: (encBuffer: EncArrayBuffer, key: SymmetricCryptoKey) => Promise; randomNumber: (min: number, max: number) => Promise; validateKey: (key: SymmetricCryptoKey) => Promise; }