Options
All
  • Public
  • Public/Protected
  • All
Menu

Class HKDF

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.

Hierarchy

  • HKDF

Index

Constructors

Methods

Constructors

constructor

  • new HKDF(hash: object, key: Uint8Array, salt?: Uint8Array, info?: Uint8Array): HKDF
  • 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: object
    • key: Uint8Array
    • Default value salt: Uint8Array = new Uint8Array(0)
    • Optional info: Uint8Array

    Returns HKDF

Methods

clean

  • clean(): void

expand

  • expand(length: number): Uint8Array
  • 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

Generated using TypeDoc