Trait psbt::sign::SecretProvider [−][src]
pub trait SecretProvider<C: Signing> {
fn secp_context(&self) -> &Secp256k1<C>;
fn secret_key(
&self,
fingerprint: Fingerprint,
derivation: &DerivationPath,
pubkey: PublicKey
) -> Result<SecretKey, SecretProviderError>;
}
Expand description
Structures extended private keys after their corresponding ids (“account ids”) and performs derivation to produce corresponding public keys under a given account
Required methods
fn secp_context(&self) -> &Secp256k1<C>
fn secp_context(&self) -> &Secp256k1<C>
Returns [Secp256k1
] context object used by the provider
fn secret_key(
&self,
fingerprint: Fingerprint,
derivation: &DerivationPath,
pubkey: PublicKey
) -> Result<SecretKey, SecretProviderError>
fn secret_key(
&self,
fingerprint: Fingerprint,
derivation: &DerivationPath,
pubkey: PublicKey
) -> Result<SecretKey, SecretProviderError>
Returns secret key matching provided public key by iterating over all extended private keys having the provided fingerprint.
Error
Errors with SecretProviderError::AccountUnknown
if none of the known
extended private keys has the specified fingerprint and can be
derived with a given path into the provided public key.
NB: This does not imply that the given key can’t be derived from know extended public keys, but with a differend derivation. I.e. the function will error just because fingerprint does not match correct extended public key - or derivation path contains a erorr.