@me2em/pact
    Preparing search index...

    Function derivePactKey

    • Derives the member's pact key for (pid, ch, gen).

      pid — b64url(16); ch — b64url(32) = SHA-256 of the canonical context; gen — 0 on joining, +1 on every ROTATE_KEY. The public pact key needs no separate derivation (Р1): pactPub = crypto.getPublicKey(pactKey).

      Parameters

      • anchorSecretKey: Uint8Array

        Raw private key of the anchor node (see module header).

      • pid: string

        Pact identifier, b64url(16).

      • ch: string

        Context hash, b64url(32).

      • gen: number

        Key generation, integer ≥ 0.

      Returns Uint8Array

      The 32-byte pact private key.

      PactError MALFORMED @ derive on invalid arguments.

      import { crypto } from '@me2em/core';

      const anchorKey = crypto.deriveHandleKey(rootKey, 'pact-handle');
      const pactKey = derivePactKey(anchorKey, pid, ch, 0);
      const pactPub = b64urlEncode(crypto.getPublicKey(pactKey));

      1.0.0-rc.1