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 { KdfType } from '../enums/kdfType'; 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: () => 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; hasEncKey: () => Promise; clearKey: () => 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) => 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; }