HMAC-based Extract-and-Expand Key Derivation Function.

Implements HKDF from RFC5869.

Expands the given master key with salt and info into a limited stream of key material.

Constructors

Methods

Constructors

  • Create a new HKDF instance for the given hash function with the master key, optional salt, and info.

    • Master key is a high-entropy secret key (not a password).
    • Salt is a non-secret random value.
    • Info is application- and/or context-specific information.

    Parameters

    • hash: (new () => Hash)
    • key: Uint8Array
    • salt: Uint8Array = ...
    • Optionalinfo: Uint8Array

    Returns HKDF

Methods

  • Expand returns next key material of the given length.

    It throws if expansion limit is reached (which is 254 digests of the underlying HMAC function).

    Parameters

    • length: number

    Returns Uint8Array