@cashu/cashu-ts
    Preparing search index...

    Function deriveP2BKSecretKey

    • Alpha

      Derive a blinded secret key per NUT-26.

      Unblinds the pubkey (P = P_ - r·G), verifies x-coord against the naturalPub x(P) == x(p·G), then choose skStd = (p + rᵢ) mod n if parity(P) == parity(p·G), otherwise skNeg = (-p + rᵢ) mod n. Returns skStd if no blindPubkey is provided.

      Parameters

      • privkey: string | bigint

        Unblinded private key (p), hex or bigint.

      • rBlind: string | bigint

        Blinding scalar (r), hex or bigint.

      • OptionalblindPubkey: Uint8Array<ArrayBufferLike>

        Optional. Blinded pubkey (P_) to match, 33 byte hex.

      • OptionalnaturalPub: Uint8Array<ArrayBufferLike>

        Optional. Pubkey calculated from private key (P = p·G), 33 byte hex.

      Returns null | string

      Derived blinded secret key as 64 char hex.

      Security note, this operates on long lived secrets. JavaScript BigInt arithmetic in a JIT is not guaranteed constant time. Do not expose this function on a server that holds private keys.

      If inputs are out of range, or the derived key would be zero.