/// Identifier of a signer in the `SignersContainers`. Used as a key to find the right signer among
/// multiple of them
-#[derive(Debug, Clone, PartialEq, Eq, Hash)]
+#[derive(Debug, Clone, Ord, PartialOrd, PartialEq, Eq, Hash)]
pub enum SignerId {
+ /// Bitcoin HASH160 (RIPEMD160 after SHA256) hash of an ECDSA public key
PkHash(hash160::Hash),
+ /// The fingerprint of a BIP32 extended key
Fingerprint(Fingerprint),
}
/// Container for multiple signers
#[derive(Debug, Default, Clone)]
-pub struct SignersContainer(HashMap<SignersContainerKey, Arc<dyn Signer>>);
+pub struct SignersContainer(BTreeMap<SignersContainerKey, Arc<dyn Signer>>);
impl SignersContainer {
+ /// Create a map of public keys to secret keys
pub fn as_key_map(&self, secp: &SecpCtx) -> KeyMap {
self.0
.values()