From 6be5646df342b21fe82c63f59cfec5a369ab54f8 Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 15 Nov 2026 12:28:33 +0000 Subject: signed values: value and meta apart, numbered; the highest seq is read A member could put a user's older signed value back beside a newer one: a change made with dependencies from before both is judged where the place was empty, so the older envelope (`prev` empty) is taken; and of values written at once, the one read was the one with the highest operation, which whoever writes the change steers. A revoked capability, a lifted ban or an earlier policy came back that way, signed by whoever signed it then. An envelope is now `cv2...`: the value as its user wrote it, and apart from it what continuum adds (swarm, path, user, at, seq, prev), the signature over the value's line and the meta's. `seq` is one more than that of the envelope it replaces, 0 where it replaces none; every node checks it with `prev`. Of the values a place holds, written at once, signed ones are read before any other, the highest `seq` first, of equal ones the lower digest (`store::candidates`): reads, snapshots and writes all go by it. An older envelope beside a newer one changes nothing. `application/continuum-signed` is the value's line, the meta's, then the signature; `scripts/continuum-signed` writes and checks it so. The wire version goes up: nodes must agree on what a place's value is. --- src/access/sealed.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/access/sealed.rs') diff --git a/src/access/sealed.rs b/src/access/sealed.rs index 7e48e34..545fe76 100644 --- a/src/access/sealed.rs +++ b/src/access/sealed.rs @@ -148,7 +148,7 @@ pub(crate) fn check( let JsonValue::String(text) = value else { return Err("a sealed value is a string (cs1.)".to_owned()); }; - let sealed = if text.starts_with("cv1.") { + let sealed = if text.starts_with(store::ENVELOPE) { match envelope::read(text)?.value { JsonValue::Null => return Ok(()), JsonValue::String(sealed) => sealed, @@ -340,8 +340,13 @@ mod tests { assert!(check(&doc, notes, &json!("plain")).is_err()); // Signed: holding a sealed value, or null. let signed = |value: JsonValue| { - let payload = json!({"swarm": "s", "path": ["notes"], "value": value, "user": "alice", "at": 1, "prev": ""}); - format!("cv1.{}.c2ln", B64URL.encode(payload.to_string())) + let meta = json!({"swarm": "s", "path": ["notes"], "user": "alice", "at": 1, "seq": 0, "prev": ""}); + format!( + "{}{}.{}.c2ln", + store::ENVELOPE, + B64URL.encode(value.to_string()), + B64URL.encode(meta.to_string()) + ) }; assert!(check(&doc, notes, &json!(signed(json!(sealed_for(&[key(9)]))))).is_ok()); assert!(check(&doc, notes, &json!(signed(JsonValue::Null))).is_ok()); -- cgit v1.3.1