Class containing hierarchical deterministic key related utility methods used by the DWN.

Constructors

Methods

  • Derives a key using HMAC-based Extract-and-Expand Key Derivation Function (HKDF) as defined in RFC 5869. TODO: Consolidate HKDF implementation and usage with web5-js - https://github.com/TBD54566975/dwn-sdk-js/issues/742

    Parameters

    • params: {
          hashAlgorithm: "SHA-256" | "SHA-384" | "SHA-512";
          info: Uint8Array;
          initialKeyMaterial: Uint8Array;
          keyLengthInBytes: number;
      }
      • hashAlgorithm: "SHA-256" | "SHA-384" | "SHA-512"
      • info: Uint8Array
      • initialKeyMaterial: Uint8Array
      • keyLengthInBytes: number

    Returns Promise<Uint8Array>

  • Derives a hardened hierarchical deterministic private key.

    Parameters

    • privateKey: Uint8Array
    • relativePath: string[]

    Returns Promise<Uint8Array>

  • Derives a descendant public key from an ancestor private key. NOTE: currently only supports SECP256K1 keys.

    Parameters

    Returns Promise<PublicJwk>