user info serialisable

new-idea
Avril 4 years ago
parent 3b9ffd8ead
commit 3bad812765
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -77,14 +77,14 @@ impl User
{ {
/// Is this user a trusted user? /// Is this user a trusted user?
/// ///
/// I.e. Does this user have at least one trusted public key (they have produced a valid signature specified in `id_sig`). /// Does this user have at least one trusted public key (they have produced a valid signature specified in `id_sig`).
pub fn is_trusted(&self) -> eyre::Result<bool> pub fn is_trusted(&self) -> eyre::Result<bool>
{ {
for (key, (salt, sig)) in self.pubkey.iter().zip(self.id_sig.iter()) for (key, (salt, sig)) in self.pubkey.iter().zip(self.id_sig.iter())
{ {
if let Some(sig) = sig { if let Some(sig) = sig {
let hash = self.id.hash_with_salt(salt); let hash = self.id.hash_with_salt(salt);
if sig.verify_slice(hash.as_ref(), key) if sig.verify_slice(hash, key)
.wrap_err(eyre!("Failed to verify signature"))? { .wrap_err(eyre!("Failed to verify signature"))? {
return Ok(true); return Ok(true);
} }

Loading…
Cancel
Save