Skip to content

Commit dd50714

Browse files
committed
feat(stack-encrypt): indexes as types, passthrough and run_decryption
The plan builder is meant to be a thin lowering onto the combinators, and three things it needs were missing. Indexes. Every caller (the derive, dynamic::record) spelled out ciphertext().accepting().zip(equality()).zip(..).map(..) itself, with the nested-pair bookkeeping. Index<S> makes one index a type, implemented only for the plaintexts its scheme is defined over, so a match index on an integer does not compile. Indexes<S> is one index or a tuple of two to four, and deliberately not (), so an indexed field with no index is a compile error rather than a quiet ciphertext-only field. indexed(idx) does the composition once and returns Encrypted<Terms>: the ciphertext and the terms as a tuple, read by destructuring. spec() lowers an index to data (IndexSpec) for the FFI and saved plans, with a match index's options; Indexes::select picks one index for the query side. The bytes are the hand composition's and the derive's, which the tests pin. passthrough(). A plan can carry a field unsealed. The engine had no operation that just returns the source; this is it, moving the value in owned mode and cloning it in borrowed mode, ignoring the context. Its rustdoc says it is not authenticated and what to use instead. run_decryption(). KeysetCipher::run already executes an Encryption held in a variable; this is the Decryption counterpart, on the keyset (which refuses a foreign leaf) and on the client.
1 parent be7359f commit dd50714

12 files changed

Lines changed: 1189 additions & 3 deletions

‎packages/stack-encrypt/src/lib.rs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,8 @@ pub use keyset::KeysetCipher;
292292
pub use stack_kms as kms;
293293
pub use target::{
294294
CallerContext, CipherScope, DecryptField, DecryptFrom, DecryptInto, Decryptable, Decryption,
295-
EncryptFrom, EncryptInto, Encryption, Pending, PendingFuture, Request, Responses,
295+
EncryptFrom, EncryptInto, Encrypted, Encryption, Equality, Index, IndexSpec, Indexes, Match,
296+
Ope, Ore, Pending, PendingFuture, Request, Responses,
296297
};
297298

298299
// Re-export the vitaminc AEAD surface callers need to drive the cipher, so they

0 commit comments

Comments
 (0)