diff options
Diffstat (limited to 'src/access/strict.rs')
| -rw-r--r-- | src/access/strict.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/access/strict.rs b/src/access/strict.rs index 0b294f8..9857bed 100644 --- a/src/access/strict.rs +++ b/src/access/strict.rs @@ -16,7 +16,7 @@ use serde_json::Value as JsonValue; use sha2::{Digest, Sha256}; use super::{envelope, sshsig}; -use crate::document::{ReadDoc, store}; +use crate::document::view::{self, Read}; /// What a manifest's signature is for (`sshsig`). pub(crate) const NAMESPACE: &str = "continuum-strict"; @@ -95,21 +95,21 @@ pub(crate) fn digest(value: &JsonValue) -> String { /// The places values are signed in `doc` (`envelope::signed_paths`, `*` as `doc` has /// them) that hold one, with it, as the store reads it. -pub(crate) fn held(doc: &impl ReadDoc) -> Vec<(Vec<String>, JsonValue)> { +pub(crate) fn held(doc: &impl Read) -> Vec<(Vec<String>, JsonValue)> { fn expand( - doc: &impl ReadDoc, + doc: &impl Read, pattern: &[String], at: Vec<String>, out: &mut Vec<(Vec<String>, JsonValue)>, ) { match pattern.split_first() { None => { - if let Ok(Some(value)) = store::read_path(doc, &at) { + if let Ok(Some(value)) = view::read_path(doc, &at) { out.push((at, value)); } } Some((segment, rest)) if segment == "*" => { - for key in store::keys_at(doc, &at).ok().flatten().unwrap_or_default() { + for key in view::keys_at(doc, &at).ok().flatten().unwrap_or_default() { let mut next = at.clone(); next.push(key); expand(doc, rest, next, out); @@ -135,7 +135,7 @@ pub(crate) fn held(doc: &impl ReadDoc) -> Vec<(Vec<String>, JsonValue)> { /// held at a signed place now, the policy `policy`, for `user` to look over and sign at /// `at`. Its exact line. pub(crate) fn manifest_of( - doc: &impl ReadDoc, + doc: &impl Read, swarm: &str, epoch: crate::document::replica::EpochRecord, base: &[crate::document::ChangeHash], @@ -225,15 +225,15 @@ mod tests { fn a_manifest_signed_and_checked() { let mut doc = Document::new(); change(&mut doc, |doc| { - store::write_path(doc, &path("_continuum/users/alice"), &json!({"caps": {}})).unwrap(); - store::write_path( + view::write_path(doc, &path("_continuum/users/alice"), &json!({"caps": {}})).unwrap(); + view::write_path( doc, &path("_continuum/access/userSigned"), &json!([["config"]]), ) .unwrap(); - store::write_path(doc, &path("config"), &json!({"mode": "fast"})).unwrap(); - store::write_path(doc, &path("notes"), &json!(1)).unwrap(); + view::write_path(doc, &path("config"), &json!({"mode": "fast"})).unwrap(); + view::write_path(doc, &path("notes"), &json!(1)).unwrap(); }); let policy = json!({"version": 1, "values": "signed"}); let epoch = |
