|
64 | 64 | //! the one context the caller supplies. That context is a |
65 | 65 | //! [`RequiredContext<CallerContext>`], or a `RequiredContext<AeadContext>` |
66 | 66 | //! with `context_type = AeadContext`. A `#[stash(context_field)]` record |
67 | | -//! requires the `NonEmpty<T>` it stores, and opens under an |
68 | | -//! [`ExpectedContext`]. |
| 67 | +//! requires the `NonEmpty<T>` it stores. On decrypt the caller may pass that |
| 68 | +//! `NonEmpty<T>` again, and the stored value must then equal it. |
69 | 69 | //! |
70 | 70 | //! Both derives also implement the structural traits ([`EncryptFrom`], |
71 | 71 | //! [`DecryptInto`] and [`DecryptField`]). So an owned record can be a field |
|
92 | 92 | //! |
93 | 93 | //! The derives compose each semantic field's declaration. `#[stash(context_field)]` |
94 | 94 | //! on an identifier of type `T` makes the encryption context `NonEmpty<T>` and |
95 | | -//! stores its inner value. Opening takes an [`ExpectedContext`]: by default it checks only that the stored identifier is nonempty and opens under it as stored; a `NonEmpty<T>` also requires it to equal the destination the caller names, and a mismatch is refused before any key is retrieved. |
| 95 | +//! stores its inner value. Opening takes the context the caller expects, or none: by default it checks only that the stored identifier is nonempty and opens under it as stored; a `NonEmpty<T>` also requires it to equal the destination the caller names, and a mismatch is refused before any key is retrieved. |
96 | 96 | //! Record envelope names do not add cryptographic map keys. |
97 | 97 | //! |
98 | 98 | //! Generic targets use [`CallerContext`] (ciphertext and terms) or [`AeadContext`] |
@@ -184,9 +184,15 @@ pub mod transcode; |
184 | 184 | mod tuples; |
185 | 185 |
|
186 | 186 | pub(crate) use self::core::{bind_pending, seal_pending}; |
| 187 | +/// The check a `#[stash(context_field)]` record runs on decrypt. It is not |
| 188 | +/// part of the API: the derives and the EQL types name it, and a caller |
| 189 | +/// passes a `NonEmpty<T>` or nothing. It is public only so that code the |
| 190 | +/// derives emit in another crate can name it. |
| 191 | +#[doc(hidden)] |
| 192 | +pub use context::ExpectedContext; |
187 | 193 | pub use context::{ |
188 | | - AeadContext, Bind, BindPart, CallerContext, CheckedInput, DeclaredContext, ExpectedContext, |
189 | | - Extends, NoBind, NoScope, Parts, Scope, ScopePart, StoredParts, |
| 194 | + AeadContext, Bind, BindPart, CallerContext, CheckedInput, DeclaredContext, Extends, NoBind, |
| 195 | + NoScope, Parts, Scope, ScopePart, StoredParts, |
190 | 196 | }; |
191 | 197 | pub use index::{ |
192 | 198 | indexed, At, Encrypted, Equality, Index, IndexSpec, Indexes, Json, Match, Ope, Ore, OreBlock, |
|
0 commit comments