@sovereignbase/utils
    Preparing search index...

    Function deriveBytes

    • Derives deterministic, domain-separated bytes with HKDF-SHA-256.

      The same base, domain, and byteLength always produce the same bytes. Use a distinct domain for each purpose so one base value can safely feed independent derivation contexts. The inputs are not modified.

      Parameters

      • base: Uint8Array<ArrayBufferLike>

        Salt that namespaces the derivation under a base value.

      • domain: Uint8Array<ArrayBufferLike>

        HKDF context information identifying the derived value's use.

      • byteLength: number

        Number of output bytes to derive.

      Returns Promise<Uint8Array<ArrayBuffer>>

      A promise that resolves to exactly byteLength derived bytes.

      A DOMException when Web Crypto rejects an unsupported or invalid derivation request, including an invalid output length.

      const encoder = new TextEncoder()
      const bytes = await deriveBytes(
      encoder.encode('account-1'),
      encoder.encode('profile-encryption'),
      32
      )