diff options
| author | tv <tv@krebsco.de> | 2026-11-13 03:16:33 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-13 03:16:33 +0000 |
| commit | 47d88d224c5c8fa42b4f30b8ec37c7e5deb83ea2 (patch) | |
| tree | becf56fd584d9ed37fbce0a4708b1dd17e26debd /src/document | |
| parent | 6cb4d3fd8f5024c340bd9321a434c8579cce81e7 (diff) | |
screen: a twin of this node's actor switches it only signed with its key
A node switched to a fresh actor whenever a peer showed it a change of
its own actor that it didn't hold, signed or not. So any peer made a
node start a writer at will, by sending a copy of its last change with
another value: and every writer costs every node memory in proportion
to the document's history.
Copies of a node's data directory hold its key, and sign their
changes with it; a stranger can't. A twin switches the node only where
a signature by the node's own key of it is kept or waiting. Unsigned,
it is refused as forged as before, and nothing switches.
Diffstat (limited to 'src/document')
| -rw-r--r-- | src/document/signatures.rs | 11 |
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 { |
