@me2em/crypto
    Preparing search index...

    Function hashIdentityMaterial

    • Computes session-bound identity material from a raw identity key.

      This is the "hPK" pattern: a deterministic, one-way derivative of the identity private key that lives in RAM for the duration of a login session and is the root for purpose-scoped key derivation and cache wrapping. The raw private key MUST be wiped immediately after this call (see core/wipe).

      Domain separation: identityId is mixed in so that identities sharing any downstream material can never collide.

      Parameters

      • identityPrivKey: Uint8Array

        Raw Ed25519 private key (32B).

      • identityId: string

        base64url/hex public key string of THIS identity.

      Returns Promise<Uint8Array>

      32 bytes of SHA-256 hash. RAM-ONLY — never persist, never transmit.

      'KEY/INVALID_LENGTH' if key length ≠ 32.

      const material = await hashIdentityMaterial(pkBytes, identityIdB64);
      secureWipe(pkBytes); // raw key is done
      const cacheKey = await hkdf(material, freshSalt,
      'me2em/crypto/v1/cache-wrap', 32);