Gordian Envelope TypeScript Library - v1.0.0-alpha.13
    Preparing search index...

    Class SigningPrivateKey

    A private key used for creating digital signatures.

    Currently supports:

    • Schnorr private keys (32 bytes, secp256k1) - bare byte string in CBOR
    • ECDSA private keys (32 bytes, secp256k1) - discriminator 1
    • Ed25519 private keys (32 bytes) - discriminator 2
    • SR25519 private keys (32-byte seed) - discriminator 3
    • MLDSA private keys (post-quantum) - tagged CBOR delegating to MLDSAPrivateKey

    Implements

    Index

    Properties

    UR_TYPE: "signing-private-key"

    Get the UR type for signing private keys.

    Methods

    • Creates a new Schnorr signing private key from an ECPrivateKey.

      Parameters

      • key: ECPrivateKey

        The EC private key to use for Schnorr signing

      Returns SigningPrivateKey

      A new Schnorr signing private key

    • Creates a new ECDSA signing private key from an ECPrivateKey.

      Parameters

      • key: ECPrivateKey

        The EC private key to use for ECDSA signing

      Returns SigningPrivateKey

      A new ECDSA signing private key

    • Creates a new Ed25519 signing private key from an Ed25519PrivateKey.

      Parameters

      • key: Ed25519PrivateKey

        The Ed25519 private key to use

      Returns SigningPrivateKey

      A new Ed25519 signing private key

    • Creates a new SR25519 signing private key from an Sr25519PrivateKey.

      Parameters

      • key: Sr25519PrivateKey

        The SR25519 private key to use

      Returns SigningPrivateKey

      A new SR25519 signing private key

    • Creates a new MLDSA signing private key from an MLDSAPrivateKey.

      Parameters

      • key: MLDSAPrivateKey

        The MLDSA private key to use

      Returns SigningPrivateKey

      A new MLDSA signing private key

    • Creates a new random Ed25519 signing private key.

      Returns SigningPrivateKey

      A new random Ed25519 signing private key

    • Creates a new random Schnorr signing private key.

      Returns SigningPrivateKey

      A new random Schnorr signing private key

    • Creates a new random ECDSA signing private key.

      Returns SigningPrivateKey

      A new random ECDSA signing private key

    • Creates a new random SR25519 signing private key.

      Returns SigningPrivateKey

      A new random SR25519 signing private key

    • Returns the signature scheme of this key.

      Returns SignatureScheme

    • Returns a human-readable string identifying the key type.

      Returns string

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

    • Returns the underlying EC private key if this is a Schnorr or ECDSA key.

      Returns ECPrivateKey | null

      The EC private key if this is a Schnorr or ECDSA key, null otherwise

    • Returns the underlying Ed25519 private key if this is an Ed25519 key.

      Returns Ed25519PrivateKey | null

      The Ed25519 private key if this is an Ed25519 key, null otherwise

    • Returns the underlying Sr25519 private key if this is an Sr25519 key.

      Returns Sr25519PrivateKey | null

      The Sr25519 private key if this is an Sr25519 key, null otherwise

    • Returns the underlying MLDSA private key if this is an MLDSA key.

      Returns MLDSAPrivateKey | null

      The MLDSA private key if this is an MLDSA key, null otherwise

    • Checks if this is a Schnorr signing key.

      Returns boolean

    • Checks if this is an ECDSA signing key.

      Returns boolean

    • Checks if this is an Ed25519 signing key.

      Returns boolean

    • Checks if this is an Sr25519 signing key.

      Returns boolean

    • Checks if this is an MLDSA signing key.

      Returns boolean

    • Derives the corresponding public key for this private key.

      Returns SigningPublicKey

      The public key corresponding to this private key

    • Compare with another SigningPrivateKey.

      Parameters

      Returns boolean

    • Get string representation.

      Returns string

    • Returns a unique reference to this SigningPrivateKey instance.

      The reference is derived from the SHA-256 hash of the tagged CBOR representation, providing a unique, content-addressable identifier.

      Returns Reference

    • Signs a message with optional signing options.

      Different signature schemes may use the options differently:

      • Schnorr: Can accept a custom random number generator via SigningOptions.Schnorr
      • SSH: Would require namespace and hash algorithm (not yet implemented)
      • Other schemes (ECDSA, Ed25519, Sr25519, MLDSA): Options are ignored

      Parameters

      • message: Uint8Array

        The message to sign

      • Optionaloptions: SigningOptions

        Optional signing options

      Returns Signature

      The digital signature

    • Signs a message using default options.

      This is a convenience method that calls signWithOptions with no options.

      Parameters

      • message: Uint8Array

        The message to sign

      Returns Signature

      The digital signature

    • 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 CBOR tags associated with SigningPrivateKey.

      Returns Tag[]

    • Returns the untagged CBOR encoding.

      Format (matching Rust bc-components):

      • Schnorr: h'<32-byte-private-key>' (bare byte string)
      • ECDSA: [1, h'<32-byte-private-key>']
      • Ed25519: [2, h'<32-byte-private-key>']
      • Sr25519: [3, h'<32-byte-seed>']
      • MLDSA: delegates to MLDSAPrivateKey (tagged)

      Returns Cbor

    • Returns the tagged CBOR encoding.

      Returns Cbor

    • Returns the tagged value in CBOR binary representation.

      Returns Uint8Array

    • Creates a SigningPrivateKey by decoding it from untagged CBOR.

      Format (matching Rust bc-components):

      • h'<32-byte-key>' (bare byte string) for Schnorr
      • [1, h'<32-byte-key>'] for ECDSA
      • [2, h'<32-byte-key>'] for Ed25519
      • [3, h'<32-byte-seed>'] for Sr25519
      • tagged MLDSA private key for MLDSA variants

      Parameters

      • cborValue: Cbor

      Returns SigningPrivateKey

    • Creates a SigningPrivateKey by decoding it from tagged CBOR.

      Parameters

      • cborValue: Cbor

      Returns SigningPrivateKey

    • Static method to decode from tagged CBOR.

      Parameters

      • cborValue: Cbor

      Returns SigningPrivateKey

    • Static method to decode from tagged CBOR binary data.

      Parameters

      • data: Uint8Array

      Returns SigningPrivateKey

    • Static method to decode from untagged CBOR binary data.

      Parameters

      • data: Uint8Array

      Returns SigningPrivateKey

    • Returns the UR representation of the signing private key.

      Returns UR

    • Returns the UR string representation of the signing private key.

      Returns string

    • Creates a SigningPrivateKey from a UR string.

      Parameters

      • urString: string

      Returns SigningPrivateKey

    • Alias for fromURString for Rust API compatibility.

      Parameters

      • urString: string

      Returns SigningPrivateKey

    • Converts the private key to OpenSSH format. Currently only supports Ed25519 keys.

      Parameters

      • Optionalcomment: string

      Returns string