UNPKG

@unvision/jose

Version:

Implementation of the RFCs of the JOSE Working Group.

38 lines (37 loc) 1.77 kB
/// <reference types="node" /> import { JsonWebKey } from '../../../jwk/jsonwebkey'; import { JsonWebEncryptionContentEncryptionAlgorithm } from '../enc/jsonwebencryption-content-encryption.algorithm'; import { JsonWebEncryptionKeyWrapAlgorithm } from './jsonwebencryption-key-wrap.algorithm'; /** * Implementation of the JSON Web Encryption Direct Key Wrap Algorithm. * * @see https://www.rfc-editor.org/rfc/rfc7518.html#section-4.5 */ declare class DirAlgorithm extends JsonWebEncryptionKeyWrapAlgorithm { /** * Instantiates a new JSON Web Encryption Direct Key Wrap Algorithm to Wrap and Unwrap Content Encryption Keys. */ constructor(); /** * Returns an empty Buffer as the Wrapped Key since the Algorithm does not Wrap the provided Content Encryption Key. * * @param enc JSON Web Encryption Content Encryption Algorithm. * @param key JSON Web Key to be used as the Content Encryption Key used to Encrypt the Plaintext. * @returns Wrap Key as the Content Encryption Key and an empty Buffer as the Wrapped Content Encryption Key. */ wrap(enc: JsonWebEncryptionContentEncryptionAlgorithm, key: JsonWebKey): Promise<[Buffer, Buffer]>; /** * Returns the provided JSON Web Key as the Content Encryption Key. * * @param enc JSON Web Encryption Content Encryption Algorithm. * @param key JSON Web Key used as the Content Encryption Key. * @param ek ~Wrapped Content Encryption Key~. * @returns Provided JSON Web Key as the Content Encryption Key. */ unwrap(enc: JsonWebEncryptionContentEncryptionAlgorithm, key: JsonWebKey, ek: Buffer): Promise<Buffer>; } /** * Direct use of a shared symmetric key as the CEK. */ export declare const dir: DirAlgorithm; export {};