type KeyInput$1 = any | Buffer | Uint8Array | string | Record; /** * @typedef {import('./internal/keys.js').KeyInput} KeyInput */ /** * @typedef {Object} EncryptOptions * @property {string} alg Key-management algorithm (REQUIRED) — e.g. * `'RSA-OAEP-256'`, `'ECDH-ES+A256KW'`, `'A256KW'`, `'dir'`. * @property {string} enc Content-encryption algorithm (REQUIRED) — e.g. * `'A256GCM'`, `'A128CBC-HS256'`. * @property {string} [kid] Key ID written to the protected header. * @property {Record} [header] Extra protected-header * params, merged first; `alg` / `enc` / `kid` and the key-management * params (`epk` / `apu` / `apv`) always win over them. * @property {string | number} [expiresIn] When the payload is a JSON * object, stamp an `exp` claim this far in the future (duration string * like `'1h'`, or milliseconds). * @property {string | Buffer | Uint8Array} [apu] ECDH-ES Agreement * PartyUInfo. Ignored by non-ECDH algorithms. * @property {string | Buffer | Uint8Array} [apv] ECDH-ES Agreement PartyVInfo. */ /** * Encrypt a payload into a compact JWE string. * * @param {unknown} payload A JSON-serialisable value, a string, or raw * bytes (`Buffer` / `Uint8Array`). * @param {KeyInput} key The recipient key — a public key / JWK for * RSA-OAEP and ECDH-ES, symmetric key material for AES-KW and `dir`. * @param {EncryptOptions} options * @returns {Promise} */ declare function encrypt(payload: unknown, key: KeyInput, options: EncryptOptions): Promise; type KeyInput = KeyInput$1; type EncryptOptions = { /** * Key-management algorithm (REQUIRED) — e.g. * `'RSA-OAEP-256'`, `'ECDH-ES+A256KW'`, `'A256KW'`, `'dir'`. */ alg: string; /** * Content-encryption algorithm (REQUIRED) — e.g. * `'A256GCM'`, `'A128CBC-HS256'`. */ enc: string; /** * Key ID written to the protected header. */ kid?: string | undefined; /** * Extra protected-header * params, merged first; `alg` / `enc` / `kid` and the key-management * params (`epk` / `apu` / `apv`) always win over them. */ header?: Record | undefined; /** * When the payload is a JSON * object, stamp an `exp` claim this far in the future (duration string * like `'1h'`, or milliseconds). */ expiresIn?: string | number | undefined; /** * ECDH-ES Agreement * PartyUInfo. Ignored by non-ECDH algorithms. */ apu?: string | Buffer | Uint8Array; /** * ECDH-ES Agreement PartyVInfo. */ apv?: string | Buffer | Uint8Array; }; export { encrypt }; export type { EncryptOptions, KeyInput };