Trait bdk_chain::bitcoin::psbt::GetKey

pub trait GetKey {
    type Error: Debug;

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

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

Required Associated Types§

type Error: Debug

An error occurred while getting the key.

Required Methods§

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

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.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

§

impl GetKey for BTreeMap<PublicKey, PrivateKey>

§

type Error = GetKeyError

§

fn get_key<C>( &self, key_request: KeyRequest, _: &Secp256k1<C> ) -> Result<Option<PrivateKey>, <BTreeMap<PublicKey, PrivateKey> as GetKey>::Error>
where C: Signing,

§

impl GetKey for BTreeSet<Xpriv>

§

type Error = GetKeyError

§

fn get_key<C>( &self, key_request: KeyRequest, secp: &Secp256k1<C> ) -> Result<Option<PrivateKey>, <BTreeSet<Xpriv> as GetKey>::Error>
where C: Signing,

§

impl GetKey for HashMap<PublicKey, PrivateKey>

§

type Error = GetKeyError

§

fn get_key<C>( &self, key_request: KeyRequest, _: &Secp256k1<C> ) -> Result<Option<PrivateKey>, <HashMap<PublicKey, PrivateKey> as GetKey>::Error>
where C: Signing,

§

impl GetKey for HashSet<Xpriv>

§

type Error = GetKeyError

§

fn get_key<C>( &self, key_request: KeyRequest, secp: &Secp256k1<C> ) -> Result<Option<PrivateKey>, <HashSet<Xpriv> as GetKey>::Error>
where C: Signing,

Implementors§