import { Decryptable } from "../interfaces/decryptable.interface"; import { Encrypted } from "../interfaces/encrypted"; import { InitializerMetadata } from "../interfaces/initializer-metadata.interface"; import { EncArrayBuffer } from "../models/domain/enc-array-buffer"; import { EncString } from "../models/domain/enc-string"; import { SymmetricCryptoKey } from "../models/domain/symmetric-crypto-key"; export abstract class EncryptService { abstract encrypt(plainValue: string | Uint8Array, key: SymmetricCryptoKey): Promise; abstract encryptToBytes: ( plainValue: Uint8Array, key?: SymmetricCryptoKey, ) => Promise; abstract decryptToUtf8: (encString: EncString, key: SymmetricCryptoKey) => Promise; abstract decryptToBytes: (encThing: Encrypted, key: SymmetricCryptoKey) => Promise; abstract rsaEncrypt: (data: Uint8Array, publicKey: Uint8Array) => Promise; abstract rsaDecrypt: (data: EncString, privateKey: Uint8Array) => Promise; abstract resolveLegacyKey: (key: SymmetricCryptoKey, encThing: Encrypted) => SymmetricCryptoKey; abstract decryptItems: ( items: Decryptable[], key: SymmetricCryptoKey, ) => Promise; /** * Generates a base64-encoded hash of the given value * @param value The value to hash * @param algorithm The hashing algorithm to use */ hash: (value: string | Uint8Array, algorithm: "sha1" | "sha256" | "sha512") => Promise; }