From 3152af43504bcfd6285d41f6b6ff67631d01fd0e Mon Sep 17 00:00:00 2001 From: tv Date: Sun, 15 Nov 2026 16:31:37 +0000 Subject: signed values: one reading of an envelope, everywhere Three parts read an envelope three ways: the store's order took any string with the prefix whose meta held a `seq`, its reads any whose value decoded, the checks only one with four parts and a meta of exactly its fields. A string that the first two took and the checks refused was read first, read as the registry's or the policy's value, and treated as nothing by the check of the next write there. `document::signed` reads an envelope the one way: four parts, the value JSON, the meta exactly its six fields (one more, or one twice, and it isn't one), no newline in either, the signature decoding. The store's order, its plain reads, the checks, the API and the users API all go by it. What isn't one in every respect is a plain string, wherever it is read. --- src/simtest/policy.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/simtest/policy.rs') diff --git a/src/simtest/policy.rs b/src/simtest/policy.rs index 4182b11..e5665cd 100644 --- a/src/simtest/policy.rs +++ b/src/simtest/policy.rs @@ -214,9 +214,7 @@ async fn write_signed( use crate::document::typed::{TimestampFormat, Val}; let at = path(at); let previous = match store::read_path(&node.doc.read().await.doc, &at) { - Ok(Some(serde_json::Value::String(text))) if text.starts_with(store::ENVELOPE) => { - Some(text) - } + Ok(Some(serde_json::Value::String(text))) if envelope::read(&text).is_ok() => Some(text), _ => None, }; let swarm = store::read_path(&node.doc.read().await.doc, &path("_continuum/swarm")) -- cgit v1.3.1