Polkadot Apps
    Preparing search index...
    • Derive a 32-byte key using HKDF-SHA256 (RFC 5869).

      This is a convenience wrapper around the full HKDF function, fixed to SHA-256 and a 32-byte output length — suitable for deriving symmetric encryption keys.

      Parameters

      • ikm: Uint8Array

        Input keying material (e.g. a shared secret or master key).

      • salt: string | Uint8Array<ArrayBufferLike>

        Salt value (string or bytes). Use a unique, application-specific salt.

      • info: string | Uint8Array<ArrayBufferLike>

        Context/application-specific info string (string or bytes).

      Returns Uint8Array

      A 32-byte derived key as Uint8Array.

      import { deriveKey, randomBytes } from "@polkadot-apps/crypto";

      const masterKey = randomBytes(32);
      const encryptionKey = deriveKey(masterKey, "myapp-v1", "document-encryption");