Repository navigation
Commit faeee56
authored
feat(stack-encrypt)!: plan grammar gains two starts, three context sources, encrypt_into and pickers
The derive is to emit the plan, so the plan must say everything the
narrowed derive says. This adds, Rust-only:
- Two starts: Plan::fields() and Plan::value::<S>(), each with an optional
.context(c); Plan::context(c).fields()/.with(..) keep working. The
FieldPlan iterator on a built plan is renamed field_plans(), since
Plan::fields() is now the start.
- Exactly one context source: the plan, the call
(cipher.encrypt(&v).context(c).using(&plan), and .context(c) on query
and open), or a context field of the value (.context_field(field)),
carried as a passthrough and checked on open through ExpectedContext.
Two is TwoContextSources at build or at the call; none is NoContext when
the plan runs, before any key request.
- encrypt_into: the field form lowers to the target's own EncryptFrom
under <context>/<identity>, exactly as the derive composes a
record-typed field; the one-value form takes a target or a tuple of
them. A field is a target or data verbs, never both (TargetWithVerbs).
A typed field answers the queries its target declares.
- Pickers: every verb takes a name (Field<F> lookup) or a name with an
accessor; a plan of pickers needs no Fields impl and skips the run-time
field-name check.
Also the #1071 review: a pinned identity rescues a field name that is not
a plain segment (tuple fields "0", renamed columns); a Vec written through
a one-value plan opens through it in one request; a query whose match
options differ says so (IndexOptions); the over-strong "before any
request" claims are scoped; the parameter and doc noun row is now record.
Runs::check and Opens::check take the context the call names, so a
chain refuses a missing or doubled context, and a context field's
mismatch, before it loads a keyset.
The plan_build fuzz target follows: it builds plans with or without a
context and with context fields, and asserts that a context given twice
is refused as TwoContextSources and that a contextless plan keys each
sealed field under one plain identity segment.
BREAKING CHANGE: the unreleased plan API changes shape (nothing here is
in 0.2.0). Plan::fields() starts a fields plan, so a built plan's field
iterator is Plan::field_plans(). A one-value plan is
ValuePlan<S, Indexed<X>> or ValuePlan<S, Typed<T>> in place of
ValuePlan<S, X>. Plan::label and ValuePlan::label return Option<&Label>.
Runs::pending, Runs::check, Opens::decryption, Opens::check,
Plan::encryption, Plan::decryption and ValuePlan::encryption take the
context the call names. The field verbs take a FieldRef (a name still
works).1 parent 76484ef commit faeee56
17 files changed
Lines changed: 3443 additions & 558 deletions
File tree
- packages/stack-encrypt
- fuzz/fuzz_targets
- src
- plan
- tests
- ui
- pass
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
18 | 24 | | |
19 | 25 | | |
20 | 26 | | |
21 | 27 | | |
22 | 28 | | |
23 | | - | |
| 29 | + | |
24 | 30 | | |
25 | 31 | | |
26 | 32 | | |
| |||
58 | 64 | | |
59 | 65 | | |
60 | 66 | | |
| 67 | + | |
61 | 68 | | |
62 | 69 | | |
63 | 70 | | |
| |||
69 | 76 | | |
70 | 77 | | |
71 | 78 | | |
72 | | - | |
| 79 | + | |
| 80 | + | |
73 | 81 | | |
74 | 82 | | |
75 | 83 | | |
76 | 84 | | |
77 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
78 | 89 | | |
79 | 90 | | |
80 | 91 | | |
81 | 92 | | |
82 | 93 | | |
83 | 94 | | |
84 | 95 | | |
| 96 | + | |
85 | 97 | | |
86 | 98 | | |
87 | 99 | | |
88 | 100 | | |
89 | 101 | | |
90 | 102 | | |
91 | 103 | | |
92 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
93 | 111 | | |
94 | | - | |
| 112 | + | |
95 | 113 | | |
96 | 114 | | |
97 | 115 | | |
98 | 116 | | |
99 | 117 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
105 | 131 | | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
110 | 154 | | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | 155 | | |
117 | 156 | | |
118 | 157 | | |
| |||
127 | 166 | | |
128 | 167 | | |
129 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
130 | 175 | | |
131 | 176 | | |
132 | 177 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
222 | | - | |
223 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
224 | 226 | | |
225 | 227 | | |
226 | 228 | | |
| |||
0 commit comments