Trait SparkSignerEcdsa

Source
pub trait SparkSignerEcdsa {
    // Required methods
    fn sign_message_ecdsa_with_identity_key<T: AsRef<[u8]>>(
        &self,
        message: T,
        apply_hashing: bool,
    ) -> Result<Vec<u8>, SparkSdkError>;
    fn sign_message_ecdsa_with_key<T: AsRef<[u8]>>(
        &self,
        message: T,
        public_key_for_signing_key: &[u8],
        apply_hashing: bool,
    ) -> Result<Vec<u8>, SparkSdkError>;
}

Required Methods§

Source

fn sign_message_ecdsa_with_identity_key<T: AsRef<[u8]>>( &self, message: T, apply_hashing: bool, ) -> Result<Vec<u8>, SparkSdkError>

Signs a message using the identity private key. The identity key is the first derived key from the master seed (using child index 0).

Accepts any type that can be treated as a slice of u8 (e.g. Vec, &u8, Arc<Vec>, etc.).

§Arguments
  • message - The message to sign. Must implement AsRef<[u8]>.
  • apply_hashing - If true, the message will be hashed using SHA256 before signing. If false, the message will be signed directly.
§Returns

The DER-serialized (non-compact) signature of the message in a 72-byte array of Vec. To get the compact signature, the receiver needs to deserialize it to a [bitcoin::secp256k1::ecdsa::Signature] and call signature.serialize_compact() on it.

Source

fn sign_message_ecdsa_with_key<T: AsRef<[u8]>>( &self, message: T, public_key_for_signing_key: &[u8], apply_hashing: bool, ) -> Result<Vec<u8>, SparkSdkError>

Signs a message using a provided public key.

Accepts any type that can be treated as a slice of u8 (e.g. Vec, &u8, Arc<Vec>, etc.).

§Arguments
  • message - The message to sign. Must implement AsRef<[u8]>.
  • public_key_for_signing_key - The public key for the signing key.
  • apply_hashing - If true, the message will be hashed using SHA256 before signing. If false, the message will be signed directly.
§Returns

The DER-serialized (non-compact) signature of the message in a 72-byte array of Vec. To get the compact signature, the receiver needs to deserialize it to a [bitcoin::secp256k1::ecdsa::Signature] and call signature.serialize_compact() on it.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§