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

    Class SigningPublicKey

    A public key used for verifying digital signatures.

    Currently supports:

    • Schnorr public keys (32 bytes, x-only) - bare byte string in CBOR
    • ECDSA public keys (33 bytes, compressed) - discriminator 1
    • Ed25519 public keys (32 bytes) - discriminator 2
    • MLDSA public keys (post-quantum) - tagged CBOR delegating to MLDSAPublicKey

    Implements

    Index
    • get scheme(): SignatureScheme

      Returns the signature scheme of this key.

      SSH RSA and P-521 keys have no SignatureScheme (the reference defines none for them) and throw Ssh with the reference's text for their signatures: Unsupported SSH signature algorithm / Unsupported SSH ECDSA curve.

      Returns SignatureScheme

    • get keyType(): string

      Returns a human-readable string identifying the key type.

      Returns string

      A string like "Ed25519", "Schnorr", "ECDSA", "MLDSA-44", etc.

    • Returns a copy of this SSH public key with its comment replaced. Throws if this is not an SSH key — mirrors the reference implementation's set_comment which is only callable on SigningPublicKey::SSH variants.

      Parameters

      • comment: string

      Returns SigningPublicKey

    • Get string representation.

      SigningPublicKey(<ref_hex_short>, <inner_key_display>) The reference is computed from the tagged-CBOR form.

      Returns string

    • Verifies a signature against a message.

      Parameters

      • signature: Signature

        The signature to verify

      • message: Uint8Array

        The message that was allegedly signed

      Returns boolean

      true if the signature is valid, false otherwise

    • Returns the untagged CBOR encoding.

      Format:

      • Schnorr: h'<32-byte-x-only-public-key>' (bare byte string)
      • ECDSA: [1, h'<33-byte-compressed-public-key>']
      • Ed25519: [2, h'<32-byte-public-key>']

      Returns Cbor

    • Returns the OpenSSH single-line public-key text for an SSH public key.

      Only valid when this SigningPublicKey wraps an SSHPublicKey (i.e. one of the four SignatureScheme.SshXxx variants). Mirrors the reference implementation's SigningPublicKey::SSH(key) => key.to_openssh() usage at signing_public_key.rs:442.

      Returns string