aboutsummaryrefslogtreecommitdiffstats
path: root/src/access/sealed.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/access/sealed.rs')
-rw-r--r--src/access/sealed.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/access/sealed.rs b/src/access/sealed.rs
index c30bea7..b39a465 100644
--- a/src/access/sealed.rs
+++ b/src/access/sealed.rs
@@ -48,7 +48,7 @@ pub(crate) struct Declared {
}
/// What `doc` declares sealed; an entry that doesn't read as one is left out.
-pub(crate) fn declared(doc: &impl Read) -> Vec<Declared> {
+pub(crate) fn declared(doc: &(impl Read + ?Sized)) -> Vec<Declared> {
let Ok(Some(JsonValue::Array(entries))) = view::read_plain(doc, &declared_at()) else {
return Vec::new();
};
@@ -141,7 +141,11 @@ pub(crate) fn recipients(sealed: &str) -> Result<BTreeSet<String>, String> {
/// (as its writer saw it): a sealed value, or, signed by its user (`access::envelope`),
/// one holding a sealed value or `null` (deleted); with readers declared, sealed for
/// exactly their keys.
-pub(crate) fn check(doc: &impl Read, declared: &Declared, value: &JsonValue) -> Result<(), String> {
+pub(crate) fn check(
+ doc: &(impl Read + ?Sized),
+ declared: &Declared,
+ value: &JsonValue,
+) -> Result<(), String> {
let JsonValue::String(text) = value else {
return Err("a sealed value is a string (cs1.<age file>)".to_owned());
};
@@ -184,7 +188,7 @@ pub(crate) fn check(doc: &impl Read, declared: &Declared, value: &JsonValue) ->
/// Checks what is at `path` in `doc` after a write there: nothing within a declared
/// place but its value, and every value at one (at `path` or below it) as `check` says.
/// Why not, if not.
-pub(crate) fn kept(doc: &impl Read, path: &[String]) -> Result<(), String> {
+pub(crate) fn kept(doc: &(impl Read + ?Sized), path: &[String]) -> Result<(), String> {
let declared = declared(doc);
if declared.is_empty() || !reaches(&declared, path) {
return Ok(());
@@ -193,7 +197,7 @@ pub(crate) fn kept(doc: &impl Read, path: &[String]) -> Result<(), String> {
return Err(format!("/{} is within a sealed value", path.join("/")));
}
fn walk(
- doc: &impl Read,
+ doc: &(impl Read + ?Sized),
declared: &[Declared],
value: &JsonValue,
at: &mut Vec<String>,