Polkadot Apps
    Preparing search index...

    Re-export the full HKDF function from @noble/hashes for advanced use cases that need custom hash functions or output lengths.

    • HKDF-expand from the spec. The most important part. HKDF-Expand(PRK, info, L) -> OKM

      Parameters

      • hash: TArg<CHash>

        hash function that would be used (e.g. sha256)

      • prk: TArg<Uint8Array<ArrayBufferLike>>

        a pseudorandom key of at least HashLen octets (usually, the output from the extract step)

      • Optionalinfo: TArg<Uint8Array<ArrayBufferLike>>

        optional context and application specific information (can be a zero-length string)

      • Optionallength: number

        length of output keying material in bytes. RFC 5869 §2.3 allows 0..255*HashLen, so 0 returns an empty OKM.

      Returns Uint8Array<ArrayBufferLike> & Uint8Array<ArrayBuffer>

      Output keying material with the requested length.

      If the requested output length exceeds the HKDF limit for the selected hash. Error

      Run the HKDF expand step.

      import { expand } from '@noble/hashes/hkdf.js';
      import { sha256 } from '@noble/hashes/sha2.js';
      expand(sha256, new Uint8Array(32), new Uint8Array([1, 2, 3]), 16);