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

    Class Signature

    A digital signature created with various signature algorithms.

    Currently supports:

    • Schnorr signatures (64 bytes) - bare byte string in CBOR
    • ECDSA signatures (64 bytes) - discriminator 1
    • Ed25519 signatures (64 bytes) - discriminator 2
    • MLDSA signatures (post-quantum) - tagged CBOR delegating to MLDSASignature

    Implements

    • ToCbor
    Index
    • get scheme(): SignatureScheme

      Returns the signature scheme used to create this signature.

      As the reference's Signature::scheme(), an sshsig made with an RSA key or a P-521 key has no scheme and throws Ssh: Unsupported SSH signature algorithm / Unsupported SSH ECDSA curve.

      Returns SignatureScheme

    • get signatureType(): string

      Returns a human-readable string identifying the signature type.

      Returns string

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

    • Creates a Schnorr signature from a 64-byte array.

      Parameters

      • data: Uint8Array

        The 64-byte signature data

      Returns Signature

      A new Schnorr signature

    • Creates a Schnorr signature from a hex string.

      Parameters

      • hex: string

        The hex-encoded signature data

      Returns Signature

      A new Schnorr signature

    • Creates an ECDSA signature from a 64-byte array.

      Parameters

      • data: Uint8Array

        The 64-byte signature data

      Returns Signature

      A new ECDSA signature

    • Creates an ECDSA signature from a hex string.

      Parameters

      • hex: string

        The hex-encoded signature data

      Returns Signature

      A new ECDSA signature

    • Creates an Ed25519 signature from a 64-byte array.

      Parameters

      • data: Uint8Array

        The 64-byte signature data

      Returns Signature

      A new Ed25519 signature

    • Creates an Ed25519 signature from a hex string.

      Parameters

      • hex: string

        The hex-encoded signature data

      Returns Signature

      A new Ed25519 signature

    • Creates a Signature from an SSHSignature.

      The signature scheme is derived from the inner public-key algorithm, as the reference implementation does Signature::scheme() at lines 506-519.

      Parameters

      Returns Signature

      A new SSH Signature

    • Returns the Schnorr signature data if this is a Schnorr signature.

      Returns Uint8Array<ArrayBufferLike> | undefined

      The 64-byte signature data if this is a Schnorr signature, undefined otherwise

    • Returns the ECDSA signature data if this is an ECDSA signature.

      Returns Uint8Array<ArrayBufferLike> | undefined

      The 64-byte signature data if this is an ECDSA signature, undefined otherwise

    • Returns the Ed25519 signature data if this is an Ed25519 signature.

      Returns Uint8Array<ArrayBufferLike> | undefined

      The 64-byte signature data if this is an Ed25519 signature, undefined otherwise

    • Get hex string representation of the signature data.

      Returns string

    • The CBOR tags this type decodes from; the first one is used to encode.

      Returns Tag[]

    • Returns the untagged CBOR encoding.

      Format:

      • Schnorr: h'<64-byte-signature>' (bare byte string)
      • ECDSA: [1, h'<64-byte-signature>']
      • Ed25519: [2, h'<64-byte-signature>']

      Returns Cbor