diff --git a/.changeset/eql-v4-date-timestamp-numeric.md b/.changeset/eql-v4-date-timestamp-numeric.md index beec6c476f..e47be979f5 100644 --- a/.changeset/eql-v4-date-timestamp-numeric.md +++ b/.changeset/eql-v4-date-timestamp-numeric.md @@ -2,4 +2,4 @@ '@cipherstash/eql': minor --- -**Stack Encrypt produces the EQL v4 date, timestamp and numeric types `Date`, `DateEq`, `Timestamp`, `TimestampEq`, `Numeric` and `NumericEq`** (`eql-bindings`, `stack-encrypt` feature). Their Rust plaintexts are Stack Encrypt's `stack_encrypt::value::Date`, `Timestamp` and `Decimal`, re-exported as `v4::plaintext::Date`, `Timestamp` and `Decimal`. They hold the integers the engine stores (days since 1970-01-01; Unix seconds and nanoseconds; a mantissa and a scale), are range checked when built and are wiped when dropped. eql-bindings' `chrono` and `rust_decimal` features turn on Stack Encrypt's features of the same names, which convert to and from those crates' types. `=` on `NumericEq` normalises the scale (`1.5 = 1.50`) and on `TimestampEq` compares to the microsecond, truncating (never rounding) the nanoseconds below it; each value decrypts as it was stored. The Go SDK's `encrypt/eql` table marks the six producible, from `encrypt.Date`, `time.Time` and `encrypt.Decimal`. +**Stack Encrypt produces the EQL v4 date, timestamp and numeric types `Date`, `DateEq`, `Timestamp`, `TimestampEq`, `Numeric` and `NumericEq`** (`eql-bindings`, `stack-encrypt` feature). Their Rust plaintexts are Stack Encrypt's `stack_encrypt::value::Date`, `Timestamp` and `Decimal`, re-exported as `v4::plaintext::Date`, `Timestamp` and `Decimal`. They hold the integers the engine stores (days since 1970-01-01; Unix seconds and nanoseconds; a mantissa and a scale), are range checked when built and are wiped when dropped. eql-bindings' `jiff` and `rust_decimal` features turn on Stack Encrypt's features of the same names, which convert to and from those crates' types. Dates are from `-009999-01-01` to `9999-12-31`, and instants from `-009999-01-02T01:59:59Z` to `9999-12-30T22:00:00.999999999Z`. `=` on `NumericEq` normalises the scale (`1.5 = 1.50`) and on `TimestampEq` compares to the microsecond, truncating (never rounding) the nanoseconds below it; each value decrypts as it was stored. The Go SDK's `encrypt/eql` table marks the six producible, from `encrypt.Date`, `time.Time` and `encrypt.Decimal`. diff --git a/Cargo.lock b/Cargo.lock index e98fb9a014..80d4b0fe38 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -556,16 +556,16 @@ dependencies = [ [[package]] name = "clww-ore" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9527fcb65fbebc5a8f8987063c171bb37bb37fb628de1293e07c1b6e0a21a24f" +checksum = "0bf8966d3aa4130c1d5afd09de3be042765061879e8be0d5c156e9078b0148db" dependencies = [ "blake3", "hex", "subtle", "thiserror 1.0.69", "vitaminc-ore", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", "zeroize", ] @@ -1768,6 +1768,39 @@ version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" +[[package]] +name = "jiff" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5d126d72eb017f10b302e73bdeca446bea405ee449af4d9e7866d6b082d83e" +dependencies = [ + "jiff-core", + "jiff-static", + "portable-atomic", + "portable-atomic-util", +] + +[[package]] +name = "jiff-core" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6b46a105a9874634dd96231021526bf24ca04955a5998c59a9c7666e634b7b8" +dependencies = [ + "log", +] + +[[package]] +name = "jiff-static" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0127e9bde3c6130d6169e7d8d68676e4be69c4bf7573c308b6f960a5089c428" +dependencies = [ + "jiff-core", + "proc-macro2", + "quote", + "syn 3.0.9", +] + [[package]] name = "jni" version = "0.21.1" @@ -2299,9 +2332,9 @@ checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" [[package]] name = "ore-rs" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b274b7a0bf081d51815ccc7b20fa3b023e5769e3446fe4de1e8e8044a4413201" +checksum = "eebac11f6f3ceaec9994a27b00666385301e6b650ba8973f852430b9f7bd4ba5" dependencies = [ "aes", "block-modes", @@ -2311,12 +2344,12 @@ dependencies = [ "rand 0.10.1", "subtle-ng", "thiserror 1.0.69", - "vitaminc-context 0.9.0", + "vitaminc-context 0.10.0", "vitaminc-hmac", "vitaminc-ore", "vitaminc-prf", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.0", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", "zeroize", ] @@ -2395,6 +2428,15 @@ version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" +[[package]] +name = "portable-atomic-util" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" +dependencies = [ + "portable-atomic", +] + [[package]] name = "potential_utf" version = "0.1.4" @@ -3361,8 +3403,8 @@ dependencies = [ "tracing-subscriber", "url", "uuid", - "vitaminc 0.9.0", - "vitaminc-protected 0.9.1", + "vitaminc 0.10.0", + "vitaminc-protected 0.10.0", "web-time", "zeroize", "zerokms-protocol", @@ -3384,7 +3426,7 @@ dependencies = [ "tempfile", "tokio", "url", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", "zeroize", ] @@ -3413,9 +3455,9 @@ version = "0.3.0" dependencies = [ "base64ct", "base85-simd", - "chrono", "clww-ore", "futures", + "jiff", "miette", "ore-rs", "proptest", @@ -3434,15 +3476,15 @@ dependencies = [ "tokio", "trybuild", "uuid", - "vitaminc 0.9.0", - "vitaminc-aead 0.9.0", + "vitaminc 0.10.0", + "vitaminc-aead 0.10.0", "vitaminc-aead-frame", - "vitaminc-encrypt 0.9.0", + "vitaminc-encrypt 0.10.0", "vitaminc-hmac", "vitaminc-normalize", "vitaminc-ore", "vitaminc-prf", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", "zeroize", "zerokms-protocol", ] @@ -3469,9 +3511,9 @@ dependencies = [ "proptest", "serde_json", "thiserror 1.0.69", - "vitaminc-aead 0.9.0", + "vitaminc-aead 0.10.0", "vitaminc-aead-frame", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", "zeroize", ] @@ -3504,8 +3546,8 @@ dependencies = [ "tracing", "url", "uuid", - "vitaminc 0.9.0", - "vitaminc-protected 0.9.1", + "vitaminc 0.10.0", + "vitaminc-protected 0.10.0", "zeroize", "zerokms-protocol", ] @@ -4268,16 +4310,16 @@ dependencies = [ [[package]] name = "vitaminc" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7aa53d696a9e1af61b36a60b92cc0dde7421f8f58787333d3c425a176af241c" +checksum = "60ae27c0d0e6980d2f30683384ed591a9dafa943b18faaa6bfb456757b5e10ef" dependencies = [ - "vitaminc-aead 0.9.0", - "vitaminc-context 0.9.0", - "vitaminc-encrypt 0.9.0", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.0", - "vitaminc-traits 0.9.0", + "vitaminc-aead 0.10.0", + "vitaminc-context 0.10.0", + "vitaminc-encrypt 0.10.0", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", + "vitaminc-traits 0.10.0", ] [[package]] @@ -4297,20 +4339,20 @@ dependencies = [ [[package]] name = "vitaminc-aead" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efba1dac1efc04ffc09cba49e343e0fe656c88c32472a4206f2a6df284add33d" +checksum = "6fcccedca9d80812af295cba43dc2ac388f4fbb0415faa3ebec783d072d014d8" dependencies = [ "bytes", - "chrono", "futures-util", + "jiff", "rust_decimal", "serde", "thiserror 2.0.18", - "vitaminc-aead-derive 0.9.0", - "vitaminc-context 0.9.0", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.0", + "vitaminc-aead-derive 0.10.0", + "vitaminc-context 0.10.0", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", "zeroize", ] @@ -4327,9 +4369,9 @@ dependencies = [ [[package]] name = "vitaminc-aead-derive" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3c6575dac7701e578b375d16a0b693294d73847ed275c9b9962cf20c423ea10" +checksum = "3de85a0ff50572db91a5528b72775f63d57a2b24b8263fb8e728baf6a7731502" dependencies = [ "proc-macro2", "quote", @@ -4338,13 +4380,13 @@ dependencies = [ [[package]] name = "vitaminc-aead-frame" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba4a3e8a2057ce32724b0d42f71e87ee348d13c818fc54a16c443b86c4fe8d9a" +checksum = "e858adec6cbbe353227dbff1876a426909a9e304fc996e0f706441dcd7eb9dac" dependencies = [ "serde", - "vitaminc-aead 0.9.0", - "vitaminc-protected 0.9.1", + "vitaminc-aead 0.10.0", + "vitaminc-protected 0.10.0", ] [[package]] @@ -4359,12 +4401,12 @@ dependencies = [ [[package]] name = "vitaminc-context" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b407b3127be198a8da7d4d914c11215e1eae1b467cdf89eca8a7a296055e863" +checksum = "431a7fb023688dba855e52b9c4e44c942418dde8ea08a2b115cf6a7f762fa5b9" dependencies = [ "mutants", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", ] [[package]] @@ -4383,72 +4425,72 @@ dependencies = [ [[package]] name = "vitaminc-encrypt" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fa0a3493624afd1490085448d6d09d22bf061954e9ab0db08837f423db3a58d" +checksum = "e68d89e2587529db55a10fa59cb11be8a7505b4af473c8a0bec238c803190ec5" dependencies = [ "aes-gcm", "aws-lc-rs", - "vitaminc-aead 0.9.0", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.0", + "vitaminc-aead 0.10.0", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", "zeroize", ] [[package]] name = "vitaminc-hmac" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ada61349172294efe0a71bf2af367969b4e196437b46c20c688aaf15f692bc2d" +checksum = "b031c7e62ab28f716df69c5e2137267c93e8d2aa36e4f31a12ac5b193baaa3d1" dependencies = [ "hmac", "sha2 0.11.0", "vitaminc-prf", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", "zeroize", ] [[package]] name = "vitaminc-normalize" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1d354f4ee3764be072eb02f4f8db79ed0ed467a7c6d9f2c6143823867bde347" +checksum = "e333da8bb30eab39cc2c790cb860843229a0a06aefb807f4ce069a92a2e17e8d" dependencies = [ "thiserror 2.0.18", "unicode-general-category", "unicode-normalization", - "vitaminc-aead 0.9.0", - "vitaminc-protected 0.9.1", + "vitaminc-aead 0.10.0", + "vitaminc-protected 0.10.0", ] [[package]] name = "vitaminc-ore" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a812b8e245352094c3c2113312cf86d0804b83f1e315bacd15571cd01703c8b" +checksum = "9a1d92d394e577ee424b4f35479a101896aecbce98f00c37bca5af1aa0d3b2c0" dependencies = [ "thiserror 2.0.18", "unicode-general-category", "unicode-normalization", - "vitaminc-aead 0.9.0", - "vitaminc-context 0.9.0", + "vitaminc-aead 0.10.0", + "vitaminc-context 0.10.0", "vitaminc-normalize", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", "zeroize", ] [[package]] name = "vitaminc-prf" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1703452d837ef964ec1f20cc601265857245d72ac14426276d49c3106dd39b3" +checksum = "078c13f43f5a9fefdd6f4cb337327a432b3b136c168f558fd525d1dd14685541" dependencies = [ "mutants", "thiserror 2.0.18", - "vitaminc-aead 0.9.0", - "vitaminc-context 0.9.0", + "vitaminc-aead 0.10.0", + "vitaminc-context 0.10.0", "vitaminc-normalize", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", ] [[package]] @@ -4470,9 +4512,9 @@ dependencies = [ [[package]] name = "vitaminc-protected" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67a44502e43de42fbd95c12a35efbaea903eedcc7a3922fceacea93054f44485" +checksum = "2153981f290343dffa8f618277c46a13b5a1e8131b4120760e9a1795ae1cb55b" dependencies = [ "bitvec", "digest 0.11.3", @@ -4481,7 +4523,7 @@ dependencies = [ "serde_bytes", "subtle", "thiserror 2.0.18", - "vitaminc-protected-derive 0.9.1", + "vitaminc-protected-derive 0.10.0", "zeroize", ] @@ -4498,9 +4540,9 @@ dependencies = [ [[package]] name = "vitaminc-protected-derive" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4315341c559af17bd773e8b4e32125a2025d7fbe3e31cbae49120ee1dcab02e" +checksum = "32eb239bc9aae16ef0320076934f3f592606960d42d0b5fdadafc0298f635221" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -4525,16 +4567,16 @@ dependencies = [ [[package]] name = "vitaminc-random" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e32850b739b58a7064b50eb3db655de323f57f21c1fe74d5ccd4d308560563" +checksum = "fae7eccb46ddc6f199cf5c934469fd5b199514f42e11579c46882b784ed992c8" dependencies = [ "chacha20", "getrandom 0.4.2", "rand 0.10.1", "thiserror 2.0.18", - "vitaminc-protected 0.9.1", - "vitaminc-random-derives 0.9.0", + "vitaminc-protected 0.10.0", + "vitaminc-random-derives 0.10.0", "zeroize", ] @@ -4551,9 +4593,9 @@ dependencies = [ [[package]] name = "vitaminc-random-derives" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1863fe02de3945047dc9094d3cadbde06becafa49aa95d5e475bf903c8d83981" +checksum = "e48c940c93c9ddb04a66d81ca42ca574826ddbbeece6a7c87c5d1ab31893e692" dependencies = [ "proc-macro2", "quote", @@ -4578,17 +4620,17 @@ dependencies = [ [[package]] name = "vitaminc-traits" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a715ef503b1b41801a6c23e9756ed3d5a1201fa632609bccfa2a7a41ab5386cf" +checksum = "31fba5af175073f24768a8b06dd054ad696c7e6051dda1316c3814043a36d8e0" dependencies = [ "anyhow", "bytes", "rmp-serde", "serde", "thiserror 2.0.18", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.0", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", "zeroize", ] diff --git a/Cargo.toml b/Cargo.toml index 7dec619632..1967aa6173 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -82,15 +82,15 @@ cts-common = { version = "0.43.0", default-features = false } zerokms-protocol = "0.12.31" recipher = "=0.3.1" # The two order-preserving schemes Stack Encrypt's order terms encrypt -# through. Both implement vitaminc-ore's `OrderScheme` against vitaminc 0.9: +# through. Both implement vitaminc-ore's `OrderScheme` against vitaminc 0.10: # `clww-ore` (cllw-ore renamed) for CLWW ORE and OPE, and ore-rs's # `BlockOre` for block ORE, which routes a value to its 6-bit fixed-width # engine (up to ten bytes) or its chained one (wider, or variable length), # the terms EQL v4's `_ord_ore` domains store. # vitaminc is a plain dependency of both from here, not a feature. Both are # pinned exactly: a new release can change every stored order term. -clww-ore = { version = "=0.7.0", default-features = false } -ore-rs = { version = "=0.11.0", default-features = false } +clww-ore = { version = "=0.8.0", default-features = false } +ore-rs = { version = "=0.12.0", default-features = false } # External dependencies, with the suite's feature lists. base64 = "0.22.0" @@ -139,18 +139,18 @@ web-time = "1.1" zeroize = { version = "1.8.1", features = ["derive"] } # This is needed because lock_api 0.4.6 was breaking things and the branch forces the use of 0.4.12 temp-env = { git = "https://github.com/cipherstash/temp-env", branch = "main" } -vitaminc = { version = "0.9.0", features = ["random", "protected", "encrypt"] } -vitaminc-aead = "0.9.0" +vitaminc = { version = "0.10.0", features = ["random", "protected", "encrypt"] } +vitaminc-aead = "0.10.0" # The transport frame and ciphertext codec every language binding carries # across its FFI boundary. Optional in stack-encrypt (the `dynamic` feature). -vitaminc-aead-frame = "0.9.0" -vitaminc-encrypt = "0.9.0" -vitaminc-hmac = "0.9.0" +vitaminc-aead-frame = "0.10.0" +vitaminc-encrypt = "0.10.0" +vitaminc-hmac = "0.10.0" # Normalized equality terms (Unicode 16 NFC text, one integer encoding for # every width), which `vitaminc-prf`'s `normalize` feature derives over. -vitaminc-normalize = "0.9.0" +vitaminc-normalize = "0.10.0" # The text order key: the system ADR-0002's fold, pinned to Unicode 16, # which text ORE and OPE terms are derived over (ADR-0009). -vitaminc-ore = "0.9.0" -vitaminc-prf = { version = "0.9.0", features = ["normalize"] } -vitaminc-protected = "0.9.1" +vitaminc-ore = "0.10.0" +vitaminc-prf = { version = "0.10.0", features = ["normalize"] } +vitaminc-protected = "0.10.0" diff --git a/conformance/stack-encrypt/v1/record-values-v1.cases.json b/conformance/stack-encrypt/v1/record-values-v1.cases.json index a4d5455bb4..4cc29b3ae8 100644 --- a/conformance/stack-encrypt/v1/record-values-v1.cases.json +++ b/conformance/stack-encrypt/v1/record-values-v1.cases.json @@ -508,9 +508,9 @@ "outputs": ["c", "eq", "ope"], "input": { "type": "timestamp", - "text": "9999-12-31T23:59:59.999999999Z" + "text": "9999-12-30T22:00:00.999999999Z" }, - "frame": "137f41f4ff3a000000ffc99a3b" + "frame": "13e0d3f2ff3a000000ffc99a3b" }, { "id": "sealed-bool", diff --git a/docs/adr/0002-one-value-model-three-encodings-and-eql-v4-by-producer.md b/docs/adr/0002-one-value-model-three-encodings-and-eql-v4-by-producer.md index ab2c4fff91..c2308368e3 100644 --- a/docs/adr/0002-one-value-model-three-encodings-and-eql-v4-by-producer.md +++ b/docs/adr/0002-one-value-model-three-encodings-and-eql-v4-by-producer.md @@ -154,7 +154,9 @@ bundle (see Consequences). Chosen. exhaustive. - Every variant exists in every build. `Date`, `Timestamp` and `Decimal` use vitaminc's own representation (the payloads in the table below), with - conversions to and from chrono and rust_decimal behind those features. A + conversions to and from chrono and rust_decimal behind those features. + *Amended 2026-11-19:* vitaminc 0.10 converts dates and timestamps to and + from jiff, behind its `jiff` feature, in place of chrono. A variant that appeared only with a feature would break any exhaustive handling outside `vitaminc-aead-value`, because features unify across a build and a crate can check only its own. @@ -171,8 +173,8 @@ bundle (see Consequences). Chosen. | `0x0C`, `0x0D` | `Int8`, `UInt8` | 1 byte; two's complement for `Int8` | | `0x0E`, `0x0F` | `Int16`, `UInt16` | 2 bytes, little-endian; two's complement for `Int16` | | `0x10`, `0x11` | `Int128`, `UInt128` | 16 bytes, little-endian; two's complement for `Int128` | - | `0x12` | `Date` | `i32`, little-endian: the day number in the proleptic Gregorian calendar with **0001-01-01 as day 1** (chrono's `num_days_from_ce`). 0001-01-01 is `01 00 00 00`, not zero | - | `0x13` | `Timestamp` | `i64` Unix seconds, then `u32` nanoseconds, both little-endian, UTC. Nanoseconds are below 1,000,000,000. *Amended 2026-10-18 (#1144):* vitaminc 0.6 refuses a leap second: nanoseconds of 1,000,000,000 or more (chrono's leap-second representation, which the pre-ADR-0001 `Value` codec accepted when the seconds modulo 60 were 59) are refused, because a leap second has no count in any unit. The instant must also lie within chrono's `NaiveDateTime` range (vitaminc's `MIN_TIMESTAMP_NANOS` to `MAX_TIMESTAMP_NANOS`, years -262143 to 262142). Anything else is refused | + | `0x12` | `Date` | `i32`, little-endian: the day number in the proleptic Gregorian calendar with **0001-01-01 as day 1** (chrono's `num_days_from_ce`). 0001-01-01 is `01 00 00 00`, not zero. *Amended 2026-11-19:* vitaminc 0.10 admits only dates from `-009999-01-01` to `9999-12-31`, jiff's range, in every binding; a stored date outside it no longer reads | + | `0x13` | `Timestamp` | `i64` Unix seconds, then `u32` nanoseconds, both little-endian, UTC. Nanoseconds are below 1,000,000,000. *Amended 2026-10-18 (#1144):* vitaminc 0.6 refuses a leap second: nanoseconds of 1,000,000,000 or more (chrono's leap-second representation, which the pre-ADR-0001 `Value` codec accepted when the seconds modulo 60 were 59) are refused, because a leap second has no count in any unit. The instant must also lie within chrono's `NaiveDateTime` range (vitaminc's `MIN_TIMESTAMP_NANOS` to `MAX_TIMESTAMP_NANOS`, years -262143 to 262142). Anything else is refused. *Amended 2026-11-19:* vitaminc 0.10 narrows the range to jiff's, `-009999-01-02T01:59:59Z` to `9999-12-30T22:00:00.999999999Z`, in every binding; a stored instant outside it no longer reads. The bytes of an instant in range are unchanged | | `0x14` | `Decimal` | 16 bytes: a little-endian `u32` of flags (sign in bit 31, scale in bits 16–23 and at most 28, every other bit zero), then the low, middle and high little-endian `u32` words of the 96-bit mantissa. This is rust_decimal's `serialize()` and keeps the scale. There is no NaN or infinity | - `transport` stays a module of `vitaminc-aead-value`. diff --git a/languages/golang/CHANGELOG.md b/languages/golang/CHANGELOG.md index fd2e48920c..bcfc2716fe 100644 --- a/languages/golang/CHANGELOG.md +++ b/languages/golang/CHANGELOG.md @@ -13,6 +13,35 @@ and `languages/golang/encrypt/encrypttest/vX.Y.Z` on the same commit. ## [Unreleased] +### Breaking + +- **Dates and timestamps must be in years -9999 to 9999.** The range was + years -262143 to 262142. The engine now uses vitaminc 0.10, whose range + is the `jiff` crate's. Every language's binding uses the same range, so + every binding can decrypt a value any binding encrypts. The exact limits: + - an `encrypt.Date` from `-9999-01-01` to `9999-12-31`; + - a `time.Time` from `-009999-01-02T01:59:59Z` to + `9999-12-30T22:00:00.999999999Z`. + + A date or instant outside the range is refused with `ErrEncoding`, + naming the field, when it is encrypted or queried. The stored format is + unchanged: a value in range has the same ciphertext and the same terms as + before. + + A row stored earlier with a date or instant outside the range still + passes authentication, but no longer decrypts. It is reported as + `ErrAuthentication`, the error for a damaged ciphertext, because the + engine reads its value as malformed. cipherstash/vitaminc#630 tracks a + clearer error. PostgreSQL's `date` and `timestamptz` allow years after + 9999. If you might have stored one, check before you upgrade. Decrypt + the column with the release you run now, or check its plaintext source. + +### Changed + +- `vcffi` and `vcvalue` move to vitaminc `f1fc9ae74`, the commit vitaminc + 0.10.0 was released from. The host now checks the same date and + timestamp range as the guests. + ## [0.1.0-rc.6] - 2026-11-18 ### Upgrading from rc.5 diff --git a/languages/golang/auth/guest/Cargo.lock b/languages/golang/auth/guest/Cargo.lock index 89660d0075..808ba7a6d5 100644 --- a/languages/golang/auth/guest/Cargo.lock +++ b/languages/golang/auth/guest/Cargo.lock @@ -1807,8 +1807,8 @@ dependencies = [ "tracing", "url", "uuid", - "vitaminc 0.9.1", - "vitaminc-protected 0.9.1", + "vitaminc 0.10.0", + "vitaminc-protected 0.10.0", "web-time", "zeroize", "zerokms-protocol", @@ -1828,7 +1828,7 @@ dependencies = [ "tempfile", "tokio", "url", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", "zeroize", ] @@ -1839,9 +1839,9 @@ dependencies = [ "miette", "serde_json", "thiserror 1.0.69", - "vitaminc-aead 0.9.1", + "vitaminc-aead 0.10.0", "vitaminc-aead-frame", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", "zeroize", ] @@ -2261,16 +2261,16 @@ dependencies = [ [[package]] name = "vitaminc" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f849264db2d0cc82e8e17e2c4172368d4627d0d383087415a99f9b6299252f11" +checksum = "60ae27c0d0e6980d2f30683384ed591a9dafa943b18faaa6bfb456757b5e10ef" dependencies = [ - "vitaminc-aead 0.9.1", - "vitaminc-context 0.9.1", - "vitaminc-encrypt 0.9.1", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.1", - "vitaminc-traits 0.9.1", + "vitaminc-aead 0.10.0", + "vitaminc-context 0.10.0", + "vitaminc-encrypt 0.10.0", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", + "vitaminc-traits 0.10.0", ] [[package]] @@ -2290,18 +2290,18 @@ dependencies = [ [[package]] name = "vitaminc-aead" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56725963f5e40788904814a648ad32e2a8697c9ff870699eff8d843fd4c0ee31" +checksum = "6fcccedca9d80812af295cba43dc2ac388f4fbb0415faa3ebec783d072d014d8" dependencies = [ "bytes", "futures-util", "serde", "thiserror 2.0.20", - "vitaminc-aead-derive 0.9.1", - "vitaminc-context 0.9.1", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.1", + "vitaminc-aead-derive 0.10.0", + "vitaminc-context 0.10.0", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", "zeroize", ] @@ -2318,9 +2318,9 @@ dependencies = [ [[package]] name = "vitaminc-aead-derive" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "106cba4ea0ea260d150ef3a2905b908cac8e3aebbf484d290371c3bd48cb3943" +checksum = "3de85a0ff50572db91a5528b72775f63d57a2b24b8263fb8e728baf6a7731502" dependencies = [ "proc-macro2", "quote", @@ -2329,11 +2329,11 @@ dependencies = [ [[package]] name = "vitaminc-aead-frame" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0ee8c7746c0fd8a6efad989b0248646d32f9ce8e45c9631f8c56b760983cd8" +checksum = "e858adec6cbbe353227dbff1876a426909a9e304fc996e0f706441dcd7eb9dac" dependencies = [ - "vitaminc-aead 0.9.1", + "vitaminc-aead 0.10.0", ] [[package]] @@ -2348,12 +2348,12 @@ dependencies = [ [[package]] name = "vitaminc-context" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "366b12603130fe196b300d372b49196f1314a5ba94ab67e63fd0130fc319768b" +checksum = "431a7fb023688dba855e52b9c4e44c942418dde8ea08a2b115cf6a7f762fa5b9" dependencies = [ "mutants", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", ] [[package]] @@ -2372,15 +2372,15 @@ dependencies = [ [[package]] name = "vitaminc-encrypt" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a95db3fd733fc76ee11401604d5673782a3d2f5a047b3a3f49d56ca90b027d0e" +checksum = "e68d89e2587529db55a10fa59cb11be8a7505b4af473c8a0bec238c803190ec5" dependencies = [ "aes-gcm", "aws-lc-rs", - "vitaminc-aead 0.9.1", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.1", + "vitaminc-aead 0.10.0", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", "zeroize", ] @@ -2403,9 +2403,9 @@ dependencies = [ [[package]] name = "vitaminc-protected" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67a44502e43de42fbd95c12a35efbaea903eedcc7a3922fceacea93054f44485" +checksum = "2153981f290343dffa8f618277c46a13b5a1e8131b4120760e9a1795ae1cb55b" dependencies = [ "bitvec", "digest 0.11.3", @@ -2414,7 +2414,7 @@ dependencies = [ "serde_bytes", "subtle", "thiserror 2.0.20", - "vitaminc-protected-derive 0.9.1", + "vitaminc-protected-derive 0.10.0", "zeroize", ] @@ -2431,9 +2431,9 @@ dependencies = [ [[package]] name = "vitaminc-protected-derive" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4315341c559af17bd773e8b4e32125a2025d7fbe3e31cbae49120ee1dcab02e" +checksum = "32eb239bc9aae16ef0320076934f3f592606960d42d0b5fdadafc0298f635221" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2458,16 +2458,16 @@ dependencies = [ [[package]] name = "vitaminc-random" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d08020da35051b10daddaa0f85fbb15f084723dfc4abce8c080bda24867a5a0" +checksum = "fae7eccb46ddc6f199cf5c934469fd5b199514f42e11579c46882b784ed992c8" dependencies = [ "chacha20", "getrandom 0.4.3", "rand 0.10.3", "thiserror 2.0.20", - "vitaminc-protected 0.9.1", - "vitaminc-random-derives 0.9.1", + "vitaminc-protected 0.10.0", + "vitaminc-random-derives 0.10.0", "zeroize", ] @@ -2484,9 +2484,9 @@ dependencies = [ [[package]] name = "vitaminc-random-derives" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76e17e2cfead782db61ef778257853c7c5ff27ad1aee5f323b6461d9d166ee82" +checksum = "e48c940c93c9ddb04a66d81ca42ca574826ddbbeece6a7c87c5d1ab31893e692" dependencies = [ "proc-macro2", "quote", @@ -2511,17 +2511,17 @@ dependencies = [ [[package]] name = "vitaminc-traits" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf1a88df9b1a6530127462338ea47a1b65b8879f8ac9123ea5b7aa5ba1c5c9fd" +checksum = "31fba5af175073f24768a8b06dd054ad696c7e6051dda1316c3814043a36d8e0" dependencies = [ "anyhow", "bytes", "rmp-serde", "serde", "thiserror 2.0.20", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.1", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", "zeroize", ] diff --git a/languages/golang/auth/guest/Cargo.toml b/languages/golang/auth/guest/Cargo.toml index 4db8c38554..1f17d7e5b9 100644 --- a/languages/golang/auth/guest/Cargo.toml +++ b/languages/golang/auth/guest/Cargo.toml @@ -50,7 +50,7 @@ tempfile = "3" # Native stack-auth refreshes run in a Tokio task, including with a mock transport. tokio = { version = "1.47.1", default-features = false, features = ["macros", "rt"] } # `Controlled::risky_ref`, to read a codec value back in the tests. -vitaminc-protected = "0.9.1" +vitaminc-protected = "0.10.0" [profile.release] # Smaller .wasm; the guest is IO-bound on the FFI copy and the file reads, diff --git a/languages/golang/encrypt/README.md b/languages/golang/encrypt/README.md index 5ec2c8aa15..d94dac78ac 100644 --- a/languages/golang/encrypt/README.md +++ b/languages/golang/encrypt/README.md @@ -582,7 +582,8 @@ timestamp and numeric types: `NumericEq` normalises the scale, so `1.5` and microsecond are equal; each still opens as it was written, a decimal with its scale and a `time.Time` with its nanoseconds, in UTC. A `time.Time` is sealed as its instant, whatever its location. A zero -`encrypt.Date`, a date or instant outside years -262143 to 262142 and a +`encrypt.Date`, a date outside years -9999 to 9999, an instant outside +`-009999-01-02T01:59:59Z` to `9999-12-30T22:00:00.999999999Z`, and a decimal with more than 28 digits after the point are refused with `ErrEncoding`. Ordered dates compare by day, timestamps by the truncated microsecond, and decimals by value (`1.5` ties `1.50`). diff --git a/languages/golang/encrypt/encrypttest/go.mod b/languages/golang/encrypt/encrypttest/go.mod index 5beffa1469..d9a286f815 100644 --- a/languages/golang/encrypt/encrypttest/go.mod +++ b/languages/golang/encrypt/encrypttest/go.mod @@ -13,8 +13,8 @@ require ( ) require ( - github.com/cipherstash/vitaminc/bindings/go/vcffi v0.0.0-20261026122913-06568ba93bd9 // indirect - github.com/cipherstash/vitaminc/bindings/go/vcvalue v0.0.0-20261026122913-06568ba93bd9 // indirect + github.com/cipherstash/vitaminc/bindings/go/vcffi v0.0.0-20261119095843-f1fc9ae74882 // indirect + github.com/cipherstash/vitaminc/bindings/go/vcvalue v0.0.0-20261119095843-f1fc9ae74882 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect github.com/jackc/puddle/v2 v2.2.3 // indirect diff --git a/languages/golang/encrypt/encrypttest/go.sum b/languages/golang/encrypt/encrypttest/go.sum index 443ac7face..13d0146212 100644 --- a/languages/golang/encrypt/encrypttest/go.sum +++ b/languages/golang/encrypt/encrypttest/go.sum @@ -1,7 +1,7 @@ -github.com/cipherstash/vitaminc/bindings/go/vcffi v0.0.0-20261026122913-06568ba93bd9 h1:ZF7YOnal03J9uj5ggsqF3vUlPgM3affKpz3DHIyO4UE= -github.com/cipherstash/vitaminc/bindings/go/vcffi v0.0.0-20261026122913-06568ba93bd9/go.mod h1:7hPdj2tN3YpcPZYdZ+Fe7+Fsc7dnSyH5bsL9y+LbRuM= -github.com/cipherstash/vitaminc/bindings/go/vcvalue v0.0.0-20261026122913-06568ba93bd9 h1:y1+c1HV4FeZ+EiX9k3imPIzQYYK3QZD7HoZU8YORa6Q= -github.com/cipherstash/vitaminc/bindings/go/vcvalue v0.0.0-20261026122913-06568ba93bd9/go.mod h1:RJODA1DCSm4H+1pbmCzDdT2pAIkxhinwIu6ewjh5sPs= +github.com/cipherstash/vitaminc/bindings/go/vcffi v0.0.0-20261119095843-f1fc9ae74882 h1:T3GexX/bqkB3KS9mbz8TJxEIP/RdUyFgcMH6VQDnRR8= +github.com/cipherstash/vitaminc/bindings/go/vcffi v0.0.0-20261119095843-f1fc9ae74882/go.mod h1:7hPdj2tN3YpcPZYdZ+Fe7+Fsc7dnSyH5bsL9y+LbRuM= +github.com/cipherstash/vitaminc/bindings/go/vcvalue v0.0.0-20261119095843-f1fc9ae74882 h1:5joeyPbldjXj9vRemilG7wYwmICFPZSPBMXiXGsgg7Q= +github.com/cipherstash/vitaminc/bindings/go/vcvalue v0.0.0-20261119095843-f1fc9ae74882/go.mod h1:RJODA1DCSm4H+1pbmCzDdT2pAIkxhinwIu6ewjh5sPs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/languages/golang/encrypt/eql_order_postgres_test.go b/languages/golang/encrypt/eql_order_postgres_test.go index a7f9b302bb..d494992e62 100644 --- a/languages/golang/encrypt/eql_order_postgres_test.go +++ b/languages/golang/encrypt/eql_order_postgres_test.go @@ -532,10 +532,13 @@ func eqlTextOrder() eqlOrderGen[string] { } var ( - eqlDateMin = time.Date(-262143, 1, 1, 0, 0, 0, 0, time.UTC) - eqlDateMax = time.Date(262142, 12, 31, 0, 0, 0, 0, time.UTC) - // The latest instant a timestamp holds: chrono's. - eqlTimestampMax = time.Date(262142, 12, 31, 23, 59, 59, 999_999_999, time.UTC) + eqlDateMin = time.Date(-9999, 1, 1, 0, 0, 0, 0, time.UTC) + eqlDateMax = time.Date(9999, 12, 31, 0, 0, 0, 0, time.UTC) + // The earliest and latest instants a timestamp holds: jiff's. They + // stop short of the dates' ends, so that any of them is a date in + // range at any UTC offset. + eqlTimestampMin = time.Date(-9999, 1, 2, 1, 59, 59, 0, time.UTC) + eqlTimestampMax = time.Date(9999, 12, 30, 22, 0, 0, 999_999_999, time.UTC) ) func eqlDateOf(days int64) encrypt.Date { @@ -588,7 +591,7 @@ func eqlMicros(t time.Time) int64 { // 2100, neighbouring microseconds, and instants less than a microsecond // apart, which tie. func eqlTimestampOrder() eqlOrderGen[time.Time] { - minMicro, maxMicro := eqlMicros(eqlDateMin), eqlMicros(eqlTimestampMax) + minMicro, maxMicro := eqlMicros(eqlTimestampMin), eqlMicros(eqlTimestampMax) at := func(micros, nanos int64) time.Time { return time.UnixMicro(micros).Add(time.Duration(nanos)).UTC() } @@ -613,7 +616,7 @@ func eqlTimestampOrder() eqlOrderGen[time.Time] { } epoch := time.Unix(0, 0).UTC() edges := []time.Time{ - eqlDateMin, eqlTimestampMax, eqlTimestampMax.Add(-999), + eqlTimestampMin, eqlTimestampMax, eqlTimestampMax.Add(-999), epoch.Add(-time.Microsecond), epoch.Add(-1), epoch, epoch.Add(999), epoch.Add(time.Microsecond), time.Date(2000, 2, 29, 23, 59, 59, 999_999_000, time.UTC), } diff --git a/languages/golang/encrypt/eql_v4_ledger_test.go b/languages/golang/encrypt/eql_v4_ledger_test.go index 8e63c31a24..458f14a245 100644 --- a/languages/golang/encrypt/eql_v4_ledger_test.go +++ b/languages/golang/encrypt/eql_v4_ledger_test.go @@ -62,7 +62,7 @@ func TestV4DateTimestampNumericFieldsSealAndOpenBack(t *testing.T) { Total: mustDecimal(t, "-79228162514264337593543950335"), Amount: mustDecimal(t, "1.50"), }, { - ID: 2, Opened: encrypt.Date{Year: -262143, Month: time.January, Day: 1}, Due: encrypt.Date{Year: 262142, Month: time.December, Day: 31}, + ID: 2, Opened: encrypt.Date{Year: -9999, Month: time.January, Day: 1}, Due: encrypt.Date{Year: 9999, Month: time.December, Day: 31}, Created: mustInstant(t, "2024-02-29T12:34:56.123456789Z"), Posted: time.Unix(0, 0), Total: mustDecimal(t, "0.0000000000000000000000000001"), Amount: mustDecimal(t, "-0.00"), }, @@ -138,8 +138,8 @@ func TestV4DateTimestampNumericFieldsSealAndOpenBack(t *testing.T) { refusals := map[string]error{} _, refusals["EncryptLedger zero date"] = testusers.EncryptLedger(ctx, cipher, []testusers.Ledger{{ID: 3, Opened: ledgers[0].Opened, Created: ledgers[0].Created, Posted: ledgers[0].Posted}}) _, refusals["Due.Encrypt zero"] = testusers.LedgerFields.Due.Encrypt(ctx, cipher, encrypt.Date{}) - _, refusals["Due.Eq past the range"] = testusers.LedgerFields.Due.Eq(ctx, cipher, encrypt.Date{Year: 262143, Month: time.January, Day: 1}) - _, refusals["Posted.Eq past the range"] = testusers.LedgerFields.Posted.Eq(ctx, cipher, time.Date(262143, time.January, 1, 0, 0, 0, 0, time.UTC)) + _, refusals["Due.Eq past the range"] = testusers.LedgerFields.Due.Eq(ctx, cipher, encrypt.Date{Year: 10000, Month: time.January, Day: 1}) + _, refusals["Posted.Eq past the range"] = testusers.LedgerFields.Posted.Eq(ctx, cipher, time.Date(9999, time.December, 31, 0, 0, 0, 0, time.UTC)) _, refusals["Amount.Eq scale 29"] = testusers.LedgerFields.Amount.Eq(ctx, cipher, encrypt.Decimal{Scale: 29}) for path, err := range refusals { if !errors.Is(err, encrypt.ErrEncoding) { @@ -198,12 +198,12 @@ func TestV4DateTimestampNumericFieldsSealAndOpenBack(t *testing.T) { func ledgerRows(t *testing.T) []testusers.Ledger { return []testusers.Ledger{ { - ID: 1, Opened: encrypt.Date{Year: -262143, Month: time.January, Day: 1}, Due: encrypt.Date{Year: 2024, Month: time.February, Day: 29}, + ID: 1, Opened: encrypt.Date{Year: -9999, Month: time.January, Day: 1}, Due: encrypt.Date{Year: 2024, Month: time.February, Day: 29}, Created: mustInstant(t, "1969-12-31T23:59:59.999999999Z"), Posted: mustInstant(t, "2024-02-29T12:34:56.123456Z"), Total: mustDecimal(t, "-79228162514264337593543950335"), Amount: mustDecimal(t, "1.50"), }, { - ID: 2, Opened: encrypt.Date{Year: 262142, Month: time.December, Day: 31}, Due: encrypt.Date{Year: 2024, Month: time.March, Day: 1}, + ID: 2, Opened: encrypt.Date{Year: 9999, Month: time.December, Day: 31}, Due: encrypt.Date{Year: 2024, Month: time.March, Day: 1}, Created: mustInstant(t, "2024-02-29T12:34:56.123456789Z"), Posted: mustInstant(t, "2024-02-29T12:34:56.123456999Z"), Total: mustDecimal(t, "0.0000000000000000000000000001"), Amount: mustDecimal(t, "1.5"), }, @@ -239,14 +239,12 @@ type ledgerPlain struct { Amount string `json:"amount"` } -// isoDate is a Date as ISO 8601, with the signed year chrono reads for -// years outside 0000 to 9999. +// isoDate is a Date as ISO 8601. A year before 0000 has the signed +// six-digit form jiff reads. Every date the engine admits has a year from +// -9999 to 9999, so no other year needs a sign. func isoDate(d encrypt.Date) string { - switch { - case d.Year < 0: - return fmt.Sprintf("-%04d-%02d-%02d", -d.Year, d.Month, d.Day) - case d.Year > 9999: - return fmt.Sprintf("+%04d-%02d-%02d", d.Year, d.Month, d.Day) + if d.Year < 0 { + return fmt.Sprintf("-%06d-%02d-%02d", -d.Year, d.Month, d.Day) } return fmt.Sprintf("%04d-%02d-%02d", d.Year, d.Month, d.Day) } diff --git a/languages/golang/encrypt/example/go.mod b/languages/golang/encrypt/example/go.mod index 0c3d5da1c4..2c8e56347b 100644 --- a/languages/golang/encrypt/example/go.mod +++ b/languages/golang/encrypt/example/go.mod @@ -12,8 +12,8 @@ require ( ) require ( - github.com/cipherstash/vitaminc/bindings/go/vcffi v0.0.0-20261026122913-06568ba93bd9 // indirect - github.com/cipherstash/vitaminc/bindings/go/vcvalue v0.0.0-20261026122913-06568ba93bd9 // indirect + github.com/cipherstash/vitaminc/bindings/go/vcffi v0.0.0-20261119095843-f1fc9ae74882 // indirect + github.com/cipherstash/vitaminc/bindings/go/vcvalue v0.0.0-20261119095843-f1fc9ae74882 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect github.com/jackc/puddle/v2 v2.2.3 // indirect diff --git a/languages/golang/encrypt/example/go.sum b/languages/golang/encrypt/example/go.sum index 443ac7face..13d0146212 100644 --- a/languages/golang/encrypt/example/go.sum +++ b/languages/golang/encrypt/example/go.sum @@ -1,7 +1,7 @@ -github.com/cipherstash/vitaminc/bindings/go/vcffi v0.0.0-20261026122913-06568ba93bd9 h1:ZF7YOnal03J9uj5ggsqF3vUlPgM3affKpz3DHIyO4UE= -github.com/cipherstash/vitaminc/bindings/go/vcffi v0.0.0-20261026122913-06568ba93bd9/go.mod h1:7hPdj2tN3YpcPZYdZ+Fe7+Fsc7dnSyH5bsL9y+LbRuM= -github.com/cipherstash/vitaminc/bindings/go/vcvalue v0.0.0-20261026122913-06568ba93bd9 h1:y1+c1HV4FeZ+EiX9k3imPIzQYYK3QZD7HoZU8YORa6Q= -github.com/cipherstash/vitaminc/bindings/go/vcvalue v0.0.0-20261026122913-06568ba93bd9/go.mod h1:RJODA1DCSm4H+1pbmCzDdT2pAIkxhinwIu6ewjh5sPs= +github.com/cipherstash/vitaminc/bindings/go/vcffi v0.0.0-20261119095843-f1fc9ae74882 h1:T3GexX/bqkB3KS9mbz8TJxEIP/RdUyFgcMH6VQDnRR8= +github.com/cipherstash/vitaminc/bindings/go/vcffi v0.0.0-20261119095843-f1fc9ae74882/go.mod h1:7hPdj2tN3YpcPZYdZ+Fe7+Fsc7dnSyH5bsL9y+LbRuM= +github.com/cipherstash/vitaminc/bindings/go/vcvalue v0.0.0-20261119095843-f1fc9ae74882 h1:5joeyPbldjXj9vRemilG7wYwmICFPZSPBMXiXGsgg7Q= +github.com/cipherstash/vitaminc/bindings/go/vcvalue v0.0.0-20261119095843-f1fc9ae74882/go.mod h1:RJODA1DCSm4H+1pbmCzDdT2pAIkxhinwIu6ewjh5sPs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/languages/golang/encrypt/guest/Cargo.lock b/languages/golang/encrypt/guest/Cargo.lock index 5883bd4c34..5194555cd7 100644 --- a/languages/golang/encrypt/guest/Cargo.lock +++ b/languages/golang/encrypt/guest/Cargo.lock @@ -357,16 +357,16 @@ dependencies = [ [[package]] name = "clww-ore" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9527fcb65fbebc5a8f8987063c171bb37bb37fb628de1293e07c1b6e0a21a24f" +checksum = "0bf8966d3aa4130c1d5afd09de3be042765061879e8be0d5c156e9078b0148db" dependencies = [ "blake3", "hex", "subtle", "thiserror 1.0.69", "vitaminc-ore", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", "zeroize", ] @@ -1458,9 +1458,9 @@ dependencies = [ [[package]] name = "ore-rs" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b274b7a0bf081d51815ccc7b20fa3b023e5769e3446fe4de1e8e8044a4413201" +checksum = "eebac11f6f3ceaec9994a27b00666385301e6b650ba8973f852430b9f7bd4ba5" dependencies = [ "aes", "block-modes", @@ -1470,12 +1470,12 @@ dependencies = [ "rand 0.10.2", "subtle-ng", "thiserror 1.0.69", - "vitaminc-context 0.9.0", + "vitaminc-context 0.10.0", "vitaminc-hmac", "vitaminc-ore", "vitaminc-prf", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.0", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", "zeroize", ] @@ -2110,8 +2110,8 @@ dependencies = [ "tracing", "url", "uuid", - "vitaminc 0.9.0", - "vitaminc-protected 0.9.1", + "vitaminc 0.10.0", + "vitaminc-protected 0.10.0", "web-time", "zeroize", "zerokms-protocol", @@ -2136,15 +2136,15 @@ dependencies = [ "stack-kms", "thiserror 1.0.69", "uuid", - "vitaminc 0.9.0", - "vitaminc-aead 0.9.0", + "vitaminc 0.10.0", + "vitaminc-aead 0.10.0", "vitaminc-aead-frame", - "vitaminc-encrypt 0.9.0", + "vitaminc-encrypt 0.10.0", "vitaminc-hmac", "vitaminc-normalize", "vitaminc-ore", "vitaminc-prf", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", "zeroize", ] @@ -2184,9 +2184,9 @@ dependencies = [ "miette", "serde_json", "thiserror 1.0.69", - "vitaminc-aead 0.9.0", + "vitaminc-aead 0.10.0", "vitaminc-aead-frame", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", "zeroize", ] @@ -2212,8 +2212,8 @@ dependencies = [ "tracing", "url", "uuid", - "vitaminc 0.9.0", - "vitaminc-protected 0.9.1", + "vitaminc 0.10.0", + "vitaminc-protected 0.10.0", "zeroize", "zerokms-protocol", ] @@ -2689,16 +2689,16 @@ dependencies = [ [[package]] name = "vitaminc" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7aa53d696a9e1af61b36a60b92cc0dde7421f8f58787333d3c425a176af241c" +checksum = "60ae27c0d0e6980d2f30683384ed591a9dafa943b18faaa6bfb456757b5e10ef" dependencies = [ - "vitaminc-aead 0.9.0", - "vitaminc-context 0.9.0", - "vitaminc-encrypt 0.9.0", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.0", - "vitaminc-traits 0.9.0", + "vitaminc-aead 0.10.0", + "vitaminc-context 0.10.0", + "vitaminc-encrypt 0.10.0", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", + "vitaminc-traits 0.10.0", ] [[package]] @@ -2718,18 +2718,18 @@ dependencies = [ [[package]] name = "vitaminc-aead" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efba1dac1efc04ffc09cba49e343e0fe656c88c32472a4206f2a6df284add33d" +checksum = "6fcccedca9d80812af295cba43dc2ac388f4fbb0415faa3ebec783d072d014d8" dependencies = [ "bytes", "futures-util", "serde", "thiserror 2.0.20", - "vitaminc-aead-derive 0.9.0", - "vitaminc-context 0.9.0", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.0", + "vitaminc-aead-derive 0.10.0", + "vitaminc-context 0.10.0", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", "zeroize", ] @@ -2746,9 +2746,9 @@ dependencies = [ [[package]] name = "vitaminc-aead-derive" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3c6575dac7701e578b375d16a0b693294d73847ed275c9b9962cf20c423ea10" +checksum = "3de85a0ff50572db91a5528b72775f63d57a2b24b8263fb8e728baf6a7731502" dependencies = [ "proc-macro2", "quote", @@ -2757,13 +2757,13 @@ dependencies = [ [[package]] name = "vitaminc-aead-frame" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba4a3e8a2057ce32724b0d42f71e87ee348d13c818fc54a16c443b86c4fe8d9a" +checksum = "e858adec6cbbe353227dbff1876a426909a9e304fc996e0f706441dcd7eb9dac" dependencies = [ "serde", - "vitaminc-aead 0.9.0", - "vitaminc-protected 0.9.1", + "vitaminc-aead 0.10.0", + "vitaminc-protected 0.10.0", ] [[package]] @@ -2778,12 +2778,12 @@ dependencies = [ [[package]] name = "vitaminc-context" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b407b3127be198a8da7d4d914c11215e1eae1b467cdf89eca8a7a296055e863" +checksum = "431a7fb023688dba855e52b9c4e44c942418dde8ea08a2b115cf6a7f762fa5b9" dependencies = [ "mutants", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", ] [[package]] @@ -2802,72 +2802,72 @@ dependencies = [ [[package]] name = "vitaminc-encrypt" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fa0a3493624afd1490085448d6d09d22bf061954e9ab0db08837f423db3a58d" +checksum = "e68d89e2587529db55a10fa59cb11be8a7505b4af473c8a0bec238c803190ec5" dependencies = [ "aes-gcm", "aws-lc-rs", - "vitaminc-aead 0.9.0", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.0", + "vitaminc-aead 0.10.0", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", "zeroize", ] [[package]] name = "vitaminc-hmac" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ada61349172294efe0a71bf2af367969b4e196437b46c20c688aaf15f692bc2d" +checksum = "b031c7e62ab28f716df69c5e2137267c93e8d2aa36e4f31a12ac5b193baaa3d1" dependencies = [ "hmac", "sha2 0.11.0", "vitaminc-prf", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", "zeroize", ] [[package]] name = "vitaminc-normalize" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1d354f4ee3764be072eb02f4f8db79ed0ed467a7c6d9f2c6143823867bde347" +checksum = "e333da8bb30eab39cc2c790cb860843229a0a06aefb807f4ce069a92a2e17e8d" dependencies = [ "thiserror 2.0.20", "unicode-general-category", "unicode-normalization", - "vitaminc-aead 0.9.0", - "vitaminc-protected 0.9.1", + "vitaminc-aead 0.10.0", + "vitaminc-protected 0.10.0", ] [[package]] name = "vitaminc-ore" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a812b8e245352094c3c2113312cf86d0804b83f1e315bacd15571cd01703c8b" +checksum = "9a1d92d394e577ee424b4f35479a101896aecbce98f00c37bca5af1aa0d3b2c0" dependencies = [ "thiserror 2.0.20", "unicode-general-category", "unicode-normalization", - "vitaminc-aead 0.9.0", - "vitaminc-context 0.9.0", + "vitaminc-aead 0.10.0", + "vitaminc-context 0.10.0", "vitaminc-normalize", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", "zeroize", ] [[package]] name = "vitaminc-prf" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1703452d837ef964ec1f20cc601265857245d72ac14426276d49c3106dd39b3" +checksum = "078c13f43f5a9fefdd6f4cb337327a432b3b136c168f558fd525d1dd14685541" dependencies = [ "mutants", "thiserror 2.0.20", - "vitaminc-aead 0.9.0", - "vitaminc-context 0.9.0", + "vitaminc-aead 0.10.0", + "vitaminc-context 0.10.0", "vitaminc-normalize", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", ] [[package]] @@ -2889,9 +2889,9 @@ dependencies = [ [[package]] name = "vitaminc-protected" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67a44502e43de42fbd95c12a35efbaea903eedcc7a3922fceacea93054f44485" +checksum = "2153981f290343dffa8f618277c46a13b5a1e8131b4120760e9a1795ae1cb55b" dependencies = [ "bitvec", "digest 0.11.3", @@ -2900,7 +2900,7 @@ dependencies = [ "serde_bytes", "subtle", "thiserror 2.0.20", - "vitaminc-protected-derive 0.9.1", + "vitaminc-protected-derive 0.10.0", "zeroize", ] @@ -2917,9 +2917,9 @@ dependencies = [ [[package]] name = "vitaminc-protected-derive" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4315341c559af17bd773e8b4e32125a2025d7fbe3e31cbae49120ee1dcab02e" +checksum = "32eb239bc9aae16ef0320076934f3f592606960d42d0b5fdadafc0298f635221" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2944,16 +2944,16 @@ dependencies = [ [[package]] name = "vitaminc-random" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e32850b739b58a7064b50eb3db655de323f57f21c1fe74d5ccd4d308560563" +checksum = "fae7eccb46ddc6f199cf5c934469fd5b199514f42e11579c46882b784ed992c8" dependencies = [ "chacha20", "getrandom 0.4.3", "rand 0.10.2", "thiserror 2.0.20", - "vitaminc-protected 0.9.1", - "vitaminc-random-derives 0.9.0", + "vitaminc-protected 0.10.0", + "vitaminc-random-derives 0.10.0", "zeroize", ] @@ -2970,9 +2970,9 @@ dependencies = [ [[package]] name = "vitaminc-random-derives" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1863fe02de3945047dc9094d3cadbde06becafa49aa95d5e475bf903c8d83981" +checksum = "e48c940c93c9ddb04a66d81ca42ca574826ddbbeece6a7c87c5d1ab31893e692" dependencies = [ "proc-macro2", "quote", @@ -2997,17 +2997,17 @@ dependencies = [ [[package]] name = "vitaminc-traits" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a715ef503b1b41801a6c23e9756ed3d5a1201fa632609bccfa2a7a41ab5386cf" +checksum = "31fba5af175073f24768a8b06dd054ad696c7e6051dda1316c3814043a36d8e0" dependencies = [ "anyhow", "bytes", "rmp-serde", "serde", "thiserror 2.0.20", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.0", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", "zeroize", ] diff --git a/languages/golang/encrypt/guest/tests/support/mod.rs b/languages/golang/encrypt/guest/tests/support/mod.rs index c1240de09f..68d4b22ba5 100644 --- a/languages/golang/encrypt/guest/tests/support/mod.rs +++ b/languages/golang/encrypt/guest/tests/support/mod.rs @@ -12,8 +12,8 @@ use stack_encrypt::dynamic::frame::{to_frame, Frame}; use stack_encrypt::dynamic::frame::{FrameError, FrameWriteError}; use stack_encrypt::dynamic::plaintext::{ - visit_map, visit_seq, Error as _, FixedType, Float, Int, Logical, MapSink, Physical, SeqSink, - Sink, SourceError, + visit_map, visit_seq, EncryptRef, Error as _, FixedType, Float, Int, Logical, MapSink, + Physical, SeqSink, Sink, SourceError, }; use stack_encrypt::Controlled; use stack_encrypt::{DecodeError, Decrypt, Encrypt}; @@ -297,8 +297,8 @@ impl Sink for TreeSink { }) } - fn passthrough(self, value: P) -> Result { - let inner = value.visit(TreeSink(Root))?; + fn passthrough(self, value: &P) -> Result { + let inner = value.visit_ref(TreeSink(Root))?; Ok(self.0.put(Tree::Passthrough(Box::new(inner)))) } } diff --git a/languages/golang/encrypt/values.go b/languages/golang/encrypt/values.go index caf4a854af..93b2fd5a52 100644 --- a/languages/golang/encrypt/values.go +++ b/languages/golang/encrypt/values.go @@ -18,7 +18,7 @@ import ( // so two instants in the same microsecond match each other. // Date is a calendar date, with no time of day and no time zone: Year, Month -// and Day, in the proleptic Gregorian calendar, years -262143 to 262142. +// and Day, in the proleptic Gregorian calendar, years -9999 to 9999. // Validate reports a date that does not exist (February 30). // // The zero Date (year 0, month 0, day 0) is not a date: a Date field must be diff --git a/languages/golang/go.mod b/languages/golang/go.mod index 38bf2f40fd..a8252af971 100644 --- a/languages/golang/go.mod +++ b/languages/golang/go.mod @@ -2,17 +2,16 @@ module github.com/cipherstash/stack/languages/golang go 1.26.10 -// TEMPORARY: vcffi and vcvalue at vitaminc 06568ba93, the commit on vitaminc -// main that carries the storage profile (vcffi.MarshalStorage, from -// cipherstash/vitaminc#526 by way of cipherstash/vitaminc#544). vitaminc's Go -// bindings have no tags, so the commit is the pin. Only Go writes and reads -// that profile; the guests stay on vitaminc 0.8.0 from crates.io, whose -// transport is the one this commit writes. The pin moves to a tag when -// vitaminc provides one; until then scripts/go-release-version.mjs refuses a -// final version of this module. +// TEMPORARY: vcffi and vcvalue at vitaminc f1fc9ae74, the commit vitaminc +// 0.10.0 was released from, so the host checks dates and timestamps against +// the range the guests' vitaminc 0.10.0 does (years -9999 to 9999), and +// writes the storage profile (vcffi.MarshalStorage) and the transport the +// guests read. vitaminc's Go bindings have no tags, so the commit is the pin. +// The pin moves to a tag when vitaminc provides one; until then +// scripts/go-release-version.mjs refuses a final version of this module. require ( - github.com/cipherstash/vitaminc/bindings/go/vcffi v0.0.0-20261026122913-06568ba93bd9 - github.com/cipherstash/vitaminc/bindings/go/vcvalue v0.0.0-20261026122913-06568ba93bd9 + github.com/cipherstash/vitaminc/bindings/go/vcffi v0.0.0-20261119095843-f1fc9ae74882 + github.com/cipherstash/vitaminc/bindings/go/vcvalue v0.0.0-20261119095843-f1fc9ae74882 github.com/tetratelabs/wazero v1.12.0 golang.org/x/oauth2 v0.37.0 ) diff --git a/languages/golang/go.sum b/languages/golang/go.sum index 68f3eb17ff..b1d677278f 100644 --- a/languages/golang/go.sum +++ b/languages/golang/go.sum @@ -1,7 +1,7 @@ -github.com/cipherstash/vitaminc/bindings/go/vcffi v0.0.0-20261026122913-06568ba93bd9 h1:ZF7YOnal03J9uj5ggsqF3vUlPgM3affKpz3DHIyO4UE= -github.com/cipherstash/vitaminc/bindings/go/vcffi v0.0.0-20261026122913-06568ba93bd9/go.mod h1:7hPdj2tN3YpcPZYdZ+Fe7+Fsc7dnSyH5bsL9y+LbRuM= -github.com/cipherstash/vitaminc/bindings/go/vcvalue v0.0.0-20261026122913-06568ba93bd9 h1:y1+c1HV4FeZ+EiX9k3imPIzQYYK3QZD7HoZU8YORa6Q= -github.com/cipherstash/vitaminc/bindings/go/vcvalue v0.0.0-20261026122913-06568ba93bd9/go.mod h1:RJODA1DCSm4H+1pbmCzDdT2pAIkxhinwIu6ewjh5sPs= +github.com/cipherstash/vitaminc/bindings/go/vcffi v0.0.0-20261119095843-f1fc9ae74882 h1:T3GexX/bqkB3KS9mbz8TJxEIP/RdUyFgcMH6VQDnRR8= +github.com/cipherstash/vitaminc/bindings/go/vcffi v0.0.0-20261119095843-f1fc9ae74882/go.mod h1:7hPdj2tN3YpcPZYdZ+Fe7+Fsc7dnSyH5bsL9y+LbRuM= +github.com/cipherstash/vitaminc/bindings/go/vcvalue v0.0.0-20261119095843-f1fc9ae74882 h1:5joeyPbldjXj9vRemilG7wYwmICFPZSPBMXiXGsgg7Q= +github.com/cipherstash/vitaminc/bindings/go/vcvalue v0.0.0-20261119095843-f1fc9ae74882/go.mod h1:RJODA1DCSm4H+1pbmCzDdT2pAIkxhinwIu6ewjh5sPs= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/packages/eql/Cargo.lock b/packages/eql/Cargo.lock index 5a7d968f35..55ddde4b0e 100644 --- a/packages/eql/Cargo.lock +++ b/packages/eql/Cargo.lock @@ -631,16 +631,16 @@ dependencies = [ [[package]] name = "clww-ore" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9527fcb65fbebc5a8f8987063c171bb37bb37fb628de1293e07c1b6e0a21a24f" +checksum = "0bf8966d3aa4130c1d5afd09de3be042765061879e8be0d5c156e9078b0148db" dependencies = [ "blake3", "hex", "subtle", "thiserror 1.0.69", "vitaminc-ore", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", "zeroize", ] @@ -1210,10 +1210,10 @@ name = "eql-encryption-tests" version = "0.1.0" dependencies = [ "base64 0.22.1", - "chrono", "cipherstash-client", "eql-bindings", "eql-domains", + "jiff", "postgres", "proptest", "rust_decimal", @@ -1223,7 +1223,7 @@ dependencies = [ "stack-kms", "tokio", "uuid", - "vitaminc-aead 0.9.0", + "vitaminc-aead 0.10.0", ] [[package]] @@ -2126,6 +2126,58 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +[[package]] +name = "jiff" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5d126d72eb017f10b302e73bdeca446bea405ee449af4d9e7866d6b082d83e" +dependencies = [ + "jiff-core", + "jiff-static", + "jiff-tzdb-platform", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", + "windows-link", +] + +[[package]] +name = "jiff-core" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6b46a105a9874634dd96231021526bf24ca04955a5998c59a9c7666e634b7b8" +dependencies = [ + "log", +] + +[[package]] +name = "jiff-static" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0127e9bde3c6130d6169e7d8d68676e4be69c4bf7573c308b6f960a5089c428" +dependencies = [ + "jiff-core", + "proc-macro2", + "quote", + "syn 3.0.3", +] + +[[package]] +name = "jiff-tzdb" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12e71a1b68a875a44a33bb7a1dd84392cb77145a3367a552a3cfe6a4f5cf3afc" + +[[package]] +name = "jiff-tzdb-platform" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc65b284afcfa8f6cf189c7274c805505314a7ab975c60e1f548bff56525420e" +dependencies = [ + "jiff-tzdb", +] + [[package]] name = "jni" version = "0.22.4" @@ -2655,9 +2707,9 @@ dependencies = [ [[package]] name = "ore-rs" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b274b7a0bf081d51815ccc7b20fa3b023e5769e3446fe4de1e8e8044a4413201" +checksum = "eebac11f6f3ceaec9994a27b00666385301e6b650ba8973f852430b9f7bd4ba5" dependencies = [ "aes", "block-modes", @@ -2667,12 +2719,12 @@ dependencies = [ "rand 0.10.1", "subtle-ng", "thiserror 1.0.69", - "vitaminc-context 0.9.0", + "vitaminc-context 0.10.0", "vitaminc-hmac", "vitaminc-ore", "vitaminc-prf", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.0", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", "zeroize", ] @@ -2830,6 +2882,15 @@ version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49" +[[package]] +name = "portable-atomic-util" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" +dependencies = [ + "portable-atomic", +] + [[package]] name = "postgres" version = "0.19.14" @@ -4148,8 +4209,8 @@ dependencies = [ "tracing", "url", "uuid", - "vitaminc 0.9.0", - "vitaminc-protected 0.9.1", + "vitaminc 0.10.0", + "vitaminc-protected 0.10.0", "web-time", "zeroize", "zerokms-protocol", @@ -4161,11 +4222,11 @@ version = "0.3.0" dependencies = [ "base64ct", "base85-simd", - "chrono", "clww-ore", "futures", + "jiff", "miette", - "ore-rs 0.11.0", + "ore-rs 0.12.0", "rand 0.10.1", "rust_decimal", "serde", @@ -4176,15 +4237,15 @@ dependencies = [ "stack-kms", "thiserror 1.0.69", "uuid", - "vitaminc 0.9.0", - "vitaminc-aead 0.9.0", + "vitaminc 0.10.0", + "vitaminc-aead 0.10.0", "vitaminc-aead-frame", - "vitaminc-encrypt 0.9.0", + "vitaminc-encrypt 0.10.0", "vitaminc-hmac", "vitaminc-normalize", "vitaminc-ore", "vitaminc-prf", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", "zeroize", ] @@ -4219,8 +4280,8 @@ dependencies = [ "tracing", "url", "uuid", - "vitaminc 0.9.0", - "vitaminc-protected 0.9.1", + "vitaminc 0.10.0", + "vitaminc-protected 0.10.0", "zeroize", "zerokms-protocol", ] @@ -4976,16 +5037,16 @@ dependencies = [ [[package]] name = "vitaminc" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7aa53d696a9e1af61b36a60b92cc0dde7421f8f58787333d3c425a176af241c" +checksum = "60ae27c0d0e6980d2f30683384ed591a9dafa943b18faaa6bfb456757b5e10ef" dependencies = [ - "vitaminc-aead 0.9.0", - "vitaminc-context 0.9.0", - "vitaminc-encrypt 0.9.0", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.0", - "vitaminc-traits 0.9.0", + "vitaminc-aead 0.10.0", + "vitaminc-context 0.10.0", + "vitaminc-encrypt 0.10.0", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", + "vitaminc-traits 0.10.0", ] [[package]] @@ -5018,20 +5079,20 @@ dependencies = [ [[package]] name = "vitaminc-aead" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efba1dac1efc04ffc09cba49e343e0fe656c88c32472a4206f2a6df284add33d" +checksum = "6fcccedca9d80812af295cba43dc2ac388f4fbb0415faa3ebec783d072d014d8" dependencies = [ "bytes", - "chrono", "futures-util", + "jiff", "rust_decimal", "serde", "thiserror 2.0.20", - "vitaminc-aead-derive 0.9.0", - "vitaminc-context 0.9.0", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.0", + "vitaminc-aead-derive 0.10.0", + "vitaminc-context 0.10.0", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", "zeroize", ] @@ -5048,9 +5109,9 @@ dependencies = [ [[package]] name = "vitaminc-aead-derive" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3c6575dac7701e578b375d16a0b693294d73847ed275c9b9962cf20c423ea10" +checksum = "3de85a0ff50572db91a5528b72775f63d57a2b24b8263fb8e728baf6a7731502" dependencies = [ "proc-macro2", "quote", @@ -5059,13 +5120,13 @@ dependencies = [ [[package]] name = "vitaminc-aead-frame" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba4a3e8a2057ce32724b0d42f71e87ee348d13c818fc54a16c443b86c4fe8d9a" +checksum = "e858adec6cbbe353227dbff1876a426909a9e304fc996e0f706441dcd7eb9dac" dependencies = [ "serde", - "vitaminc-aead 0.9.0", - "vitaminc-protected 0.9.1", + "vitaminc-aead 0.10.0", + "vitaminc-protected 0.10.0", ] [[package]] @@ -5080,12 +5141,12 @@ dependencies = [ [[package]] name = "vitaminc-context" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b407b3127be198a8da7d4d914c11215e1eae1b467cdf89eca8a7a296055e863" +checksum = "431a7fb023688dba855e52b9c4e44c942418dde8ea08a2b115cf6a7f762fa5b9" dependencies = [ "mutants", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", ] [[package]] @@ -5118,72 +5179,72 @@ dependencies = [ [[package]] name = "vitaminc-encrypt" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fa0a3493624afd1490085448d6d09d22bf061954e9ab0db08837f423db3a58d" +checksum = "e68d89e2587529db55a10fa59cb11be8a7505b4af473c8a0bec238c803190ec5" dependencies = [ "aes-gcm", "aws-lc-rs", - "vitaminc-aead 0.9.0", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.0", + "vitaminc-aead 0.10.0", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", "zeroize", ] [[package]] name = "vitaminc-hmac" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ada61349172294efe0a71bf2af367969b4e196437b46c20c688aaf15f692bc2d" +checksum = "b031c7e62ab28f716df69c5e2137267c93e8d2aa36e4f31a12ac5b193baaa3d1" dependencies = [ "hmac 0.13.0", "sha2 0.11.0", "vitaminc-prf", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", "zeroize", ] [[package]] name = "vitaminc-normalize" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1d354f4ee3764be072eb02f4f8db79ed0ed467a7c6d9f2c6143823867bde347" +checksum = "e333da8bb30eab39cc2c790cb860843229a0a06aefb807f4ce069a92a2e17e8d" dependencies = [ "thiserror 2.0.20", "unicode-general-category", "unicode-normalization", - "vitaminc-aead 0.9.0", - "vitaminc-protected 0.9.1", + "vitaminc-aead 0.10.0", + "vitaminc-protected 0.10.0", ] [[package]] name = "vitaminc-ore" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a812b8e245352094c3c2113312cf86d0804b83f1e315bacd15571cd01703c8b" +checksum = "9a1d92d394e577ee424b4f35479a101896aecbce98f00c37bca5af1aa0d3b2c0" dependencies = [ "thiserror 2.0.20", "unicode-general-category", "unicode-normalization", - "vitaminc-aead 0.9.0", - "vitaminc-context 0.9.0", + "vitaminc-aead 0.10.0", + "vitaminc-context 0.10.0", "vitaminc-normalize", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", "zeroize", ] [[package]] name = "vitaminc-prf" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1703452d837ef964ec1f20cc601265857245d72ac14426276d49c3106dd39b3" +checksum = "078c13f43f5a9fefdd6f4cb337327a432b3b136c168f558fd525d1dd14685541" dependencies = [ "mutants", "thiserror 2.0.20", - "vitaminc-aead 0.9.0", - "vitaminc-context 0.9.0", + "vitaminc-aead 0.10.0", + "vitaminc-context 0.10.0", "vitaminc-normalize", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", ] [[package]] @@ -5220,9 +5281,9 @@ dependencies = [ [[package]] name = "vitaminc-protected" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67a44502e43de42fbd95c12a35efbaea903eedcc7a3922fceacea93054f44485" +checksum = "2153981f290343dffa8f618277c46a13b5a1e8131b4120760e9a1795ae1cb55b" dependencies = [ "bitvec", "digest 0.11.3", @@ -5231,7 +5292,7 @@ dependencies = [ "serde_bytes", "subtle", "thiserror 2.0.20", - "vitaminc-protected-derive 0.9.1", + "vitaminc-protected-derive 0.10.0", "zeroize", ] @@ -5259,9 +5320,9 @@ dependencies = [ [[package]] name = "vitaminc-protected-derive" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4315341c559af17bd773e8b4e32125a2025d7fbe3e31cbae49120ee1dcab02e" +checksum = "32eb239bc9aae16ef0320076934f3f592606960d42d0b5fdadafc0298f635221" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -5300,16 +5361,16 @@ dependencies = [ [[package]] name = "vitaminc-random" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e32850b739b58a7064b50eb3db655de323f57f21c1fe74d5ccd4d308560563" +checksum = "fae7eccb46ddc6f199cf5c934469fd5b199514f42e11579c46882b784ed992c8" dependencies = [ "chacha20", "getrandom 0.4.2", "rand 0.10.1", "thiserror 2.0.20", - "vitaminc-protected 0.9.1", - "vitaminc-random-derives 0.9.0", + "vitaminc-protected 0.10.0", + "vitaminc-random-derives 0.10.0", "zeroize", ] @@ -5337,9 +5398,9 @@ dependencies = [ [[package]] name = "vitaminc-random-derives" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1863fe02de3945047dc9094d3cadbde06becafa49aa95d5e475bf903c8d83981" +checksum = "e48c940c93c9ddb04a66d81ca42ca574826ddbbeece6a7c87c5d1ab31893e692" dependencies = [ "proc-macro2", "quote", @@ -5380,17 +5441,17 @@ dependencies = [ [[package]] name = "vitaminc-traits" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a715ef503b1b41801a6c23e9756ed3d5a1201fa632609bccfa2a7a41ab5386cf" +checksum = "31fba5af175073f24768a8b06dd054ad696c7e6051dda1316c3814043a36d8e0" dependencies = [ "anyhow", "bytes", "rmp-serde", "serde", "thiserror 2.0.20", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.0", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", "zeroize", ] diff --git a/packages/eql/crates/eql-bindings/CHANGELOG.md b/packages/eql/crates/eql-bindings/CHANGELOG.md index d7ba017969..a21c71541e 100644 --- a/packages/eql/crates/eql-bindings/CHANGELOG.md +++ b/packages/eql/crates/eql-bindings/CHANGELOG.md @@ -99,7 +99,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - **`v4::plaintext::Date`, `Timestamp`, `Decimal` and `RangeError` are Stack Encrypt's** (`stack_encrypt::value`), re-exported at the same path: the engine orders them, which it can only do for types of its own. - Nothing a caller writes changes. The `chrono` and `rust_decimal` + Nothing a caller writes changes. The `jiff` and `rust_decimal` features now turn on Stack Encrypt's features of those names, and the crate no longer depends on `vitaminc-aead` directly. @@ -172,13 +172,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 `v4::plaintext::Date` (an `i32` of days since 1970-01-01), `v4::plaintext::Timestamp` (`i64` Unix seconds and `u32` nanoseconds, UTC) and `v4::plaintext::Decimal` (an `i128` mantissa and a `u8` scale). - Each is built range checked against vitaminc's ranges, refused with a + Each is built range checked against vitaminc's ranges (dates from + `-009999-01-01` to `9999-12-31`, instants from `-009999-01-02T01:59:59Z` + to `9999-12-30T22:00:00.999999999Z`), refused with a `v4::plaintext::RangeError` that does not show the value, wiped on drop - (`Zeroize`, `ZeroizeOnDrop`), and not `Copy`: chrono's and + (`Zeroize`, `ZeroizeOnDrop`), and not `Copy`: jiff's and rust_decimal's types cannot be wiped, so the by-name dispatch could not - hold them. The `chrono` and `rust_decimal` features add conversions to - and from `NaiveDate`, `DateTime` and rust_decimal's `Decimal`; a - leap second is refused. `NumericEq`'s `=` normalises the scale and + hold them. The `jiff` and `rust_decimal` features add conversions to + and from jiff's `civil::Date` and `Timestamp` and rust_decimal's + `Decimal`; an instant before jiff's own minimum is refused. `NumericEq`'s `=` normalises the scale and `TimestampEq`'s compares to the microsecond, truncating (never rounding) the nanoseconds below it. Their ordered types follow (see "The date, timestamp and numeric ordered types are producible"). diff --git a/packages/eql/crates/eql-bindings/Cargo.toml b/packages/eql/crates/eql-bindings/Cargo.toml index f35f84934b..da106ac717 100644 --- a/packages/eql/crates/eql-bindings/Cargo.toml +++ b/packages/eql/crates/eql-bindings/Cargo.toml @@ -72,9 +72,9 @@ stack-encrypt = [ "dep:zeroize", "dep:thiserror", ] -# Conversions between chrono's `NaiveDate` / `DateTime` and +# Conversions between jiff's `civil::Date` / `Timestamp` and # `v4::plaintext::Date` / `Timestamp`. -chrono = ["stack-encrypt", "stack-encrypt/chrono"] +jiff = ["stack-encrypt", "stack-encrypt/jiff"] # Conversions between rust_decimal's `Decimal` and `v4::plaintext::Decimal`. rust_decimal = ["stack-encrypt", "stack-encrypt/rust_decimal"] # The by-name dispatch a language binding needs (`encryption::targets`, @@ -88,7 +88,7 @@ targets = [ ] [package.metadata.docs.rs] -features = ["targets", "chrono", "rust_decimal"] +features = ["targets", "jiff", "rust_decimal"] [dev-dependencies] # Parity oracle: tests/catalog_parity.rs asserts the v3 domain inventory diff --git a/packages/eql/crates/eql-bindings/README.md b/packages/eql/crates/eql-bindings/README.md index 37defa996f..af167efb2a 100644 --- a/packages/eql/crates/eql-bindings/README.md +++ b/packages/eql/crates/eql-bindings/README.md @@ -136,15 +136,18 @@ plaintext, or, for a date, a timestamp or a decimal, one of | `Timestamp`, `TimestampEq` | `v4::plaintext::Timestamp`: `i64` Unix seconds and `u32` nanoseconds, UTC, no leap seconds | | `Numeric`, `NumericEq` | `v4::plaintext::Decimal`: an `i128` mantissa (below 2^96) and a `u8` scale (at most 28) | -A date, a timestamp and a decimal have no Rust standard type, and chrono's +A date, a timestamp and a decimal have no Rust standard type, and jiff's and rust_decimal's types cannot be wiped, so these three are this crate's -own. Each is built range checked (vitaminc's ranges, which are chrono's and -rust_decimal's), refusing a value outside them with an error that does not -show it, and wipes its integers when dropped. It is not `Copy`. The `chrono` -and `rust_decimal` features convert to and from `NaiveDate`, -`DateTime` and rust_decimal's `Decimal`; the value converted to is the -caller's, and is not wiped. Only a leap second, which a `DateTime` can -hold and a `Timestamp` cannot, is refused in a conversion. On `NumericEq`, +own. Each is built range checked (vitaminc's ranges, which are jiff's and +rust_decimal's: dates from `-009999-01-01` to `9999-12-31`, instants from +`-009999-01-02T01:59:59Z` to `9999-12-30T22:00:00.999999999Z`), refusing a +value outside them with an error that does not show it, and wipes its +integers when dropped. It is not `Copy`. The `jiff` and `rust_decimal` +features convert to and from jiff's `civil::Date` and `Timestamp` and +rust_decimal's `Decimal`; the value converted to is the caller's, and is not +wiped. One conversion can fail. jiff can make an instant before its own +`Timestamp::MIN` when it parses text with a UTC offset, and converting +that instant is refused. On `NumericEq`, `1.5 = 1.50` (the scale is normalised); on `TimestampEq`, an instant is truncated to the microsecond (the nanoseconds below it are dropped, not rounded), so two instants in the same microsecond are equal. Each opens as it was stored. Their ordered types order a date by its day, a timestamp by the microsecond (truncated, as on `TimestampEq`) and a decimal by value. diff --git a/packages/eql/crates/eql-bindings/src/v4/plaintext.rs b/packages/eql/crates/eql-bindings/src/v4/plaintext.rs index eb4189a62c..f455f3c6d6 100644 --- a/packages/eql/crates/eql-bindings/src/v4/plaintext.rs +++ b/packages/eql/crates/eql-bindings/src/v4/plaintext.rs @@ -7,8 +7,8 @@ //! their equality and order terms treat a decimal's scale and a //! timestamp's nanoseconds. //! -//! With the `chrono` and `rust_decimal` features each converts to and from -//! chrono's `NaiveDate` and `DateTime`, or rust_decimal's `Decimal`. +//! With the `jiff` and `rust_decimal` features each converts to and from +//! jiff's `civil::Date` and `Timestamp`, or rust_decimal's `Decimal`. //! //! The plaintext of the `json` family's storage-only type is //! [`JsonPlaintext`]: a JSON document that is wiped when it is dropped, and diff --git a/packages/eql/crates/eql-codegen/src/bindings.rs b/packages/eql/crates/eql-codegen/src/bindings.rs index 0d76cec8af..2bed22c993 100644 --- a/packages/eql/crates/eql-codegen/src/bindings.rs +++ b/packages/eql/crates/eql-codegen/src/bindings.rs @@ -721,7 +721,7 @@ pub const V3_ENCRYPTION_GAP: &str = /// derive and the by-name dispatch name. `None` for a family eql-bindings /// names no Rust plaintext type for yet. A date, a timestamp and a decimal /// are Stack Encrypt's own types (`stack_encrypt::value`, re-exported as -/// `v4::plaintext`), which can be wiped where chrono's and rust_decimal's +/// `v4::plaintext`), which can be wiped where jiff's and rust_decimal's /// cannot. /// A JSON document is Stack Encrypt's `JsonPlaintext`, re-exported /// there too: it can be wiped where a `serde_json::Value` cannot, and it diff --git a/packages/eql/tests/encryption/Cargo.toml b/packages/eql/tests/encryption/Cargo.toml index 9bdd3167b6..d477df2edc 100644 --- a/packages/eql/tests/encryption/Cargo.toml +++ b/packages/eql/tests/encryption/Cargo.toml @@ -19,9 +19,9 @@ harness = false # Keep crypto/Postgres test dependencies out of eql-bindings' default test build. [dev-dependencies] -# `chrono` and `rust_decimal`: the date, timestamp and decimal plaintexts +# `jiff` and `rust_decimal`: the date, timestamp and decimal plaintexts # convert from those crates' values, which build the test values here. -eql-bindings = { path = "../../crates/eql-bindings", features = ["targets", "chrono", "rust_decimal"] } +eql-bindings = { path = "../../crates/eql-bindings", features = ["targets", "jiff", "rust_decimal"] } # The parity oracle for the generated target table (tests/targets.rs): the # table must name every stored catalog domain, in catalog order. eql-domains = { path = "../../crates/eql-domains" } @@ -30,10 +30,10 @@ eql-domains = { path = "../../crates/eql-domains" } # `testing`: `assert_context!`, which pins the contexts of the EQL types. stack-encrypt = { path = "../../../stack-encrypt", default-features = false, features = ["dynamic", "testing"] } # `plaintext::Sink`, for a plaintext type with its own `Encrypt` impl; and -# chrono's and rust_decimal's own sources, which seal the leaf a date, +# jiff's and rust_decimal's own sources, which seal the leaf a date, # timestamp or decimal from any other producer seals. -vitaminc-aead = { version = "0.9.0", features = ["chrono", "rust_decimal"] } -chrono = { version = "0.4.44", default-features = false, features = ["std"] } +vitaminc-aead = { version = "0.10.0", features = ["jiff", "rust_decimal"] } +jiff = "1.0.0" rust_decimal = { version = "1", default-features = false, features = ["std"] } stack-kms = { path = "../../../stack-kms", default-features = false, features = ["test-support"] } serde = "1" diff --git a/packages/eql/tests/encryption/fixtures/v4_ledger_rows.json b/packages/eql/tests/encryption/fixtures/v4_ledger_rows.json index 63777e6f4f..9a6b9822f4 100644 --- a/packages/eql/tests/encryption/fixtures/v4_ledger_rows.json +++ b/packages/eql/tests/encryption/fixtures/v4_ledger_rows.json @@ -6,7 +6,7 @@ { "id": 1, "plaintext": { - "opened": "-262143-01-01", + "opened": "-009999-01-01", "due": "2024-02-29", "created": "1969-12-31T23:59:59.999999999Z", "posted": "2024-02-29T12:34:56.123456Z", @@ -20,7 +20,7 @@ "t": "profiles", "c": "amount" }, - "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAABkTJd2+gSGUCXq5Bog0ODUIACQ+t9l6f3shvibRWnk1Ihw7dEY6c0vRmYYIIFt9OMzRAIL8M8TSHbtBLpRD8evgfwfWeQncgvb4wFTmJ2Dl2n60SGuhBcL2PnYmDbY/GM=", + "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAABkTJd2+gSGUCXq5Bog0ODUIACQ+t9l6f3shvibRWnk1Ihw7dEY6c0vRmYYIIFt9OMzRALgbI7rbuRzBABo33ii/EtGglI/26BpM6zEo7KX9DPoT7v0LPCYpPWJ/oAOQbs=", "hm": "ff787d4a33e41d24d30fb95098c57bdffeef072fb9e0907a2dd7fa621a5eda03" }, "created": { @@ -29,7 +29,7 @@ "t": "profiles", "c": "created" }, - "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAABGuTbf5RPT5TP4jkMDscaIIADvvVQ1X3uY1KcA+8e4xNhSomXJsaXQbJQFq2COXq6V/gKCU8qm+3AzsbJ2iZdccv/Iaxb+WgqDN6aoF4MRVZU74p5qKfXg12dXAA==" + "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAABGuTbf5RPT5TP4jkMDscaIIADvvVQ1X3uY1KcA+8e4xNhSomXJsaXQbJQFq2COXq6V/gKYmTDAScqmSFA7DWkQlwMteHxk+uqUD1AloEJpuVkBVdvv8oCcX1dBzg==" }, "due": { "v": 4, @@ -37,7 +37,7 @@ "t": "profiles", "c": "due" }, - "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAABxVAjbrawodyK39W6/wh82IABYPU+0mX8CHFvfIfoChRygxSp/EY9wA5Tt3u09Pc3bgwIDcMmFSrX/0VrXRIQ4VO1CORi2fLaZvUHGHKyQ51NO9OU=", + "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAABxVAjbrawodyK39W6/wh82IABYPU+0mX8CHFvfIfoChRygxSp/EY9wA5Tt3u09Pc3bgwKMWqq+DLgAW++AkJIi/sfOaPuTX3VA9prZ5ycYV1PrlCU=", "hm": "decc03613957c47004860bc9bc70770aed4c6ba3f0da2aaea3da9fe7367af6a9" }, "opened": { @@ -46,7 +46,7 @@ "t": "profiles", "c": "opened" }, - "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAABac+LBy0VG2VPg3ZA53wR5IADij0/N3siwDhSUWwCHNy3M63fuNYPaRFubg/d7h/snCAL03BHwsPgXawwBQRFdQWpQKS5jg02BxED9R4DALnq5jis=" + "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAABac+LBy0VG2VPg3ZA53wR5IADij0/N3siwDhSUWwCHNy3M63fuNYPaRFubg/d7h/snCAJT8zIBBHcKYUhcbvheINzgCiHykdg9wCodJlKLF7ZHO7A=" }, "posted": { "v": 4, @@ -54,7 +54,7 @@ "t": "profiles", "c": "posted" }, - "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAAAr9Mw7BH8KdqEzSM13/Zi7IADyLjNo7TciDvsKQU+xOu/8uQlNYMYFE1U+bVt29bUpOQIHRhk22OLKCoM9GSa2moqwpXD2u/VhhJfzC9Yt+Nj6OJMZhFCoU4Fuhg==", + "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAAAr9Mw7BH8KdqEzSM13/Zi7IADyLjNo7TciDvsKQU+xOu/8uQlNYMYFE1U+bVt29bUpOQIS42Mq56SIc8gtdah/RrqAw8MkioQPyKjcYvbHJ4Y7mfGolxKHc4LtWg==", "hm": "b3a2b5c8d5ea562f472a55eb57f3b49aec3d6cc3731dad16c4f8999394a95c55" }, "total": { @@ -63,14 +63,14 @@ "t": "profiles", "c": "total" }, - "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAAATyRC14+m8N7oH7Js7ZVqRIAAMq9Za2+D51qL5ba1r6/Rtqzc3kwtt8DctI1tVVhdvgQKko9YUgjcDJdcUOhpOnbxcyAs53dUr8W3bkDuQJ2+tOMjWzVbZi3+3UY9THL8=" + "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAAATyRC14+m8N7oH7Js7ZVqRIAAMq9Za2+D51qL5ba1r6/Rtqzc3kwtt8DctI1tVVhdvgQL39aSr8zwfIcFgmwS4I/EmfR3D8Zf5bha9P6MWkVPe3T9gFIoSkcWQN6pnpzE=" } } }, { "id": 2, "plaintext": { - "opened": "+262142-12-31", + "opened": "9999-12-31", "due": "2024-03-01", "created": "2024-02-29T12:34:56.123456789Z", "posted": "2024-02-29T12:34:56.123456999Z", @@ -84,7 +84,7 @@ "t": "profiles", "c": "amount" }, - "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAAAKybDqXBsszdixWIGR8SZBIAD/drxmP5dzmNDKUjYtiDgZvFcHhOZOJzrc6eex0q0MCgJ/PdJDq9vGicUmekPKAKWfOpPYO9BZKtoa1mnfIssxqlPAj08l1SM/ZUkyzdg=", + "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAAAKybDqXBsszdixWIGR8SZBIAD/drxmP5dzmNDKUjYtiDgZvFcHhOZOJzrc6eex0q0MCgLKVd4QPn0YiJorR8XFaaph1SpxZpGFPCqlS6A41NIDiKOZqHfzGzKiVWl/mEY=", "hm": "ff787d4a33e41d24d30fb95098c57bdffeef072fb9e0907a2dd7fa621a5eda03" }, "created": { @@ -93,7 +93,7 @@ "t": "profiles", "c": "created" }, - "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAACseL3lfg99+b/uhGmba7LRIADKXzDfsoVOBKIKwpw6XN/IWltOxnK8Q1qzZ0YkAqK0WwI+rlmCIdTAihn74kvROTOrdSmPQRCT1v1M110EAPHAat3QVBGT+2H9AA==" + "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAACseL3lfg99+b/uhGmba7LRIADKXzDfsoVOBKIKwpw6XN/IWltOxnK8Q1qzZ0YkAqK0WwJXLxlBhVqphbE8npQD8Ta+pZN0b354tqtD5o74IlQfO0rKsSUWOOMdVQ==" }, "due": { "v": 4, @@ -101,7 +101,7 @@ "t": "profiles", "c": "due" }, - "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAAAXndapLjoyx2wsK2yToOIfIACwJln1DyojCIuwH8XHvJodMunCGS0dfEYintuFQrNXLALNoZ3nax4abrlBe0je4lvugniEDqDjJ/5+nrsWCL19o84=", + "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAAAXndapLjoyx2wsK2yToOIfIACwJln1DyojCIuwH8XHvJodMunCGS0dfEYintuFQrNXLAJxSsUo9UdwKwwAYnRk13zKgnyqmRl8agAsH7BPvuFLX7k=", "hm": "086ccfab604ccf449a731ad7e01161bfd80c12f25ba5832e92b709f42b2b7aa4" }, "opened": { @@ -110,7 +110,7 @@ "t": "profiles", "c": "opened" }, - "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAADhmok01VlvzDZ54Ve4NYs+IAA9SQIB8WxjSZDilDh2n9Ym6YccQQWBJ7ef2clbtu4SgQLl1OmZPlTj2ZHK0QyC215t27avkXEaIiiXstXCtLjsXhQ=" + "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAADhmok01VlvzDZ54Ve4NYs+IAA9SQIB8WxjSZDilDh2n9Ym6YccQQWBJ7ef2clbtu4SgQLFZAYLwvuDNC0OXgmnvRfa9xriNIjicBeesvBHT6eQuuU=" }, "posted": { "v": 4, @@ -118,7 +118,7 @@ "t": "profiles", "c": "posted" }, - "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAABaXm2d096n8ZEEJiaB3NxKIACL8OhWrR2p4fZZazuJKKgRsv+lJPaamyXwxGVq9vT2EAK7AmoJ7W7R19iCPgf9Vgr+k6s4qT1n8cIt4USX0NfAI+pE7FlsCyeD7A==", + "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAABaXm2d096n8ZEEJiaB3NxKIACL8OhWrR2p4fZZazuJKKgRsv+lJPaamyXwxGVq9vT2EAJW5FayWFedSuAsjdZDSzzJQ3sA92rO+TxX49mirCMKkXcVEM4vCW9jgw==", "hm": "b3a2b5c8d5ea562f472a55eb57f3b49aec3d6cc3731dad16c4f8999394a95c55" }, "total": { @@ -127,7 +127,7 @@ "t": "profiles", "c": "total" }, - "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAABLXWj8ZGmyU14mfULzczbUIADg6xfObeAiOuQQcg49dZ3rMkOc2WqCL0NPepGJDhhslgLyLRD8HyuEqddrbsIzlXzyWBYWvk46vlaHtQK02b+Task10kxCuTxm7gJtg0s=" + "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAABLXWj8ZGmyU14mfULzczbUIADg6xfObeAiOuQQcg49dZ3rMkOc2WqCL0NPepGJDhhslgI1ZgLYsayeOLV5lFqn18xOGSNlCGDvMmsJvBLeFkqTaBXndlySvg6n2ERrE6w=" } } }, @@ -148,7 +148,7 @@ "t": "profiles", "c": "amount" }, - "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAABnPkyUpuwK99phMHDnRbhCIABCbSCYPvkH92/UTxfFMiL/7X01xvH3mgh3pxeV+v59vwJJQAnSyyjouUFH1r1Y5SrLasHKlU9oED93T3O5LqvtTWwiArdsKBHHpx71T4Y=", + "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAABnPkyUpuwK99phMHDnRbhCIABCbSCYPvkH92/UTxfFMiL/7X01xvH3mgh3pxeV+v59vwLHKp/WxoVWUyItOiDJhAZFvvWXz1sOiIWLgUH0gO7Z22BXsRgqZOtHHfX+vlU=", "hm": "7fbed23fa93b6d89ecf0883cddd191d4260d1cc8af68ec9c60d997365dbf4d5f" }, "created": { @@ -157,7 +157,7 @@ "t": "profiles", "c": "created" }, - "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAADb10mF0XME/G6O/c19GNdtIAC6NkocrbY4y7PuHSJX/nEKsSq6uC8EKGhUL69Xkgz4MQJh2UUJ/xMpXG6j+ij6GOMZn9R/bakY9mtlssoB5upT/pIJA+hV4N478g==" + "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAADb10mF0XME/G6O/c19GNdtIAC6NkocrbY4y7PuHSJX/nEKsSq6uC8EKGhUL69Xkgz4MQL7IKwahmAIsHx2/di7OoBAMm8FUurzHBbQWIGc1r7b35HHH57a9LObrw==" }, "due": { "v": 4, @@ -165,7 +165,7 @@ "t": "profiles", "c": "due" }, - "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAAAMtFomHN3dgKH8FZNzXqxbIAAX/CwMjLj4HTN/Mo0hRbmUt+V5v4bI366uKHRN55IcpQKhu13tqJuXm3Uw6yrB8GapAq7TEKzLqcOkNT2vSyNPLvk=", + "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAAAMtFomHN3dgKH8FZNzXqxbIAAX/CwMjLj4HTN/Mo0hRbmUt+V5v4bI366uKHRN55IcpQLhEtgQUWHp3+XxUaGAMMV9aNC/ORJNzzzHrgcFSI3VUZ8=", "hm": "decc03613957c47004860bc9bc70770aed4c6ba3f0da2aaea3da9fe7367af6a9" }, "opened": { @@ -174,7 +174,7 @@ "t": "profiles", "c": "opened" }, - "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAAAUfff4RXAt9HIL0ezwFl5oIABloL38OjJ3H7ZOBpgYefpdza2nKMMccXMcD8sSAdaR9AIG69Y8fG9aO6AFuMG4AkH92lz4Plj5TuGR3crB+83JuHc=" + "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAAAUfff4RXAt9HIL0ezwFl5oIABloL38OjJ3H7ZOBpgYefpdza2nKMMccXMcD8sSAdaR9ALgM224nXAZzd5D9a5UQjG+Tr4xY77JXMGkQxf1Dr123XM=" }, "posted": { "v": 4, @@ -182,7 +182,7 @@ "t": "profiles", "c": "posted" }, - "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAABTyd02/xTIqENG5WzqeH+kIACTeY3JPRFisVuLrMf6rcKnordc0e9lrrATavl1B/cL4wJ2f82ziXPF0/JepP3C5XPnAxP/UVQemoyzemJeRGdkqegUvASIHcRrgQ==", + "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAABTyd02/xTIqENG5WzqeH+kIACTeY3JPRFisVuLrMf6rcKnordc0e9lrrATavl1B/cL4wIULtY8kVQhtu28FUQQP92AuGHpMUcccyxziKC4/scGuEqRw0TdzudpWQ==", "hm": "b75c44fffb471158dd836f858f88d04658cd8985d0f52ccf582af259eeda030f" }, "total": { @@ -191,7 +191,7 @@ "t": "profiles", "c": "total" }, - "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAACT3tVNTBXZ5pFHbNGibsVoIADBAZSy1MjXUm3HtQF3xbv35hpGRWHsK4FDx5KsARB6cgLDY8S5OvL6ob8+2pUnCBw7Eq1x5kSeBw1lpoRqjUmzugxrQ9NTSGwi1ObgAuk=" + "c": "stack-encrypt:1:AQAAAAAAAAAAAAAAAAAAAACT3tVNTBXZ5pFHbNGibsVoIADBAZSy1MjXUm3HtQF3xbv35hpGRWHsK4FDx5KsARB6cgLjjBP1eET+lo9PGniF2OAZo1ftKN5aeMsXwSZgrwp3yrLTSNuLGKMlakwj0U8=" } } } diff --git a/packages/eql/tests/encryption/tests/typed_queries.rs b/packages/eql/tests/encryption/tests/typed_queries.rs index 67791aeedb..3ea0a1c4ff 100644 --- a/packages/eql/tests/encryption/tests/typed_queries.rs +++ b/packages/eql/tests/encryption/tests/typed_queries.rs @@ -527,7 +527,7 @@ async fn a_record_stores_a_null_in_an_eql_field_as_its_plan_says() { &EqlTargets, ) .unwrap(); - let day = chrono::NaiveDate::from_ymd_opt(1990, 5, 17); + let day = Some(jiff::civil::date(1990, 5, 17)); let rows = |dob, born| BTreeMap::from([("a_dob", dob), ("b_born", born)]); let source = vec![rows(day, day), rows(None, None)]; let sealed = record::encrypt_with(&keyset, frame(&source), &plan, &EqlTargets) diff --git a/packages/eql/tests/encryption/tests/v4_date_time_numeric.rs b/packages/eql/tests/encryption/tests/v4_date_time_numeric.rs index f8bf583db8..5dabe64706 100644 --- a/packages/eql/tests/encryption/tests/v4_date_time_numeric.rs +++ b/packages/eql/tests/encryption/tests/v4_date_time_numeric.rs @@ -6,7 +6,7 @@ //! `v4_ore_block.rs` (block ORE). //! //! Each type must round-trip through both entry points, seal the leaf a -//! chrono or rust_decimal value of the same instant, day or number seals +//! jiff or rust_decimal value of the same instant, day or number seals //! (what any other producer writes for that kind), open a leaf such a value //! sealed, and refuse a value of another kind. The Go SDK's rows //! (`fixtures/v4_ledger_rows.json`) open here and are queried in @@ -18,13 +18,13 @@ mod common; use stack_encrypt::AsProtectedRef as _; use std::str::FromStr; -use chrono::{DateTime, NaiveDate, Utc}; use eql_bindings::encryption::targets::{self as targets, TargetError}; use eql_bindings::encryption::NativeCiphertextVisitor as NativeLeaf; use eql_bindings::v3::terms::Ciphertext; use eql_bindings::v4::plaintext::{Date, Decimal, Timestamp}; use eql_bindings::v4::{date, numeric, timestamp}; use eql_bindings::Identifier; +use jiff::civil::Date as CivilDate; use serde::de::DeserializeOwned; use stack_encrypt::dynamic::{ValueFrame, ValueKind}; use stack_encrypt::target::transcode::Reader; @@ -53,12 +53,12 @@ fn refused(result: Result) -> TargetError { } } -fn day(text: &str) -> NaiveDate { - NaiveDate::from_str(text).unwrap() +fn day(text: &str) -> CivilDate { + text.parse().unwrap() } -fn instant(text: &str) -> DateTime { - DateTime::parse_from_rfc3339(text).unwrap().to_utc() +fn instant(text: &str) -> jiff::Timestamp { + text.parse().unwrap() } fn number(text: &str) -> rust_decimal::Decimal { @@ -102,7 +102,7 @@ async fn hm( } #[tokio::test] -async fn dates_round_trip_and_seal_the_leaf_a_naive_date_seals() { +async fn dates_round_trip_and_seal_the_leaf_a_jiff_date_seals() { let (cipher, _) = common::cipher().await; let keyset = cipher.default_keyset(); for text in ["2024-02-29", "1969-12-31", "0001-01-01", "1970-01-01"] { @@ -113,10 +113,10 @@ async fn dates_round_trip_and_seal_the_leaf_a_naive_date_seals() { .decrypt_as(stored.clone(), column().into()) .await .unwrap(); - assert_eq!(NaiveDate::from(&opened), theirs, "{text}"); + assert_eq!(CivilDate::from(&opened), theirs, "{text}"); assert!( same(&as_frame(&cipher, stored.c.clone()).await, &frame(theirs)), - "{text}: the leaf a NaiveDate seals" + "{text}: the leaf a jiff civil::Date seals" ); let searchable: date::DateEq = keyset.encrypt_as(&value, column()).await.unwrap(); @@ -133,18 +133,18 @@ async fn dates_round_trip_and_seal_the_leaf_a_naive_date_seals() { .unwrap(); assert!(same(&opened, &frame(theirs)), "{text}: by name"); } - for edge in [NaiveDate::MIN, NaiveDate::MAX] { + for edge in [CivilDate::MIN, CivilDate::MAX] { let stored: date::DateEq = keyset .encrypt_as(&Date::from(edge), column()) .await .unwrap(); let opened: Date = cipher.decrypt_as(stored, column().into()).await.unwrap(); - assert_eq!(NaiveDate::from(&opened), edge); + assert_eq!(CivilDate::from(&opened), edge); } } #[tokio::test] -async fn timestamps_round_trip_to_the_nanosecond_and_seal_the_leaf_a_date_time_seals() { +async fn timestamps_round_trip_to_the_nanosecond_and_seal_the_leaf_a_jiff_timestamp_seals() { let (cipher, _) = common::cipher().await; let keyset = cipher.default_keyset(); for text in [ @@ -159,10 +159,10 @@ async fn timestamps_round_trip_to_the_nanosecond_and_seal_the_leaf_a_date_time_s .decrypt_as(stored.clone(), column().into()) .await .unwrap(); - assert_eq!(DateTime::::from(&opened), theirs, "{text}"); + assert_eq!(jiff::Timestamp::from(&opened), theirs, "{text}"); assert!( same(&as_frame(&cipher, stored.c.clone()).await, &frame(theirs)), - "{text}: the leaf a DateTime seals" + "{text}: the leaf a jiff Timestamp seals" ); let searchable: timestamp::TimestampEq = keyset.encrypt_as(&value, column()).await.unwrap(); @@ -173,21 +173,18 @@ async fn timestamps_round_trip_to_the_nanosecond_and_seal_the_leaf_a_date_time_s .await .unwrap(); assert_eq!( - DateTime::::from(&opened), + jiff::Timestamp::from(&opened), theirs, "{text}: nanoseconds kept" ); } - for edge in [ - chrono::NaiveDateTime::MIN.and_utc(), - chrono::NaiveDateTime::MAX.and_utc(), - ] { + for edge in [jiff::Timestamp::MIN, jiff::Timestamp::MAX] { let stored: timestamp::TimestampEq = keyset .encrypt_as(&Timestamp::try_from(edge).unwrap(), column()) .await .unwrap(); let opened: Timestamp = cipher.decrypt_as(stored, column().into()).await.unwrap(); - assert_eq!(DateTime::::from(&opened), edge); + assert_eq!(jiff::Timestamp::from(&opened), edge); } } @@ -606,7 +603,7 @@ fn postgres_stores_and_finds_date_timestamp_and_numeric_rows() { ) .await .unwrap(); - assert_eq!(NaiveDate::from(&opened), day("2024-02-29")); + assert_eq!(CivilDate::from(&opened), day("2024-02-29")); let created: Timestamp = cipher .decrypt_as( serde_json::from_str::(&created).unwrap(), @@ -713,12 +710,12 @@ mod go_ledger { .decrypt_as(parsed::(row, "opened"), column("opened").into()) .await .unwrap(); - assert_eq!(NaiveDate::from(&opened), day(&p.opened), "row {id} opened"); + assert_eq!(CivilDate::from(&opened), day(&p.opened), "row {id} opened"); let due: Date = cipher .decrypt_as(parsed::(row, "due"), column("due").into()) .await .unwrap(); - assert_eq!(NaiveDate::from(&due), day(&p.due), "row {id} due"); + assert_eq!(CivilDate::from(&due), day(&p.due), "row {id} due"); let created: Timestamp = cipher .decrypt_as( parsed::(row, "created"), @@ -727,7 +724,7 @@ mod go_ledger { .await .unwrap(); assert_eq!( - DateTime::::from(&created), + jiff::Timestamp::from(&created), instant(&p.created), "row {id} created" ); @@ -739,7 +736,7 @@ mod go_ledger { .await .unwrap(); assert_eq!( - DateTime::::from(&posted), + jiff::Timestamp::from(&posted), instant(&p.posted), "row {id} posted" ); @@ -835,7 +832,7 @@ fn postgres_stores_and_queries_ledger_rows_the_go_sdk_sealed() { .unwrap(); let plaintext = |key: &str| queries[key]["plaintext"].as_str().unwrap().to_owned(); let due = day(&plaintext("due")); - let posted = instant(&plaintext("posted")).timestamp_micros(); + let posted = instant(&plaintext("posted")).as_microsecond(); let amount = number(&plaintext("amount")).normalize(); for (column_name, query_domain, expected) in [ ( @@ -854,7 +851,7 @@ fn postgres_stores_and_queries_ledger_rows_the_go_sdk_sealed() { fixture .rows .iter() - .filter(|r| instant(&r.plaintext.posted).timestamp_micros() == posted) + .filter(|r| instant(&r.plaintext.posted).as_microsecond() == posted) .map(|r| r.id) .collect(), ), @@ -929,13 +926,13 @@ async fn a_storage_only_type_stores_a_none_as_long_as_a_value() { .unwrap(); let opened: Date = cipher.decrypt_as(some, column().into()).await.unwrap(); assert_eq!( - NaiveDate::from(&opened), + CivilDate::from(&opened), day("2024-02-29"), "Some seals the plaintext's own leaf" ); let opened: Option = cipher.decrypt_as(present, column().into()).await.unwrap(); assert_eq!( - opened.as_ref().map(NaiveDate::from), + opened.as_ref().map(CivilDate::from), Some(day("2024-02-29")), "and an Option opens a value" ); diff --git a/packages/eql/tests/encryption/tests/v4_owned.rs b/packages/eql/tests/encryption/tests/v4_owned.rs index c796564b52..da042dd1be 100644 --- a/packages/eql/tests/encryption/tests/v4_owned.rs +++ b/packages/eql/tests/encryption/tests/v4_owned.rs @@ -19,7 +19,6 @@ mod common; use std::str::FromStr; -use chrono::{DateTime, NaiveDate, Utc}; use eql_bindings::v4::plaintext::{ Date as DateValue, Decimal as DecimalValue, Timestamp as TimestampValue, }; @@ -27,6 +26,7 @@ use eql_bindings::v4::{ bigint, boolean, date, double, integer, numeric, real, smallint, text, timestamp, }; use eql_bindings::Identifier; +use jiff::civil::Date as CivilDate; use serde::Serialize; use stack_encrypt::sem::OreBlockTerm; use stack_encrypt::{DecryptFrom, EncryptInto, NonEmpty}; @@ -75,11 +75,11 @@ fn assert_same_terms(owned: &T, structural: &T, name: &str) { } fn date(text: &str) -> DateValue { - DateValue::from(NaiveDate::from_str(text).unwrap()) + DateValue::from(text.parse::().unwrap()) } fn timestamp(text: &str) -> TimestampValue { - let instant: DateTime = DateTime::parse_from_rfc3339(text).unwrap().to_utc(); + let instant: jiff::Timestamp = text.parse().unwrap(); TimestampValue::try_from(instant).unwrap() } @@ -89,7 +89,7 @@ fn decimal(text: &str) -> DecimalValue { /// A plaintext as a value that can be compared. The date, timestamp, and /// decimal plaintexts do not implement `PartialEq`. The test compares them as -/// the chrono and rust_decimal values they convert to. +/// the jiff and rust_decimal values they convert to. trait Seen { type View: PartialEq + std::fmt::Debug; fn view(&self) -> Self::View; @@ -112,15 +112,15 @@ impl Seen for Option { } } impl Seen for DateValue { - type View = NaiveDate; - fn view(&self) -> NaiveDate { - NaiveDate::from(self) + type View = CivilDate; + fn view(&self) -> CivilDate { + CivilDate::from(self) } } impl Seen for TimestampValue { - type View = DateTime; - fn view(&self) -> DateTime { - DateTime::::from(self) + type View = jiff::Timestamp; + fn view(&self) -> jiff::Timestamp { + jiff::Timestamp::from(self) } } impl Seen for DecimalValue { diff --git a/packages/eql/tests/encryption/tests/v4_terms.rs b/packages/eql/tests/encryption/tests/v4_terms.rs index 5c473ca0a2..0a87dde5c7 100644 --- a/packages/eql/tests/encryption/tests/v4_terms.rs +++ b/packages/eql/tests/encryption/tests/v4_terms.rs @@ -30,7 +30,6 @@ use std::ffi::OsStr; use std::path::PathBuf; use std::str::FromStr; -use chrono::{DateTime, NaiveDate, Utc}; use eql_bindings::v4::plaintext::{ Date as DateValue, Decimal as DecimalValue, Timestamp as TimestampValue, }; @@ -38,6 +37,7 @@ use eql_bindings::v4::{ bigint, boolean, date, double, integer, numeric, real, smallint, text, timestamp, }; use eql_bindings::Identifier; +use jiff::civil::Date as CivilDate; use serde_json::Value; use stack_encrypt::{EncryptInto, NonEmpty}; @@ -46,11 +46,11 @@ fn column() -> NonEmpty { } fn date(text: &str) -> DateValue { - DateValue::from(NaiveDate::from_str(text).unwrap()) + DateValue::from(text.parse::().unwrap()) } fn timestamp(text: &str) -> TimestampValue { - let instant: DateTime = DateTime::parse_from_rfc3339(text).unwrap().to_utc(); + let instant: jiff::Timestamp = text.parse().unwrap(); TimestampValue::try_from(instant).unwrap() } diff --git a/packages/eql/tests/timing/ore_block_v2/ctgen/Cargo.lock b/packages/eql/tests/timing/ore_block_v2/ctgen/Cargo.lock index a743e844bd..52adc1d9a4 100644 --- a/packages/eql/tests/timing/ore_block_v2/ctgen/Cargo.lock +++ b/packages/eql/tests/timing/ore_block_v2/ctgen/Cargo.lock @@ -407,9 +407,9 @@ dependencies = [ [[package]] name = "ore-rs" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b274b7a0bf081d51815ccc7b20fa3b023e5769e3446fe4de1e8e8044a4413201" +checksum = "eebac11f6f3ceaec9994a27b00666385301e6b650ba8973f852430b9f7bd4ba5" dependencies = [ "aes", "block-modes", @@ -743,9 +743,9 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "vitaminc-aead" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efba1dac1efc04ffc09cba49e343e0fe656c88c32472a4206f2a6df284add33d" +checksum = "6fcccedca9d80812af295cba43dc2ac388f4fbb0415faa3ebec783d072d014d8" dependencies = [ "bytes", "futures-util", @@ -760,9 +760,9 @@ dependencies = [ [[package]] name = "vitaminc-aead-derive" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3c6575dac7701e578b375d16a0b693294d73847ed275c9b9962cf20c423ea10" +checksum = "3de85a0ff50572db91a5528b72775f63d57a2b24b8263fb8e728baf6a7731502" dependencies = [ "proc-macro2", "quote", @@ -771,9 +771,9 @@ dependencies = [ [[package]] name = "vitaminc-context" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b407b3127be198a8da7d4d914c11215e1eae1b467cdf89eca8a7a296055e863" +checksum = "431a7fb023688dba855e52b9c4e44c942418dde8ea08a2b115cf6a7f762fa5b9" dependencies = [ "mutants", "vitaminc-protected", @@ -781,9 +781,9 @@ dependencies = [ [[package]] name = "vitaminc-hmac" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ada61349172294efe0a71bf2af367969b4e196437b46c20c688aaf15f692bc2d" +checksum = "b031c7e62ab28f716df69c5e2137267c93e8d2aa36e4f31a12ac5b193baaa3d1" dependencies = [ "hmac", "sha2", @@ -794,9 +794,9 @@ dependencies = [ [[package]] name = "vitaminc-normalize" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1d354f4ee3764be072eb02f4f8db79ed0ed467a7c6d9f2c6143823867bde347" +checksum = "e333da8bb30eab39cc2c790cb860843229a0a06aefb807f4ce069a92a2e17e8d" dependencies = [ "thiserror 2.0.21", "unicode-general-category", @@ -807,9 +807,9 @@ dependencies = [ [[package]] name = "vitaminc-ore" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a812b8e245352094c3c2113312cf86d0804b83f1e315bacd15571cd01703c8b" +checksum = "9a1d92d394e577ee424b4f35479a101896aecbce98f00c37bca5af1aa0d3b2c0" dependencies = [ "thiserror 2.0.21", "unicode-general-category", @@ -823,9 +823,9 @@ dependencies = [ [[package]] name = "vitaminc-prf" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1703452d837ef964ec1f20cc601265857245d72ac14426276d49c3106dd39b3" +checksum = "078c13f43f5a9fefdd6f4cb337327a432b3b136c168f558fd525d1dd14685541" dependencies = [ "mutants", "thiserror 2.0.21", @@ -835,9 +835,9 @@ dependencies = [ [[package]] name = "vitaminc-protected" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44e61d6e58132793aace6898403ffa949bc06e388c1fc89c08d48ad0303133c3" +checksum = "2153981f290343dffa8f618277c46a13b5a1e8131b4120760e9a1795ae1cb55b" dependencies = [ "bitvec", "digest", @@ -852,9 +852,9 @@ dependencies = [ [[package]] name = "vitaminc-protected-derive" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a60e915eb16c115882ea4754cecc99d7bcd3d8a1bfb9b8e512af4b6f7dd14801" +checksum = "32eb239bc9aae16ef0320076934f3f592606960d42d0b5fdadafc0298f635221" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -864,9 +864,9 @@ dependencies = [ [[package]] name = "vitaminc-random" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e32850b739b58a7064b50eb3db655de323f57f21c1fe74d5ccd4d308560563" +checksum = "fae7eccb46ddc6f199cf5c934469fd5b199514f42e11579c46882b784ed992c8" dependencies = [ "chacha20", "getrandom 0.4.3", @@ -879,9 +879,9 @@ dependencies = [ [[package]] name = "vitaminc-random-derives" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1863fe02de3945047dc9094d3cadbde06becafa49aa95d5e475bf903c8d83981" +checksum = "e48c940c93c9ddb04a66d81ca42ca574826ddbbeece6a7c87c5d1ab31893e692" dependencies = [ "proc-macro2", "quote", diff --git a/packages/eql/tests/timing/ore_block_v2/ctgen/Cargo.toml b/packages/eql/tests/timing/ore_block_v2/ctgen/Cargo.toml index 586ce92b71..3b60de671a 100644 --- a/packages/eql/tests/timing/ore_block_v2/ctgen/Cargo.toml +++ b/packages/eql/tests/timing/ore_block_v2/ctgen/Cargo.toml @@ -16,9 +16,9 @@ publish = false # EQL v4's `ore_block_v2` compares; the same version as the root Cargo.lock. # Since ore-rs 0.10 a value reaches the engines only through vitaminc-ore, as it # does in stack-encrypt. -ore-rs = { version = "=0.11.0", default-features = false } -vitaminc-ore = "=0.9.0" -vitaminc-protected = "=0.9.0" +ore-rs = { version = "=0.12.0", default-features = false } +vitaminc-ore = "=0.10.0" +vitaminc-protected = "=0.10.0" rand = "0.8" hex = "0.4" diff --git a/packages/stack-auth/fuzz/Cargo.lock b/packages/stack-auth/fuzz/Cargo.lock index 7e3c48d2ee..cbf18c9bb2 100644 --- a/packages/stack-auth/fuzz/Cargo.lock +++ b/packages/stack-auth/fuzz/Cargo.lock @@ -2626,8 +2626,8 @@ dependencies = [ "tracing", "url", "uuid", - "vitaminc 0.9.0", - "vitaminc-protected 0.9.1", + "vitaminc 0.10.0", + "vitaminc-protected 0.10.0", "web-time", "zeroize", "zerokms-protocol", @@ -3182,16 +3182,16 @@ dependencies = [ [[package]] name = "vitaminc" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7aa53d696a9e1af61b36a60b92cc0dde7421f8f58787333d3c425a176af241c" +checksum = "60ae27c0d0e6980d2f30683384ed591a9dafa943b18faaa6bfb456757b5e10ef" dependencies = [ - "vitaminc-aead 0.9.0", - "vitaminc-context 0.9.0", - "vitaminc-encrypt 0.9.0", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.0", - "vitaminc-traits 0.9.0", + "vitaminc-aead 0.10.0", + "vitaminc-context 0.10.0", + "vitaminc-encrypt 0.10.0", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", + "vitaminc-traits 0.10.0", ] [[package]] @@ -3211,18 +3211,18 @@ dependencies = [ [[package]] name = "vitaminc-aead" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efba1dac1efc04ffc09cba49e343e0fe656c88c32472a4206f2a6df284add33d" +checksum = "6fcccedca9d80812af295cba43dc2ac388f4fbb0415faa3ebec783d072d014d8" dependencies = [ "bytes", "futures-util", "serde", "thiserror 2.0.18", - "vitaminc-aead-derive 0.9.0", - "vitaminc-context 0.9.0", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.0", + "vitaminc-aead-derive 0.10.0", + "vitaminc-context 0.10.0", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", "zeroize", ] @@ -3239,9 +3239,9 @@ dependencies = [ [[package]] name = "vitaminc-aead-derive" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3c6575dac7701e578b375d16a0b693294d73847ed275c9b9962cf20c423ea10" +checksum = "3de85a0ff50572db91a5528b72775f63d57a2b24b8263fb8e728baf6a7731502" dependencies = [ "proc-macro2", "quote", @@ -3260,12 +3260,12 @@ dependencies = [ [[package]] name = "vitaminc-context" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b407b3127be198a8da7d4d914c11215e1eae1b467cdf89eca8a7a296055e863" +checksum = "431a7fb023688dba855e52b9c4e44c942418dde8ea08a2b115cf6a7f762fa5b9" dependencies = [ "mutants", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", ] [[package]] @@ -3284,15 +3284,15 @@ dependencies = [ [[package]] name = "vitaminc-encrypt" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fa0a3493624afd1490085448d6d09d22bf061954e9ab0db08837f423db3a58d" +checksum = "e68d89e2587529db55a10fa59cb11be8a7505b4af473c8a0bec238c803190ec5" dependencies = [ "aes-gcm", "aws-lc-rs", - "vitaminc-aead 0.9.0", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.0", + "vitaminc-aead 0.10.0", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", "zeroize", ] @@ -3315,9 +3315,9 @@ dependencies = [ [[package]] name = "vitaminc-protected" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67a44502e43de42fbd95c12a35efbaea903eedcc7a3922fceacea93054f44485" +checksum = "2153981f290343dffa8f618277c46a13b5a1e8131b4120760e9a1795ae1cb55b" dependencies = [ "bitvec", "digest 0.11.3", @@ -3326,7 +3326,7 @@ dependencies = [ "serde_bytes", "subtle", "thiserror 2.0.18", - "vitaminc-protected-derive 0.9.1", + "vitaminc-protected-derive 0.10.0", "zeroize", ] @@ -3343,9 +3343,9 @@ dependencies = [ [[package]] name = "vitaminc-protected-derive" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4315341c559af17bd773e8b4e32125a2025d7fbe3e31cbae49120ee1dcab02e" +checksum = "32eb239bc9aae16ef0320076934f3f592606960d42d0b5fdadafc0298f635221" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -3370,16 +3370,16 @@ dependencies = [ [[package]] name = "vitaminc-random" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e32850b739b58a7064b50eb3db655de323f57f21c1fe74d5ccd4d308560563" +checksum = "fae7eccb46ddc6f199cf5c934469fd5b199514f42e11579c46882b784ed992c8" dependencies = [ "chacha20", "getrandom 0.4.2", "rand 0.10.1", "thiserror 2.0.18", - "vitaminc-protected 0.9.1", - "vitaminc-random-derives 0.9.0", + "vitaminc-protected 0.10.0", + "vitaminc-random-derives 0.10.0", "zeroize", ] @@ -3396,9 +3396,9 @@ dependencies = [ [[package]] name = "vitaminc-random-derives" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1863fe02de3945047dc9094d3cadbde06becafa49aa95d5e475bf903c8d83981" +checksum = "e48c940c93c9ddb04a66d81ca42ca574826ddbbeece6a7c87c5d1ab31893e692" dependencies = [ "proc-macro2", "quote", @@ -3423,17 +3423,17 @@ dependencies = [ [[package]] name = "vitaminc-traits" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a715ef503b1b41801a6c23e9756ed3d5a1201fa632609bccfa2a7a41ab5386cf" +checksum = "31fba5af175073f24768a8b06dd054ad696c7e6051dda1316c3814043a36d8e0" dependencies = [ "anyhow", "bytes", "rmp-serde", "serde", "thiserror 2.0.18", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.0", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", "zeroize", ] diff --git a/packages/stack-encrypt/CHANGELOG.md b/packages/stack-encrypt/CHANGELOG.md index ab867a88f6..e847512d50 100644 --- a/packages/stack-encrypt/CHANGELOG.md +++ b/packages/stack-encrypt/CHANGELOG.md @@ -176,6 +176,44 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 the result as before. `KeysetCipher::encrypt_tree` plans and seals in one call. +- **Stack Encrypt now uses vitaminc 0.10, clww-ore 0.8 and ore-rs 0.12.** + The two order scheme releases only move to vitaminc 0.10: no order term + changes. vitaminc 0.10 is a breaking release, and three of its changes + reach callers of this crate. + - **The `chrono` feature is now `jiff`.** vitaminc 0.10 takes dates and + timestamps from the `jiff` crate, because `chrono` is marked + unmaintained (RUSTSEC-2026-0543). To upgrade: + - Enable the `jiff` feature in place of `chrono`. + - Convert a `value::Date` to and from `jiff::civil::Date`, in place + of `chrono::NaiveDate`. Every jiff date converts. + - Convert a `value::Timestamp` to and from `jiff::Timestamp`, in + place of `chrono::DateTime`. `Timestamp::try_from` refuses one + instant: jiff 1.0.0 can make an instant up to one second before its + own `Timestamp::MIN` when it parses text with a UTC offset, and that + instant has no encoding. + - **Dates and timestamps must be in years -9999 to 9999.** The range + was years -262143 to 262142. The new range is jiff's, and every + language's binding uses it, so a value one binding encrypts, every + binding can decrypt. The exact limits: + - dates from `-009999-01-01` to `9999-12-31`; + - timestamps from `-009999-01-02T01:59:59Z` to + `9999-12-30T22:00:00.999999999Z`. + + Encrypting a date or timestamp outside the range is refused, and so is + building a `value::Date` or `value::Timestamp` outside it + (`RangeError::Date`, `RangeError::Timestamp`). The stored format is + unchanged: a value in range has the same ciphertext and the same terms + as before. A row stored earlier with a date or timestamp outside the + range still passes authentication, but no longer decrypts: its leaf + no longer reads, so it is refused as `Error::Aead`, the error a damaged + ciphertext gets. A clearer error needs a change in vitaminc, which + cipherstash/vitaminc#630 tracks. PostgreSQL's `date` and `timestamptz` + allow years after 9999, so check before you upgrade if you might have + stored one. + - **`RangeError::LeapSecond` is renamed `RangeError::Nanoseconds`.** + jiff has no leap seconds, so the error now says only what is wrong: + `Timestamp::new` was given nanoseconds of one second or more. + - **`target::ExpectedContext` is no longer part of the API** (#1488). It is the check that a `#[stash(context_field)]` record runs on decrypt: the stored context must equal the one the caller expects, if the caller diff --git a/packages/stack-encrypt/Cargo.toml b/packages/stack-encrypt/Cargo.toml index 759e430b9e..dd1a12f6da 100644 --- a/packages/stack-encrypt/Cargo.toml +++ b/packages/stack-encrypt/Cargo.toml @@ -97,9 +97,9 @@ serde_json = { workspace = true, features = ["float_roundtrip"] } thiserror = { workspace = true } uuid = { workspace = true } zeroize = { workspace = true } -# `value::{Date, Timestamp}` to and from chrono's types (the `chrono` +# `value::{Date, Timestamp}` to and from jiff's types (the `jiff` # feature), and `value::Decimal` to and from rust_decimal's (`rust_decimal`). -chrono = { version = "0.4.44", optional = true, default-features = false } +jiff = { version = "1.0.0", optional = true, default-features = false } rust_decimal = { version = "1", optional = true, default-features = false } [features] @@ -116,9 +116,9 @@ http = ["dep:stack-auth", "stack-auth/http", "stack-kms/http"] # the crate they come from is always built (the storage profile `OpaqueBlob` # uses lives there), so the feature adds no dependency. dynamic = [] -# Conversions between chrono's `NaiveDate` / `DateTime` and +# Conversions between jiff's `civil::Date` / `Timestamp` and # `value::Date` / `value::Timestamp`. -chrono = ["dep:chrono", "vitaminc-aead/chrono"] +jiff = ["dep:jiff", "vitaminc-aead/jiff"] # Conversions between rust_decimal's `Decimal` and `value::Decimal`. rust_decimal = ["dep:rust_decimal", "vitaminc-aead/rust_decimal"] # `stack_encrypt::kms::FakeDataKeySource`: the in-memory key source for tests diff --git a/packages/stack-encrypt/docs/adr/0013-a-json-document-is-one-text-leaf-of-its-json-text.md b/packages/stack-encrypt/docs/adr/0013-a-json-document-is-one-text-leaf-of-its-json-text.md index 6d6c689658..41faaf6368 100644 --- a/packages/stack-encrypt/docs/adr/0013-a-json-document-is-one-text-leaf-of-its-json-text.md +++ b/packages/stack-encrypt/docs/adr/0013-a-json-document-is-one-text-leaf-of-its-json-text.md @@ -106,7 +106,7 @@ that holds one ciphertext. `serde_json::Value` does not implement `Zeroize`, and Rust's orphan rule stops this crate adding it. `JsonPlaintext` holds the `Value` and wipes it -when it is dropped, as `value::Date` stands in for chrono's date. +when it is dropped, as `value::Date` stands in for jiff's date. ### An absent document is not a document diff --git a/packages/stack-encrypt/fuzz/Cargo.lock b/packages/stack-encrypt/fuzz/Cargo.lock index 62738e9405..dd789294c7 100644 --- a/packages/stack-encrypt/fuzz/Cargo.lock +++ b/packages/stack-encrypt/fuzz/Cargo.lock @@ -366,16 +366,16 @@ dependencies = [ [[package]] name = "clww-ore" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9527fcb65fbebc5a8f8987063c171bb37bb37fb628de1293e07c1b6e0a21a24f" +checksum = "0bf8966d3aa4130c1d5afd09de3be042765061879e8be0d5c156e9078b0148db" dependencies = [ "blake3", "hex", "subtle", "thiserror 1.0.69", "vitaminc-ore", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", "zeroize", ] @@ -1475,9 +1475,9 @@ dependencies = [ [[package]] name = "ore-rs" -version = "0.11.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b274b7a0bf081d51815ccc7b20fa3b023e5769e3446fe4de1e8e8044a4413201" +checksum = "eebac11f6f3ceaec9994a27b00666385301e6b650ba8973f852430b9f7bd4ba5" dependencies = [ "aes", "block-modes", @@ -1487,12 +1487,12 @@ dependencies = [ "rand 0.10.1", "subtle-ng", "thiserror 1.0.69", - "vitaminc-context 0.9.0", + "vitaminc-context 0.10.0", "vitaminc-hmac", "vitaminc-ore", "vitaminc-prf", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.0", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", "zeroize", ] @@ -2066,8 +2066,8 @@ dependencies = [ "tracing", "url", "uuid", - "vitaminc 0.9.0", - "vitaminc-protected 0.9.1", + "vitaminc 0.10.0", + "vitaminc-protected 0.10.0", "web-time", "zeroize", "zerokms-protocol", @@ -2092,15 +2092,15 @@ dependencies = [ "stack-kms", "thiserror 1.0.69", "uuid", - "vitaminc 0.9.0", - "vitaminc-aead 0.9.0", + "vitaminc 0.10.0", + "vitaminc-aead 0.10.0", "vitaminc-aead-frame", - "vitaminc-encrypt 0.9.0", + "vitaminc-encrypt 0.10.0", "vitaminc-hmac", "vitaminc-normalize", "vitaminc-ore", "vitaminc-prf", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", "zeroize", ] @@ -2122,8 +2122,8 @@ dependencies = [ "serde_json", "stack-encrypt", "uuid", - "vitaminc-aead 0.9.0", - "vitaminc-protected 0.9.1", + "vitaminc-aead 0.10.0", + "vitaminc-protected 0.10.0", ] [[package]] @@ -2148,8 +2148,8 @@ dependencies = [ "tracing", "url", "uuid", - "vitaminc 0.9.0", - "vitaminc-protected 0.9.1", + "vitaminc 0.10.0", + "vitaminc-protected 0.10.0", "zeroize", "zerokms-protocol", ] @@ -2595,16 +2595,16 @@ dependencies = [ [[package]] name = "vitaminc" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7aa53d696a9e1af61b36a60b92cc0dde7421f8f58787333d3c425a176af241c" +checksum = "60ae27c0d0e6980d2f30683384ed591a9dafa943b18faaa6bfb456757b5e10ef" dependencies = [ - "vitaminc-aead 0.9.0", - "vitaminc-context 0.9.0", - "vitaminc-encrypt 0.9.0", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.0", - "vitaminc-traits 0.9.0", + "vitaminc-aead 0.10.0", + "vitaminc-context 0.10.0", + "vitaminc-encrypt 0.10.0", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", + "vitaminc-traits 0.10.0", ] [[package]] @@ -2624,18 +2624,18 @@ dependencies = [ [[package]] name = "vitaminc-aead" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efba1dac1efc04ffc09cba49e343e0fe656c88c32472a4206f2a6df284add33d" +checksum = "6fcccedca9d80812af295cba43dc2ac388f4fbb0415faa3ebec783d072d014d8" dependencies = [ "bytes", "futures-util", "serde", "thiserror 2.0.18", - "vitaminc-aead-derive 0.9.0", - "vitaminc-context 0.9.0", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.0", + "vitaminc-aead-derive 0.10.0", + "vitaminc-context 0.10.0", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", "zeroize", ] @@ -2652,9 +2652,9 @@ dependencies = [ [[package]] name = "vitaminc-aead-derive" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3c6575dac7701e578b375d16a0b693294d73847ed275c9b9962cf20c423ea10" +checksum = "3de85a0ff50572db91a5528b72775f63d57a2b24b8263fb8e728baf6a7731502" dependencies = [ "proc-macro2", "quote", @@ -2663,13 +2663,13 @@ dependencies = [ [[package]] name = "vitaminc-aead-frame" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba4a3e8a2057ce32724b0d42f71e87ee348d13c818fc54a16c443b86c4fe8d9a" +checksum = "e858adec6cbbe353227dbff1876a426909a9e304fc996e0f706441dcd7eb9dac" dependencies = [ "serde", - "vitaminc-aead 0.9.0", - "vitaminc-protected 0.9.1", + "vitaminc-aead 0.10.0", + "vitaminc-protected 0.10.0", ] [[package]] @@ -2684,12 +2684,12 @@ dependencies = [ [[package]] name = "vitaminc-context" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b407b3127be198a8da7d4d914c11215e1eae1b467cdf89eca8a7a296055e863" +checksum = "431a7fb023688dba855e52b9c4e44c942418dde8ea08a2b115cf6a7f762fa5b9" dependencies = [ "mutants", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", ] [[package]] @@ -2708,72 +2708,72 @@ dependencies = [ [[package]] name = "vitaminc-encrypt" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fa0a3493624afd1490085448d6d09d22bf061954e9ab0db08837f423db3a58d" +checksum = "e68d89e2587529db55a10fa59cb11be8a7505b4af473c8a0bec238c803190ec5" dependencies = [ "aes-gcm", "aws-lc-rs", - "vitaminc-aead 0.9.0", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.0", + "vitaminc-aead 0.10.0", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", "zeroize", ] [[package]] name = "vitaminc-hmac" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ada61349172294efe0a71bf2af367969b4e196437b46c20c688aaf15f692bc2d" +checksum = "b031c7e62ab28f716df69c5e2137267c93e8d2aa36e4f31a12ac5b193baaa3d1" dependencies = [ "hmac", "sha2 0.11.0", "vitaminc-prf", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", "zeroize", ] [[package]] name = "vitaminc-normalize" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1d354f4ee3764be072eb02f4f8db79ed0ed467a7c6d9f2c6143823867bde347" +checksum = "e333da8bb30eab39cc2c790cb860843229a0a06aefb807f4ce069a92a2e17e8d" dependencies = [ "thiserror 2.0.18", "unicode-general-category", "unicode-normalization", - "vitaminc-aead 0.9.0", - "vitaminc-protected 0.9.1", + "vitaminc-aead 0.10.0", + "vitaminc-protected 0.10.0", ] [[package]] name = "vitaminc-ore" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a812b8e245352094c3c2113312cf86d0804b83f1e315bacd15571cd01703c8b" +checksum = "9a1d92d394e577ee424b4f35479a101896aecbce98f00c37bca5af1aa0d3b2c0" dependencies = [ "thiserror 2.0.18", "unicode-general-category", "unicode-normalization", - "vitaminc-aead 0.9.0", - "vitaminc-context 0.9.0", + "vitaminc-aead 0.10.0", + "vitaminc-context 0.10.0", "vitaminc-normalize", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", "zeroize", ] [[package]] name = "vitaminc-prf" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1703452d837ef964ec1f20cc601265857245d72ac14426276d49c3106dd39b3" +checksum = "078c13f43f5a9fefdd6f4cb337327a432b3b136c168f558fd525d1dd14685541" dependencies = [ "mutants", "thiserror 2.0.18", - "vitaminc-aead 0.9.0", - "vitaminc-context 0.9.0", + "vitaminc-aead 0.10.0", + "vitaminc-context 0.10.0", "vitaminc-normalize", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", ] [[package]] @@ -2795,9 +2795,9 @@ dependencies = [ [[package]] name = "vitaminc-protected" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67a44502e43de42fbd95c12a35efbaea903eedcc7a3922fceacea93054f44485" +checksum = "2153981f290343dffa8f618277c46a13b5a1e8131b4120760e9a1795ae1cb55b" dependencies = [ "bitvec", "digest 0.11.3", @@ -2806,7 +2806,7 @@ dependencies = [ "serde_bytes", "subtle", "thiserror 2.0.18", - "vitaminc-protected-derive 0.9.1", + "vitaminc-protected-derive 0.10.0", "zeroize", ] @@ -2823,9 +2823,9 @@ dependencies = [ [[package]] name = "vitaminc-protected-derive" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4315341c559af17bd773e8b4e32125a2025d7fbe3e31cbae49120ee1dcab02e" +checksum = "32eb239bc9aae16ef0320076934f3f592606960d42d0b5fdadafc0298f635221" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2850,16 +2850,16 @@ dependencies = [ [[package]] name = "vitaminc-random" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e32850b739b58a7064b50eb3db655de323f57f21c1fe74d5ccd4d308560563" +checksum = "fae7eccb46ddc6f199cf5c934469fd5b199514f42e11579c46882b784ed992c8" dependencies = [ "chacha20", "getrandom 0.4.2", "rand 0.10.1", "thiserror 2.0.18", - "vitaminc-protected 0.9.1", - "vitaminc-random-derives 0.9.0", + "vitaminc-protected 0.10.0", + "vitaminc-random-derives 0.10.0", "zeroize", ] @@ -2876,9 +2876,9 @@ dependencies = [ [[package]] name = "vitaminc-random-derives" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1863fe02de3945047dc9094d3cadbde06becafa49aa95d5e475bf903c8d83981" +checksum = "e48c940c93c9ddb04a66d81ca42ca574826ddbbeece6a7c87c5d1ab31893e692" dependencies = [ "proc-macro2", "quote", @@ -2903,17 +2903,17 @@ dependencies = [ [[package]] name = "vitaminc-traits" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a715ef503b1b41801a6c23e9756ed3d5a1201fa632609bccfa2a7a41ab5386cf" +checksum = "31fba5af175073f24768a8b06dd054ad696c7e6051dda1316c3814043a36d8e0" dependencies = [ "anyhow", "bytes", "rmp-serde", "serde", "thiserror 2.0.18", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.0", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", "zeroize", ] diff --git a/packages/stack-encrypt/fuzz/Cargo.toml b/packages/stack-encrypt/fuzz/Cargo.toml index dfbe55b4a8..f42b3cda9c 100644 --- a/packages/stack-encrypt/fuzz/Cargo.toml +++ b/packages/stack-encrypt/fuzz/Cargo.toml @@ -17,9 +17,9 @@ cargo-fuzz = true [dependencies] # `Controlled`, to take a passthrough node's frame out of its wrapper: the # same line stack-encrypt builds on. -vitaminc-protected = "0.9.1" +vitaminc-protected = "0.10.0" # The sinks the record harness writes its plans and passthroughs through. -vitaminc-aead = "0.9.0" +vitaminc-aead = "0.10.0" libfuzzer-sys = "0.4" # Structure-aware inputs for `check_record` and `plan_build`: the mirror # types derive `Arbitrary`, so the fuzzer mutates trees and plans, not bytes. diff --git a/packages/stack-encrypt/src/dynamic/record.rs b/packages/stack-encrypt/src/dynamic/record.rs index a01549a892..5b0dcc3304 100644 --- a/packages/stack-encrypt/src/dynamic/record.rs +++ b/packages/stack-encrypt/src/dynamic/record.rs @@ -8138,7 +8138,7 @@ mod tests { .expect("a map"); map.entry("id") .expect("an entry") - .passthrough(wide) + .passthrough(&wide) .expect("written"); map.end().expect("ended"); } diff --git a/packages/stack-encrypt/src/dynamic/term.rs b/packages/stack-encrypt/src/dynamic/term.rs index 0ebb31de91..0f10c6ef8d 100644 --- a/packages/stack-encrypt/src/dynamic/term.rs +++ b/packages/stack-encrypt/src/dynamic/term.rs @@ -41,7 +41,7 @@ use vitaminc_aead::plaintext::{ Error as SinkError, FixedType, Float, Int, Logical, MapSink, Physical, SeqSink, Sink, SourceError, }; -use vitaminc_aead::FromScalar; +use vitaminc_aead::{EncryptRef, FromScalar}; use vitaminc_normalize::{domain_of, normalize, NormalizeError}; use serde::{Deserialize, Serialize, Serializer}; @@ -772,7 +772,7 @@ where Err(Refused(None)) } - fn passthrough(self, _: P) -> Result { + fn passthrough(self, _: &P) -> Result { Err(Refused(None)) } } @@ -815,7 +815,7 @@ impl Sink for NoContainer { self.unreachable() } - fn passthrough(self, _: P) -> Result { + fn passthrough(self, _: &P) -> Result { self.unreachable() } } diff --git a/packages/stack-encrypt/src/dynamic/test_frame.rs b/packages/stack-encrypt/src/dynamic/test_frame.rs index 70162f9ff6..4b34a36bd7 100644 --- a/packages/stack-encrypt/src/dynamic/test_frame.rs +++ b/packages/stack-encrypt/src/dynamic/test_frame.rs @@ -12,7 +12,7 @@ use vitaminc_aead::plaintext::{ visit_map, visit_seq, Error as _, FixedType, Float, Int, Logical, MapSink, Physical, SeqSink, Sink, SourceError, }; -use vitaminc_aead::{to_frame, DecodeError, Decrypt, Encrypt, Frame}; +use vitaminc_aead::{to_frame, DecodeError, Decrypt, Encrypt, EncryptRef, Frame}; use vitaminc_protected::Controlled; /// A value as a test spells it: each scalar at its own width, a logical @@ -289,8 +289,8 @@ impl Sink for TreeSink { }) } - fn passthrough(self, value: P) -> Result { - let inner = value.visit(TreeSink(Root))?; + fn passthrough(self, value: &P) -> Result { + let inner = value.visit_ref(TreeSink(Root))?; Ok(self.0.put(Tree::Passthrough(Box::new(inner)))) } } diff --git a/packages/stack-encrypt/src/dynamic/value_frame.rs b/packages/stack-encrypt/src/dynamic/value_frame.rs index 7bb0e83da4..a86d126dc7 100644 --- a/packages/stack-encrypt/src/dynamic/value_frame.rs +++ b/packages/stack-encrypt/src/dynamic/value_frame.rs @@ -37,7 +37,7 @@ use vitaminc_aead::plaintext::{ Error as _, FixedType, Float, Int, Logical, MapSink, Physical, SeqSink, Sink, SourceError, TimeUnit, Width, }; -use vitaminc_aead::{DecodeError, Decrypt, Encrypt}; +use vitaminc_aead::{DecodeError, Decrypt, Encrypt, EncryptRef}; use vitaminc_protected::{ AsProtectedRef, Buffer, Controlled, Equatable, OpaqueDebug, Protected, ProtectedRef, TimingSafeEq, @@ -285,8 +285,8 @@ impl Sink for Check { Ok(Check) } - fn passthrough(self, value: P) -> Result<(), DecodeError> { - value.visit(Check) + fn passthrough(self, value: &P) -> Result<(), DecodeError> { + value.visit_ref(Check) } } @@ -606,10 +606,10 @@ impl<'o> Sink for Modeled> { } } - fn passthrough(self, value: P) -> Result<(), DecodeError> { + fn passthrough(self, value: &P) -> Result<(), DecodeError> { let Self { inner, field } = self; inner - .passthrough(ModeledSource(value)) + .passthrough(&ModeledSource(value)) .map_err(|error| Modeled { inner: (), field }.written(error)) } } @@ -670,12 +670,11 @@ impl MapSink for Modeled> { /// A passthrough subtree, walked through the value model too: what it /// carries is held to the same rules as what is sealed beside it. -#[derive(Clone)] -struct ModeledSource

(P); +struct ModeledSource<'a, P: ?Sized>(&'a P); -impl Encrypt for ModeledSource

{ +impl Encrypt for &ModeledSource<'_, P> { fn visit(self, sink: S) -> Result { - self.0.visit(ModelOnly(sink)) + self.0.visit_ref(ModelOnly(sink)) } } @@ -727,8 +726,8 @@ impl Sink for ModelOnly { }) } - fn passthrough(self, value: P) -> Result { - self.0.passthrough(ModeledSource(value)) + fn passthrough(self, value: &P) -> Result { + self.0.passthrough(&ModeledSource(value)) } } @@ -816,7 +815,7 @@ impl Sink for Split { Ok(Skip::ending(Parts::Map, false)) } - fn passthrough(self, _: P) -> Result { + fn passthrough(self, _: &P) -> Result { Ok(Parts::Passthrough) } } @@ -943,7 +942,7 @@ impl Sink for Opening { Ok(Children::new(true, join)) } - fn passthrough(self, value: P) -> Result { + fn passthrough(self, value: &P) -> Result { write(|writer| Modeled::new(writer).passthrough(value)) } } @@ -1034,7 +1033,7 @@ impl Sink for Skip { Ok(self) } - fn passthrough(self, _: P) -> Result { + fn passthrough(self, _: &P) -> Result { if self.refuse_passthrough { return Err(DecodeError::Expected("no passthrough")); } @@ -1103,7 +1102,7 @@ impl Sink for KindOf { Ok(Skip::ending(Some(ValueKind::Object), false)) } - fn passthrough(self, _: P) -> Result { + fn passthrough(self, _: &P) -> Result { Ok(None) } } @@ -1214,7 +1213,7 @@ impl Sink for RowsSink { Ok(RowMap::new(TopRow)) } - fn passthrough(self, _: P) -> Result { + fn passthrough(self, _: &P) -> Result { Ok(SourceRows::One(None)) } } @@ -1267,7 +1266,7 @@ impl<'s> Sink for RowSink<'s> { Ok(RowMap::new(self.0)) } - fn passthrough(self, _: P) -> Result<(), DecodeError> { + fn passthrough(self, _: &P) -> Result<(), DecodeError> { self.0.put(None); Ok(()) } @@ -1418,15 +1417,20 @@ mod tests { /// A null that says what it stands in for, as vitaminc walks a `None` /// of a fixed-width type and as a host may send one in a frame. - #[derive(Clone)] struct TypedNull(FixedType); - impl Encrypt for TypedNull { + impl Encrypt for &TypedNull { fn visit(self, sink: S) -> Result { sink.typed_null(self.0) } } + impl Encrypt for TypedNull { + fn visit(self, sink: S) -> Result { + (&self).visit(sink) + } + } + fn fixed(ty: Option, width: Width) -> FixedType { FixedType::new(ty, width).expect("a fixed-width type") } @@ -1724,12 +1728,11 @@ mod tests { } /// A value that travels as a passthrough subtree. - #[derive(Clone)] struct Hidden

(P); - impl Encrypt for Hidden

{ + impl Encrypt for Hidden

{ fn visit(self, sink: S) -> Result { - sink.passthrough(self.0) + sink.passthrough(&self.0) } } diff --git a/packages/stack-encrypt/src/value.rs b/packages/stack-encrypt/src/value.rs index 168f908aa2..56ec5ac491 100644 --- a/packages/stack-encrypt/src/value.rs +++ b/packages/stack-encrypt/src/value.rs @@ -2,40 +2,43 @@ //! and a decimal number, each held as the integers vitaminc's value model //! stores it as. //! -//! The types the ecosystem offers (chrono's `NaiveDate` and -//! `DateTime`, rust_decimal's `Decimal`) keep their fields private, -//! so their bytes cannot be wiped. A plaintext this crate copies, to seal -//! it or to derive a term from it, must be wiped when it is dropped, so -//! these types stand in for them. With the `chrono` and `rust_decimal` -//! features each converts to and from its ecosystem type. +//! The types the ecosystem offers (jiff's `civil::Date` and `Timestamp`, +//! rust_decimal's `Decimal`) keep their fields private, so their bytes +//! cannot be wiped. A plaintext this crate copies, to seal it or to derive +//! a term from it, must be wiped when it is dropped, so these types stand +//! in for them. With the `jiff` and `rust_decimal` features each converts +//! to and from its ecosystem type. //! -//! vitaminc-aead has a wipeable `Timestamp` of its own, and it is not -//! reused: this crate hands each term of a type its own copy of the -//! plaintext, so a target with several terms needs a `Clone` plaintext, -//! and vitaminc's type is deliberately not `Clone`. It is also built only -//! from a `DateTime`, which would make chrono a dependency of every -//! build. The types here are `Clone`, and a clone is wiped too. +//! vitaminc-aead has wipeable `Date`, `Timestamp` and `Decimal` types of +//! its own, and they are not reused: this crate hands each term of a type +//! its own copy of the plaintext, so a target with several terms needs a +//! `Clone` plaintext, and vitaminc's types are deliberately not `Clone`. +//! They are also built only from jiff's and rust_decimal's types, which +//! would make those crates a dependency of every build. The types here are +//! `Clone`, and a clone is wiped too. //! //! | Type | Holds | Range | //! |---|---|---| -//! | [`Date`] | an `i32` count of days since 1970-01-01, in the proleptic Gregorian calendar | years -262143 to 262142 | -//! | [`Timestamp`] | an `i64` count of seconds since the Unix epoch and a `u32` of nanoseconds below one second, UTC, with no leap seconds | years -262143 to 262142 | +//! | [`Date`] | an `i32` count of days since 1970-01-01, in the proleptic Gregorian calendar | `-009999-01-01` to `9999-12-31` | +//! | [`Timestamp`] | an `i64` count of seconds since the Unix epoch and a `u32` of nanoseconds below one second, UTC, with no leap seconds | `-009999-01-02T01:59:59Z` to `9999-12-30T22:00:00.999999999Z` | //! | [`Decimal`] | an `i128` mantissa and a `u8` scale: the value is `mantissa × 10^-scale` | scale at most 28, mantissa below 2^96 in magnitude | //! -//! The ranges are vitaminc's, which are chrono's and rust_decimal's: a -//! value outside them has no encoding and is refused when the type is -//! built, so a value of one of these types always encrypts. A refusal -//! ([`RangeError`]) names what was out of range, never the value. +//! The ranges are vitaminc's, which are jiff's and rust_decimal's. Every +//! language's binding uses the same ranges, so a value one binding +//! encrypts, every binding can decrypt. A value outside them has no +//! encoding and is refused when the type is built, so a value of one of +//! these types always encrypts. A refusal ([`RangeError`]) names what was +//! out of range, never the value. //! //! # What wiping covers //! //! Each type implements [`Zeroize`] and wipes its integers when it is //! dropped ([`ZeroizeOnDrop`]). That covers every owned copy this crate //! makes. The integer a value describes itself to vitaminc's sink with is a -//! `Copy` stack temporary, as it is for the primitive, chrono and +//! `Copy` stack temporary, as it is for the primitive, jiff and //! rust_decimal sources, and is not wiped. Nor is a value the caller builds -//! the type from, or converts it to: a `NaiveDate`, `DateTime` or -//! rust_decimal `Decimal` (with the `chrono` and `rust_decimal` features), +//! the type from, or converts it to: a jiff `civil::Date` or `Timestamp`, +//! or a rust_decimal `Decimal` (with the `jiff` and `rust_decimal` features), //! or the integers read through an accessor, are ordinary values the caller //! looks after. //! @@ -78,20 +81,20 @@ const NANOS_PER_SECOND: u32 = 1_000_000_000; #[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)] #[non_exhaustive] pub enum RangeError { - /// A day count outside chrono's date range, years -262143 to 262142. - #[error("the date is outside the representable range, years -262143 to 262142")] + /// A day count outside jiff's date range, `-009999-01-01` to + /// `9999-12-31`. + #[error("the date is outside the representable range, years -9999 to 9999")] Date, - /// An instant outside chrono's range, years -262143 to 262142. - #[error("the timestamp is outside the representable range, years -262143 to 262142")] - Timestamp, - /// Nanoseconds of one second or more: not a nanosecond field, and - /// chrono's representation of a leap second, which has no count of - /// seconds since the epoch. + /// An instant outside jiff's range, `-009999-01-02T01:59:59Z` to + /// `9999-12-30T22:00:00.999999999Z`. #[error( - "the timestamp's nanoseconds must be below one second (chrono holds a leap second \ - this way, and it has no encoding)" + "the timestamp is outside the representable range, -009999-01-02T01:59:59Z to 9999-12-30T22:00:00.999999999Z" )] - LeapSecond, + Timestamp, + /// Nanoseconds of one second or more, which are not a nanosecond + /// field. + #[error("the timestamp's nanoseconds must be below one second")] + Nanoseconds, /// A decimal scale above 28. #[error("the decimal's scale is above 28")] DecimalScale, @@ -104,8 +107,8 @@ pub enum RangeError { /// since 1970-01-01 in the proleptic Gregorian calendar. /// /// 1970-01-01 is day 0 and 1969-12-31 is day -1: the day count vitaminc's -/// value model stores a date as, and the one a `NaiveDate` converts to with -/// the `chrono` feature. See the [module documentation](self) for what +/// value model stores a date as, and the one a jiff `civil::Date` converts +/// to with the `jiff` feature. See the [module documentation](self) for what /// wiping covers. /// /// ``` @@ -125,7 +128,7 @@ impl Date { /// /// # Errors /// - /// [`RangeError::Date`] outside years -262143 to 262142. + /// [`RangeError::Date`] outside `-009999-01-01` to `9999-12-31`. pub fn from_days_since_epoch(days: i32) -> Result { Logical::Date .admits(&Physical::Int(Int::I32(days))) @@ -153,7 +156,7 @@ impl Date { /// /// let instant = Timestamp::new(1_700_000_000, 500)?; /// assert_eq!((instant.seconds(), instant.nanoseconds()), (1_700_000_000, 500)); -/// assert_eq!(Timestamp::new(0, 1_000_000_000).unwrap_err(), RangeError::LeapSecond); +/// assert_eq!(Timestamp::new(0, 1_000_000_000).unwrap_err(), RangeError::Nanoseconds); /// # Ok::<(), RangeError>(()) /// ``` #[derive(Clone)] @@ -169,11 +172,12 @@ impl Timestamp { /// /// # Errors /// - /// [`RangeError::LeapSecond`] for nanoseconds of one second or more, - /// and [`RangeError::Timestamp`] outside years -262143 to 262142. + /// [`RangeError::Nanoseconds`] for nanoseconds of one second or more, + /// and [`RangeError::Timestamp`] outside `-009999-01-02T01:59:59Z` to + /// `9999-12-30T22:00:00.999999999Z`. pub fn new(seconds: i64, nanoseconds: u32) -> Result { if nanoseconds >= NANOS_PER_SECOND { - return Err(RangeError::LeapSecond); + return Err(RangeError::Nanoseconds); } let instant = Self { seconds, @@ -197,7 +201,7 @@ impl Timestamp { } /// Nanoseconds since the epoch: the count vitaminc stores a timestamp - /// as, and the one a `DateTime` encrypts to, so the two seal the + /// as, and the one a jiff `Timestamp` encrypts to, so the two seal the /// same leaf. Cannot overflow: an `i64` of seconds times 10^9 is far /// inside an `i128`. fn count(&self) -> i128 { @@ -303,7 +307,7 @@ wiped!( ); /// Each type describes itself to vitaminc as the logical type over an int -/// it is, the same scalar the chrono and rust_decimal types describe, so a +/// it is, the same scalar the jiff and rust_decimal types describe, so a /// value converted from one of those seals the same leaf. The owned form /// visits through the borrowed one and is then dropped, and wiped. /// @@ -381,63 +385,67 @@ impl FromScalar for Decimal { } } -/// Conversions to and from chrono's `NaiveDate` and `DateTime`. The -/// ranges are the same (vitaminc pins them to chrono's), so only a leap -/// second, which a `DateTime` can hold and a [`Timestamp`] cannot, is -/// refused. The chrono value is outside this crate's care: it is not wiped. -#[cfg(feature = "chrono")] -mod chrono_conversions { +/// Conversions to and from jiff's `civil::Date` and `Timestamp`. The +/// ranges are the same (vitaminc pins them to jiff's), so every jiff date +/// converts. A jiff `Timestamp` converts unless it is the instant jiff +/// 1.0.0 can make up to a second before its own minimum, when it parses +/// text with a UTC offset; that one is refused. The jiff value is outside +/// this crate's care: it is not wiped. +#[cfg(feature = "jiff")] +mod jiff_conversions { use super::{Date, RangeError, Timestamp}; - use chrono::{DateTime, NaiveDate, Utc}; - use vitaminc_aead::plaintext::kinds::chrono as conv; + use jiff::civil::Date as CivilDate; + use vitaminc_aead::plaintext::kinds::jiff as conv; use vitaminc_aead::{Int, TimeUnit}; - impl From for Date { - /// Every `NaiveDate` is in range: chrono's range is the one a - /// `Date` checks. - fn from(date: NaiveDate) -> Self { + impl From for Date { + /// Every jiff date is in range: jiff's range is the one a `Date` + /// checks. + fn from(date: CivilDate) -> Self { Date { days: conv::date_days(date), } } } - impl From<&Date> for NaiveDate { + impl From<&Date> for CivilDate { #[allow( clippy::expect_used, - reason = "a Date is only built in chrono's NaiveDate range (from_days_since_epoch checks it, and From starts inside it), and chrono has no unchecked constructor" + reason = "a Date is only built in jiff's civil::Date range (from_days_since_epoch checks it, and From starts inside it), and jiff has no unchecked constructor" )] fn from(date: &Date) -> Self { - // A `Date` is only built in chrono's range, so the conversion + // A `Date` is only built in jiff's range, so the conversion // always succeeds. If the two ranges ever drifted apart, this // fails loudly rather than returning a wrong date. - conv::date(Int::I32(date.days)).expect("a Date is built in chrono's NaiveDate range") + conv::date(Int::I32(date.days)).expect("a Date is built in jiff's civil::Date range") } } - impl TryFrom> for Timestamp { + impl TryFrom for Timestamp { type Error = RangeError; /// # Errors /// - /// [`RangeError::LeapSecond`] for a leap second, which chrono holds - /// as nanoseconds of one second or more. - fn try_from(instant: DateTime) -> Result { - Timestamp::new(instant.timestamp(), instant.timestamp_subsec_nanos()) + /// [`RangeError::Timestamp`] for an instant before jiff's own + /// `Timestamp::MIN`. jiff 1.0.0 (jiff-core 1.0.0) can make one when + /// it parses text with a UTC offset. jiff 1.0.1 refuses that text. + fn try_from(instant: jiff::Timestamp) -> Result { + let nanos = conv::timestamp_nanos(instant).ok_or(RangeError::Timestamp)?; + Timestamp::from_nanos(nanos).ok_or(RangeError::Timestamp) } } - impl From<&Timestamp> for DateTime { + impl From<&Timestamp> for jiff::Timestamp { #[allow( clippy::expect_used, - reason = "a Timestamp is only built in chrono's DateTime range (Timestamp::new checks it), and chrono has no unchecked constructor" + reason = "a Timestamp is only built in jiff's Timestamp range (Timestamp::new checks it), and jiff has no unchecked constructor" )] fn from(instant: &Timestamp) -> Self { - // A `Timestamp` is only built in chrono's range. If the two + // A `Timestamp` is only built in jiff's range. If the two // ranges ever drifted apart, this fails loudly rather than // returning a wrong instant. conv::timestamp(TimeUnit::Nanos, Int::I128(instant.count())) - .expect("a Timestamp is built in chrono's DateTime range") + .expect("a Timestamp is built in jiff's Timestamp range") } } } @@ -508,7 +516,10 @@ mod tests { fn map(self, _: Option) -> Result { unreachable!("a plaintext here is a scalar") } - fn passthrough(self, _: P) -> Result { + fn passthrough( + self, + _: &P, + ) -> Result { unreachable!("a plaintext here is a scalar") } } @@ -548,7 +559,7 @@ mod tests { } #[test] - fn a_timestamp_is_its_nanosecond_count_and_refuses_a_leap_second() { + fn a_timestamp_is_its_nanosecond_count_and_refuses_a_whole_second_of_nanoseconds() { for (seconds, nanos) in [ (0, 0), (1_700_000_000, 123_456_789), @@ -573,11 +584,11 @@ mod tests { assert_eq!( Timestamp::new(0, 1_000_000_000).unwrap_err(), - RangeError::LeapSecond + RangeError::Nanoseconds ); assert_eq!( Timestamp::new(0, u32::MAX).unwrap_err(), - RangeError::LeapSecond + RangeError::Nanoseconds ); // The range's two edges, and one nanosecond past each. let edge = |nanos: i128| { @@ -713,64 +724,53 @@ mod tests { } } - #[cfg(feature = "chrono")] + #[cfg(feature = "jiff")] #[test] - fn chrono_values_convert_both_ways() { - use chrono::{DateTime, NaiveDate, Utc}; - - for date in [ - NaiveDate::from_ymd_opt(2024, 2, 29).unwrap(), - NaiveDate::from_ymd_opt(1969, 12, 31).unwrap(), - NaiveDate::from_ymd_opt(1, 1, 1).unwrap(), - NaiveDate::MIN, - NaiveDate::MAX, + fn jiff_values_convert_both_ways() { + use jiff::civil::{date, Date as CivilDate}; + + for day in [ + date(2024, 2, 29), + date(1969, 12, 31), + date(1, 1, 1), + CivilDate::MIN, + CivilDate::MAX, ] { - let ours = Date::from(date); - assert_eq!(NaiveDate::from(&ours), date); - // The same scalar chrono's own source describes. - assert_eq!(scalar(&ours), scalar(date)); + let ours = Date::from(day); + assert_eq!(CivilDate::from(&ours), day); + // The same scalar jiff's own source describes. + assert_eq!(scalar(&ours), scalar(day)); } - assert_eq!( - Date::from(NaiveDate::from_ymd_opt(1970, 1, 1).unwrap()).days_since_epoch(), - 0 - ); - // The ends of the range a `Date` checks are chrono's ends: if the + assert_eq!(Date::from(date(1970, 1, 1)).days_since_epoch(), 0); + // The ends of the range a `Date` checks are jiff's ends: if the // two drift apart, the `expect` in the conversion fires here. - for (days, date) in [ - (MIN_DATE_DAYS, NaiveDate::MIN), - (MAX_DATE_DAYS, NaiveDate::MAX), + for (days, day) in [ + (MIN_DATE_DAYS, CivilDate::MIN), + (MAX_DATE_DAYS, CivilDate::MAX), ] { let ours = Date::from_days_since_epoch(days).unwrap(); - assert_eq!(NaiveDate::from(&ours), date); + assert_eq!(CivilDate::from(&ours), day); } for instant in [ - DateTime::from_timestamp(1_700_000_000, 123_456_789).unwrap(), - DateTime::from_timestamp(-1, 1).unwrap(), - chrono::NaiveDateTime::MIN.and_utc(), - chrono::NaiveDateTime::MAX.and_utc(), + jiff::Timestamp::new(1_700_000_000, 123_456_789).unwrap(), + jiff::Timestamp::new(-1, 1).unwrap(), + jiff::Timestamp::MIN, + jiff::Timestamp::MAX, ] { let ours = Timestamp::try_from(instant).unwrap(); - assert_eq!(DateTime::::from(&ours), instant); + assert_eq!(jiff::Timestamp::from(&ours), instant); assert_eq!(scalar(&ours), scalar(instant)); } // The same for a `Timestamp`'s range. for (nanos, instant) in [ - (MIN_TIMESTAMP_NANOS, chrono::NaiveDateTime::MIN.and_utc()), - (MAX_TIMESTAMP_NANOS, chrono::NaiveDateTime::MAX.and_utc()), + (MIN_TIMESTAMP_NANOS, jiff::Timestamp::MIN), + (MAX_TIMESTAMP_NANOS, jiff::Timestamp::MAX), ] { let ours = read::(Logical::Timestamp(TimeUnit::Nanos), Int::I128(nanos)).unwrap(); - assert_eq!(DateTime::::from(&ours), instant); + assert_eq!(jiff::Timestamp::from(&ours), instant); } - let leap = NaiveDate::from_ymd_opt(2016, 12, 31) - .and_then(|d| d.and_hms_nano_opt(23, 59, 59, 1_500_000_000)) - .unwrap() - .and_utc(); - assert_eq!( - Timestamp::try_from(leap).unwrap_err(), - RangeError::LeapSecond - ); } #[cfg(feature = "rust_decimal")] diff --git a/packages/stack-encrypt/tests/roundtrip.rs b/packages/stack-encrypt/tests/roundtrip.rs index 134fa16c00..929c6c15f6 100644 --- a/packages/stack-encrypt/tests/roundtrip.rs +++ b/packages/stack-encrypt/tests/roundtrip.rs @@ -321,9 +321,9 @@ impl Row { impl Encrypt for Row { fn visit(self, sink: S) -> Result { let mut map = sink.map(None)?; - map.entry("id")?.passthrough(self.id)?; + map.entry("id")?.passthrough(&self.id)?; if self.repeat_id { - map.entry("id")?.passthrough(self.id)?; + map.entry("id")?.passthrough(&self.id)?; } self.email.visit(map.entry("email")?)?; map.end() diff --git a/packages/stack-encrypt/tests/ui/plaintext_needs_encrypt.stderr b/packages/stack-encrypt/tests/ui/plaintext_needs_encrypt.stderr index 5d5f0861b5..ac45573e5e 100644 --- a/packages/stack-encrypt/tests/ui/plaintext_needs_encrypt.stderr +++ b/packages/stack-encrypt/tests/ui/plaintext_needs_encrypt.stderr @@ -23,14 +23,14 @@ note: there are multiple different versions of crate `vitaminc_aead` in the depe | ----------------- this is the trait that was imported = help: you can use `cargo tree` to explore your dependency tree = help: the following other types implement trait `stack_encrypt::Encrypt`: - &&'b T - &'a BTreeMap - &'a HashMap - &'a Protected - &'a Vec - &'a [T] - &'a std::option::Option + &&T + &BTreeMap + &HashMap &JsonPlaintext + &Lent<'_, T> + &PassthroughFrame + &Protected + &ProtectedRef<'_, T> and $N others = note: required for `CipherText` to implement `EncryptFrom` = note: 1 redundant requirement hidden diff --git a/packages/stack-encrypt/tests/ui/struct_field_must_open.stderr b/packages/stack-encrypt/tests/ui/struct_field_must_open.stderr index 754be4badf..0675cd3037 100644 --- a/packages/stack-encrypt/tests/ui/struct_field_must_open.stderr +++ b/packages/stack-encrypt/tests/ui/struct_field_must_open.stderr @@ -14,10 +14,10 @@ help: the trait `FromScalar` is not implemented for `Name` Vec [u8; N] bool - chrono::datetime::DateTime - chrono::naive::date::NaiveDate f32 f64 + i128 + i16 and $N others = note: required for `Name` to implement `Decrypt` = note: required for `CipherText` to implement `DecryptInto` diff --git a/packages/stack-guest-abi/src/value.rs b/packages/stack-guest-abi/src/value.rs index 7da2ff5423..0a22a7e75e 100644 --- a/packages/stack-guest-abi/src/value.rs +++ b/packages/stack-guest-abi/src/value.rs @@ -253,7 +253,10 @@ impl Sink for ValueSink { } /// A guest never hands its host a passthrough. - fn passthrough(self, _: P) -> Result { + fn passthrough( + self, + _: &P, + ) -> Result { Err(DecodeError::Scalar) } } diff --git a/packages/stack-kms/fuzz/Cargo.lock b/packages/stack-kms/fuzz/Cargo.lock index 72a47d8baf..7357316e4f 100644 --- a/packages/stack-kms/fuzz/Cargo.lock +++ b/packages/stack-kms/fuzz/Cargo.lock @@ -1964,8 +1964,8 @@ dependencies = [ "tracing", "url", "uuid", - "vitaminc 0.9.0", - "vitaminc-protected 0.9.1", + "vitaminc 0.10.0", + "vitaminc-protected 0.10.0", "web-time", "zeroize", "zerokms-protocol", @@ -1992,8 +1992,8 @@ dependencies = [ "tracing", "url", "uuid", - "vitaminc 0.9.0", - "vitaminc-protected 0.9.1", + "vitaminc 0.10.0", + "vitaminc-protected 0.10.0", "zeroize", "zerokms-protocol", ] @@ -2412,16 +2412,16 @@ dependencies = [ [[package]] name = "vitaminc" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7aa53d696a9e1af61b36a60b92cc0dde7421f8f58787333d3c425a176af241c" +checksum = "60ae27c0d0e6980d2f30683384ed591a9dafa943b18faaa6bfb456757b5e10ef" dependencies = [ - "vitaminc-aead 0.9.0", - "vitaminc-context 0.9.0", - "vitaminc-encrypt 0.9.0", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.0", - "vitaminc-traits 0.9.0", + "vitaminc-aead 0.10.0", + "vitaminc-context 0.10.0", + "vitaminc-encrypt 0.10.0", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", + "vitaminc-traits 0.10.0", ] [[package]] @@ -2441,18 +2441,18 @@ dependencies = [ [[package]] name = "vitaminc-aead" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efba1dac1efc04ffc09cba49e343e0fe656c88c32472a4206f2a6df284add33d" +checksum = "6fcccedca9d80812af295cba43dc2ac388f4fbb0415faa3ebec783d072d014d8" dependencies = [ "bytes", "futures-util", "serde", "thiserror 2.0.18", - "vitaminc-aead-derive 0.9.0", - "vitaminc-context 0.9.0", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.0", + "vitaminc-aead-derive 0.10.0", + "vitaminc-context 0.10.0", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", "zeroize", ] @@ -2469,9 +2469,9 @@ dependencies = [ [[package]] name = "vitaminc-aead-derive" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3c6575dac7701e578b375d16a0b693294d73847ed275c9b9962cf20c423ea10" +checksum = "3de85a0ff50572db91a5528b72775f63d57a2b24b8263fb8e728baf6a7731502" dependencies = [ "proc-macro2", "quote", @@ -2490,12 +2490,12 @@ dependencies = [ [[package]] name = "vitaminc-context" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b407b3127be198a8da7d4d914c11215e1eae1b467cdf89eca8a7a296055e863" +checksum = "431a7fb023688dba855e52b9c4e44c942418dde8ea08a2b115cf6a7f762fa5b9" dependencies = [ "mutants", - "vitaminc-protected 0.9.1", + "vitaminc-protected 0.10.0", ] [[package]] @@ -2514,15 +2514,15 @@ dependencies = [ [[package]] name = "vitaminc-encrypt" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fa0a3493624afd1490085448d6d09d22bf061954e9ab0db08837f423db3a58d" +checksum = "e68d89e2587529db55a10fa59cb11be8a7505b4af473c8a0bec238c803190ec5" dependencies = [ "aes-gcm", "aws-lc-rs", - "vitaminc-aead 0.9.0", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.0", + "vitaminc-aead 0.10.0", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", "zeroize", ] @@ -2545,9 +2545,9 @@ dependencies = [ [[package]] name = "vitaminc-protected" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67a44502e43de42fbd95c12a35efbaea903eedcc7a3922fceacea93054f44485" +checksum = "2153981f290343dffa8f618277c46a13b5a1e8131b4120760e9a1795ae1cb55b" dependencies = [ "bitvec", "digest 0.11.3", @@ -2556,7 +2556,7 @@ dependencies = [ "serde_bytes", "subtle", "thiserror 2.0.18", - "vitaminc-protected-derive 0.9.1", + "vitaminc-protected-derive 0.10.0", "zeroize", ] @@ -2573,9 +2573,9 @@ dependencies = [ [[package]] name = "vitaminc-protected-derive" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4315341c559af17bd773e8b4e32125a2025d7fbe3e31cbae49120ee1dcab02e" +checksum = "32eb239bc9aae16ef0320076934f3f592606960d42d0b5fdadafc0298f635221" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2600,16 +2600,16 @@ dependencies = [ [[package]] name = "vitaminc-random" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71e32850b739b58a7064b50eb3db655de323f57f21c1fe74d5ccd4d308560563" +checksum = "fae7eccb46ddc6f199cf5c934469fd5b199514f42e11579c46882b784ed992c8" dependencies = [ "chacha20", "getrandom 0.4.2", "rand 0.10.1", "thiserror 2.0.18", - "vitaminc-protected 0.9.1", - "vitaminc-random-derives 0.9.0", + "vitaminc-protected 0.10.0", + "vitaminc-random-derives 0.10.0", "zeroize", ] @@ -2626,9 +2626,9 @@ dependencies = [ [[package]] name = "vitaminc-random-derives" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1863fe02de3945047dc9094d3cadbde06becafa49aa95d5e475bf903c8d83981" +checksum = "e48c940c93c9ddb04a66d81ca42ca574826ddbbeece6a7c87c5d1ab31893e692" dependencies = [ "proc-macro2", "quote", @@ -2653,17 +2653,17 @@ dependencies = [ [[package]] name = "vitaminc-traits" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a715ef503b1b41801a6c23e9756ed3d5a1201fa632609bccfa2a7a41ab5386cf" +checksum = "31fba5af175073f24768a8b06dd054ad696c7e6051dda1316c3814043a36d8e0" dependencies = [ "anyhow", "bytes", "rmp-serde", "serde", "thiserror 2.0.18", - "vitaminc-protected 0.9.1", - "vitaminc-random 0.9.0", + "vitaminc-protected 0.10.0", + "vitaminc-random 0.10.0", "zeroize", ]