/// import type { Key, JWK, JWKEncrypted, MAC, PasswordOpsLimit, PasswordMemLimit } from '../types.js'; declare const nonceSize: any; declare const macSize: any; /** * Symmetric encryption using XChaCha20-Poly1305-IETF. * The key is expected to be 256 bits in size. * The nonce is randomly generated. * The resulting cipher text will be have the following format: * `nonce || mac || cipherText` * This is an authenticated form of encryption. * The mac provides integrity and authenticity. * The returned buffers are guaranteed to unpooled. * This means the underlying `ArrayBuffer` is safely transferrable. */ declare function encryptWithKey(key: Key, plainText: Buffer, additionalData?: Buffer | null): Buffer; /** * Symmetric decryption using XChaCha20-Poly1305-IETF. * The key is expected to be 256 bits in size. * The nonce extracted from the cipher text. * It is expected that the cipher text will have the following format: * `nonce || mac || cipherText` * This is an authenticated form of decryption. * The mac provides integrity and authenticity. * The returned buffers are guaranteed to unpooled. * This means the underlying `ArrayBuffer` is safely transferrable. */ declare function decryptWithKey(key: Key, cipherText: Buffer, additionalData?: Buffer | null): Buffer | undefined; declare function macWithKey(key: Key, data: Buffer): MAC; declare function macWithKeyG(key: Key): Generator; declare function macWithKeyI(key: Key, data: Iterable): MAC; declare function authWithKey(key: Key, data: Buffer, digest: Buffer): boolean; declare function authWithKeyG(key: Key, digest: Buffer): Generator; declare function authWithKeyI(key: Key, data: Iterable, digest: Buffer): boolean; /** * Checks if data is a MAC */ declare function isMAC(mac: unknown): mac is MAC; /** * Key wrapping with password. * This uses `Argon2Id-1.3` to derive a 256-bit key from the password. * The key is then used for encryption with `XChaCha20-Poly1305-IETF`. * The password can be an empty string. */ declare function wrapWithPassword(password: string, keyJWK: JWK, opsLimit?: PasswordOpsLimit, memLimit?: PasswordMemLimit): JWKEncrypted; /** * Key unwrapping with password. * The password can be an empty string. */ declare function unwrapWithPassword(password: string, keyJWE: any): JWK | undefined; declare function wrapWithKey(key: Key, keyJWK: JWK): JWKEncrypted; declare function unwrapWithKey(key: Key, keyJWE: any): JWK | undefined; export { nonceSize, macSize, encryptWithKey, decryptWithKey, macWithKey, macWithKeyG, macWithKeyI, authWithKey, authWithKeyG, authWithKeyI, isMAC, wrapWithPassword, unwrapWithPassword, wrapWithKey, unwrapWithKey, };