@blockchaincommons/components - v1.0.0-beta.4
    Preparing search index...

    Class SchnorrPublicKey

    Schnorr (x-only) public key for BIP-340 signatures (secp256k1, 32 bytes)

    A SchnorrPublicKey is a 32-byte "x-only" public key used with the BIP-340 Schnorr signature scheme. Unlike compressed ECDSA public keys (33 bytes) that include a prefix byte indicating the parity of the y-coordinate, Schnorr public keys only contain the x-coordinate of the elliptic curve point.

    Schnorr signatures offer several advantages over traditional ECDSA signatures:

    • Linearity: Enables key and signature aggregation
    • Non-malleability: Prevents third parties from modifying signatures
    • Smaller size: Signatures are 64 bytes vs 70-72 bytes for ECDSA
    • Better privacy: Makes different multisig policies indistinguishable

    Schnorr signatures were introduced to Bitcoin via the Taproot upgrade (BIP-340).

    Note: SchnorrPublicKey does not have CBOR serialization in the reference implementation, so we keep it simple here.

    Implements

    Index
    KEY_SIZE: number = schnorr.PUBLIC_KEY_SIZE

    The byte length of a SchnorrPublicKey.

    • Verify a BIP-340 signature. A key that is not an x-only point is an InvalidData failure (the reference's schnorr_verify panics on it).

      Parameters

      • signature: Uint8Array
      • message: Uint8Array

      Returns boolean