|
|
|
@ -77,14 +77,14 @@ impl 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>
|
|
|
|
|
{
|
|
|
|
|
for (key, (salt, sig)) in self.pubkey.iter().zip(self.id_sig.iter())
|
|
|
|
|
{
|
|
|
|
|
if let Some(sig) = sig {
|
|
|
|
|
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"))? {
|
|
|
|
|
return Ok(true);
|
|
|
|
|
}
|
|
|
|
|