@arkade-os/sdk Documentation - v0.5.0-rc.11
    Preparing search index...

    Function toXOnly

    • Normalize a secp256k1 public key to the 32-byte x-only form every tapscript, covenant param and params.serverPubKey in this SDK is denominated in.

      A compressed key drops its parity prefix; an x-only key passes through. Both arrive over the same wires — arkd advertises signerPubkey either way, Identity.xOnlyPublicKey implementations vary, and solver-supplied fields are whatever the peer sent — so the caller usually cannot know which it holds. Anything else is refused rather than silently truncated: a 65-byte uncompressed key, stripped of one byte, yields a plausible 32-byte value that is not the key, which surfaces as an address nobody funded.

      The result may alias key rather than copy it; callers that mutate either value after normalization should copy first.

      Parameters

      • key: Uint8Array

        32-byte x-only or 33-byte compressed public key

      • label: string = "public key"

        Name used in the error, e.g. "ark signer key"

      Returns Uint8Array

      toXOnlySignerHex for the hex-in, hex-out signer-rotation equivalent