Trait GetKey

Source
pub trait GetKey {
    type Error: Debug;

    // Required method
    fn get_key<C: Signing>(
        &self,
        key_request: KeyRequest,
        secp: &Secp256k1<C>,
    ) -> Result<Option<PrivateKey>, Self::Error>;
}
Expand description

Trait to get a private key from a key request, key is then used to sign an input.

Required Associated Types§

Source

type Error: Debug

An error occurred while getting the key.

Required Methods§

Source

fn get_key<C: Signing>( &self, key_request: KeyRequest, secp: &Secp256k1<C>, ) -> Result<Option<PrivateKey>, Self::Error>

Attempts to get the private key for key_request.

§Returns
  • Some(key) if the key is found.
  • None if the key was not found but no error was encountered.
  • Err if an error was encountered while looking for the key.

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 GetKey for BTreeMap<PublicKey, PrivateKey>

Source§

type Error = GetKeyError

Source§

fn get_key<C: Signing>( &self, key_request: KeyRequest, _: &Secp256k1<C>, ) -> Result<Option<PrivateKey>, Self::Error>

Source§

impl GetKey for BTreeMap<XOnlyPublicKey, PrivateKey>

Source§

type Error = GetKeyError

Source§

fn get_key<C: Signing>( &self, key_request: KeyRequest, secp: &Secp256k1<C>, ) -> Result<Option<PrivateKey>, Self::Error>

Source§

impl GetKey for BTreeSet<Xpriv>

Source§

type Error = GetKeyError

Source§

fn get_key<C: Signing>( &self, key_request: KeyRequest, secp: &Secp256k1<C>, ) -> Result<Option<PrivateKey>, Self::Error>

Source§

impl GetKey for HashMap<PublicKey, PrivateKey>

Source§

type Error = GetKeyError

Source§

fn get_key<C: Signing>( &self, key_request: KeyRequest, _: &Secp256k1<C>, ) -> Result<Option<PrivateKey>, Self::Error>

Source§

impl GetKey for HashMap<XOnlyPublicKey, PrivateKey>

Source§

type Error = GetKeyError

Source§

fn get_key<C: Signing>( &self, key_request: KeyRequest, secp: &Secp256k1<C>, ) -> Result<Option<PrivateKey>, Self::Error>

Source§

impl GetKey for HashSet<Xpriv>

Source§

type Error = GetKeyError

Source§

fn get_key<C: Signing>( &self, key_request: KeyRequest, secp: &Secp256k1<C>, ) -> Result<Option<PrivateKey>, Self::Error>

Implementors§