Trait SecretKeyTrait

Source
pub trait SecretKeyTrait: PublicKeyTrait {
    type PublicKey;
    type Unlocked;

    // Required methods
    fn unlock<F, G, T>(&self, pw: F, work: G) -> Result<T>
       where F: FnOnce() -> String,
             G: FnOnce(&Self::Unlocked) -> Result<T>;
    fn create_signature<F>(
        &self,
        key_pw: F,
        hash: HashAlgorithm,
        data: &[u8],
    ) -> Result<SignatureBytes>
       where F: FnOnce() -> String;
    fn public_key(&self) -> Self::PublicKey;

    // Provided method
    fn hash_alg(&self) -> HashAlgorithm { ... }
}

Required Associated Types§

Source

type PublicKey

Source

type Unlocked

The type representing the unlocked version of this.

Required Methods§

Source

fn unlock<F, G, T>(&self, pw: F, work: G) -> Result<T>
where F: FnOnce() -> String, G: FnOnce(&Self::Unlocked) -> Result<T>,

Unlock the raw data in the secret parameters.

Source

fn create_signature<F>( &self, key_pw: F, hash: HashAlgorithm, data: &[u8], ) -> Result<SignatureBytes>
where F: FnOnce() -> String,

Source

fn public_key(&self) -> Self::PublicKey

Provided Methods§

Source

fn hash_alg(&self) -> HashAlgorithm

The suggested hash algorithm to calculate the signature hash digest with, when using this key as a signer

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.

Implementations on Foreign Types§

Source§

impl<'a, T: SecretKeyTrait> SecretKeyTrait for &'a T

Source§

type PublicKey = <T as SecretKeyTrait>::PublicKey

Source§

type Unlocked = <T as SecretKeyTrait>::Unlocked

Source§

fn unlock<F, G, S>(&self, pw: F, work: G) -> Result<S>
where F: FnOnce() -> String, G: FnOnce(&Self::Unlocked) -> Result<S>,

Source§

fn create_signature<F>( &self, key_pw: F, hash: HashAlgorithm, data: &[u8], ) -> Result<SignatureBytes>
where F: FnOnce() -> String,

Source§

fn public_key(&self) -> Self::PublicKey

Implementors§