use bitcoin::secp256k1::{KeyPair, PublicKey, Secp256k1, SecretKey, Signing, XOnlyPublicKey};
use bitcoin::util::bip32::{DerivationPath, Fingerprint};
mod inmem;
#[cfg(feature = "miniscript")]
mod signer;
pub use inmem::{MemoryKeyProvider, MemorySigningAccount};
#[cfg(feature = "miniscript")]
pub use signer::{SignAll, SignError, SignInputError};
#[derive(
Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Debug, Error, Display, From
)]
#[display(doc_comments)]
pub enum SecretProviderError {
AccountUnknown(Fingerprint, PublicKey),
}
pub trait SecretProvider<C: Signing> {
fn secp_context(&self) -> &Secp256k1<C>;
fn secret_key(
&self,
fingerprint: Fingerprint,
derivation: &DerivationPath,
pubkey: PublicKey,
) -> Result<SecretKey, SecretProviderError>;
fn key_pair(
&self,
fingerprint: Fingerprint,
derivation: &DerivationPath,
pubkey: XOnlyPublicKey,
) -> Result<KeyPair, SecretProviderError>;
fn use_musig(&self) -> bool;
}