Trait fuel_crypto::Signer

source ·
pub trait Signer {
    type Error: From<Error> + From<<Self::Keystore as Keystore>::Error>;
    type Keystore: Keystore;

    // Required method
    fn keystore(&self) -> Result<&Self::Keystore, Self::Error>;

    // Provided methods
    fn id_secret(
        &self,
        id: &<Self::Keystore as Keystore>::KeyId
    ) -> Result<Borrown<'_, SecretKey>, Self::Error> { ... }
    fn id_public(
        &self,
        id: &<Self::Keystore as Keystore>::KeyId
    ) -> Result<Borrown<'_, PublicKey>, Self::Error> { ... }
    fn sign(
        &self,
        id: &<Self::Keystore as Keystore>::KeyId,
        message: &Message
    ) -> Result<Signature, Self::Error> { ... }
    fn sign_with_key(
        &self,
        secret: &SecretKey,
        message: &Message
    ) -> Result<Signature, Self::Error> { ... }
}
Expand description

Signature provider based on a keystore

Required Associated Types§

source

type Error: From<Error> + From<<Self::Keystore as Keystore>::Error>

Keystore error implementation

source

type Keystore: Keystore

Concrete keystore implementation

Required Methods§

source

fn keystore(&self) -> Result<&Self::Keystore, Self::Error>

Accessor to the keystore

Might fail if the keystore is in a corrupt state, not initialized or locked by a concurrent thread.

Provided Methods§

source

fn id_secret( &self, id: &<Self::Keystore as Keystore>::KeyId ) -> Result<Borrown<'_, SecretKey>, Self::Error>

Secret key indexed by id.

source

fn id_public( &self, id: &<Self::Keystore as Keystore>::KeyId ) -> Result<Borrown<'_, PublicKey>, Self::Error>

Public key indexed by id.

source

fn sign( &self, id: &<Self::Keystore as Keystore>::KeyId, message: &Message ) -> Result<Signature, Self::Error>

Sign a given message with the secret key identified by id

source

fn sign_with_key( &self, secret: &SecretKey, message: &Message ) -> Result<Signature, Self::Error>

Available on crate feature std only.

Sign a given message with the provided key

Implementors§