Signer

Trait Signer 

Source
pub trait Signer: Send + Sync {
    // Required methods
    fn match_id(&self, id: &[u8]) -> bool;
    fn sign(
        &self,
        id: &[u8],
        message: &[u8],
        recoverable: bool,
        tx: &TransactionView,
    ) -> Result<Bytes, SignerError>;
}
Expand description

A signer abstraction, support signer type:

  • secp256k1 ckb signer
  • secp256k1 eth signer
  • RSA signer
  • Hardware wallet signer

Required Methods§

Source

fn match_id(&self, id: &[u8]) -> bool

typecial id are blake160(pubkey) and keccak256(pubkey)[12..20]

Source

fn sign( &self, id: &[u8], message: &[u8], recoverable: bool, tx: &TransactionView, ) -> Result<Bytes, SignerError>

message type is variable length, because different algorithm have different length of message:

  • secp256k1 => 256bits
  • RSA => 512bits (when key size is 1024bits)

Implementors§