Add get_address_for_key to Member

This commit is contained in:
Sosthene 2024-10-29 12:59:03 +01:00
parent 9c9e50bcdb
commit c3a7a3570b

View File

@ -61,6 +61,14 @@ impl Member {
addr.get_spend_key() == *key addr.get_spend_key() == *key
}) })
} }
pub fn get_address_for_key(&self, key: &PublicKey) -> Option<String> {
self.sp_addresses.iter().find(|a| {
let addr = SilentPaymentAddress::try_from(a.as_str()).unwrap();
addr.get_spend_key() == *key
})
.cloned()
}
} }
sha256t_hash_newtype! { sha256t_hash_newtype! {