@hpke/dhkem-x25519
    Preparing search index...

    Class HkdfSha256

    Hierarchy

    • HkdfSha256Native
      • HkdfSha256
    Index
    • Uses WebCrypto HMAC for salts of any length when no callback is supplied. Prefer omitting the callback and its JavaScript HMAC/SHA-2 imports to reduce bundle size. Empty salts are normalized to hashSize zero bytes.

      Parameters

      • OptionalfallbackExtract: (salt: Uint8Array, ikm: Uint8Array) => Uint8Array

        Optional legacy callback, taking precedence over WebCrypto for nonempty salts whose length differs from hashSize. Empty and hash-sized salts always use WebCrypto.

      Returns HkdfSha256

    _api: SubtleCrypto = undefined
    _fallbackExtract: (salt: Uint8Array, ikm: Uint8Array) => Uint8Array
    _suiteId: Uint8Array = EMPTY
    algHash: HmacKeyGenParams = ...

    The parameters for Web Cryptography API

    hashSize: number = 32

    32

    id: KdfId = 0x0001

    KdfId.HkdfSha256 (0x0001)

    • Builds a labeled input keying material.

      Parameters

      • label: Uint8Array

        A byte string indicating the cryptographic context/operation.

      • ikm: Uint8Array

      Returns Uint8Array

      An input keying material as bytes.

    • Builds a labeled info string.

      Parameters

      • label: Uint8Array

        A byte string indicating the cryptographic context/operation.

      • info: Uint8Array

        An additional byte string.

      • len: number

        The length of the output byte string.

      Returns Uint8Array

      An info string as bytes.

    • Expands a pseudorandom key prk.

      Parameters

      • prk: ArrayBufferLike | ArrayBufferView<ArrayBufferLike>

        A pseudorandom key.

      • info: ArrayBufferLike | ArrayBufferView<ArrayBufferLike>

        An additional byte string.

      • len: number

        The length in bytes of the output keying material.

      Returns Promise<ArrayBuffer>

      An output keying material as bytes.

    • Extracts a pseudorandom key of fixed length (Nh) bytes.

      Parameters

      • salt: ArrayBufferLike | ArrayBufferView<ArrayBufferLike>

        An additional random byte string.

      • ikm: ArrayBufferLike | ArrayBufferView<ArrayBufferLike>

        An input keying material

      Returns Promise<ArrayBuffer>

      A pseudorandom key as bytes.

    • Extracts a pseudorandom key and expand it to a specified length keying material.

      Parameters

      • salt: ArrayBufferLike | ArrayBufferView<ArrayBufferLike>

        An additional random byte string.

      • ikm: ArrayBufferLike | ArrayBufferView<ArrayBufferLike>

        An input keying material

      • info: ArrayBufferLike | ArrayBufferView<ArrayBufferLike>

        An additional byte string.

      • len: number

        The length in bytes of the output keying material.

      Returns Promise<ArrayBuffer>

      An output keying material as bytes.

    • Initializes the instance by setting a suite_id defined in RFC9180.

      Parameters

      • suiteId: Uint8Array

        A suite_id defined in RFC9180.

      Returns void

    • Extracts a pseudorandom key with label.

      Parameters

      • prk: ArrayBufferLike | ArrayBufferView<ArrayBufferLike>

        A pseudorandom key.

      • label: Uint8Array

        A byte string indicating the cryptographic context/operation.

      • info: Uint8Array

        An additional byte string.

      • len: number

        The length in bytes of the output keying material.

      Returns Promise<ArrayBuffer>

      An output keying material as bytes.

    • Extracts a pseudorandom key with label.

      Parameters

      • salt: ArrayBufferLike | ArrayBufferView<ArrayBufferLike>

        An additional random byte string.

      • label: Uint8Array

        A byte string indicating the cryptographic context/operation.

      • ikm: Uint8Array

        An input keying material

      Returns Promise<ArrayBuffer>

      A pseudorandom key as bytes.