aboutsummaryrefslogtreecommitdiffstats
path: root/src/document
diff options
context:
space:
mode:
Diffstat (limited to 'src/document')
-rw-r--r--src/document/signatures.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/document/signatures.rs b/src/document/signatures.rs
index 79c8569..f9dd94b 100644
--- a/src/document/signatures.rs
+++ b/src/document/signatures.rs
@@ -594,6 +594,17 @@ impl Signatures {
signed
}
+ /// Whether a signature of `hash` by the node whose public key is `key` is kept or
+ /// waiting for its change (`pending`): checked here, the change not needed.
+ pub(crate) fn signed_by(&self, hash: &ChangeHash, key: &[u8; 32]) -> bool {
+ let message = message(hash);
+ self.by_change
+ .get(hash)
+ .into_iter()
+ .chain(self.pending.by_change.get(hash).into_iter().flatten())
+ .any(|signature| crate::identity::verify(key, &message, signature))
+ }
+
/// Whether a valid signature of `hash` is kept: it vouches for its change and the
/// changes of its actor it builds on.
pub(crate) fn signed(&self, hash: &ChangeHash) -> bool {