[package] name = "cotton-core" version = "0.1.0" edition.workspace = true license.workspace = true publish.workspace = true description = "CottonDB's domain engines: pure functions over values, ported from packages/core/src." [dependencies] # A lab report's PDF read for its text and where each glyph stands # (`health::lab::pdf`): pure Rust, no system library, so the Mac's import # and a phone's "add a report" (iPhone and Android) read a PDF the same way. # `lopdf` parses the file; the page's drawing is interpreted in # `health::lab::pdf` itself (pdf-extract misplaced text drawn under stacked # matrices and panicked on some fonts). lopdf = { version = "=0.42.0", optional = true, default-features = false, features = ["wasm_js"] } cotton-rules = { path = "../cotton-rules" } cotton-store = { path = "../cotton-store" } serde.workspace = true serde_json.workspace = true serde_path_to_error = "0.1" thiserror.workspace = true # `embedChunkSha` is the chunker's half of the `_embeddings.content_sha` # contract (sha256 over the chunk's UTF-8 bytes, first 32 hex). The store's own # `digest32` is `pub(crate)`, so the hash is computed here. sha2.workspace = true hex.workspace = true chrono = { version = "0.4", default-features = false, features = ["std", "clock", "alloc", "serde"] } chrono-tz = "0.10" # The engines port a great many small JavaScript regexes. `(?-u:\b)` gives the # ASCII word boundary JS uses without the `u` flag, so the two agree on where a # word ends next to a non-ASCII character. regex = "1" # `mintMemorySlug` calls `String.prototype.normalize("NFKD")` before it # kebab-cases, so an accented title loses its marks rather than its letters. unicode-normalization = "0.1" # ICU collation preserves the English localeCompare order in person pickers. icu_collator = "2.1" # THE PICKER AND NUMBERS (lane T1, 22 Oct 2026): a line whose path ends in # `.one` / `.other` is chosen by its count through CLDR plural rules, and a # number is grouped by CLDR decimal symbols; `iso_currency` carries each # currency's minor digits and symbol so no code holds a table of them. icu_plurals = "2.1" icu_decimal = { version = "2.1", features = ["alloc"] } iso_currency = "0.5" icu_locale_core = "2.1" # `zip.ts` inflates with fflate. `miniz_oxide` is the pure-Rust DEFLATE # decoder (it is what `flate2`'s default backend is), and it is taken here # WITHOUT flate2 on purpose: `decompress_to_vec` is a function from bytes to # bytes, so the port needs no `std::io::Read` wrapper and this crate's "no I/O" # law stays literally true. `_with_limit` is the entry point used, because an # archive a stranger sent must not be able to ask for unbounded memory. miniz_oxide = "0.8" # An EPUB's two XML documents (`media::book_file`): the container names the # package, the package says the book's title, author, language, ISBN and # cover. Already in the workspace lock (cotton-mac's), pure Rust, no I/O. quick-xml = "0.41" # THE VAULT (`src/vault/`, spec 2026-09-13). Envelope encryption over a # person's passwords: X25519 to agree a key with a device, HKDF-SHA256 to derive # one from it, AES-256-GCM to seal, and bech32 to read the age recovery key # `cotton-client` already mints. Every one of these is already in the workspace # lock and in the Mac's graph; `x25519-dalek` is the only one that is NEW to a # PHONE, and it is new on purpose — the phone mints its own vault key and # unwraps its own copy of the master key, which is the whole of what # "device-bound" means (`cotton-ffi/tests/phone_boundary.rs` says so where the # ban used to be). x25519-dalek = "2" hkdf = "0.12" # THE c2 BOX (`chat::ratchet`, SEALING.md): Olm, a triple # Diffie-Hellman first message and a Double Ratchet per pair of devices, from # the Matrix team's audited Rust crate rather than a ratchet of our own. # `libolm-compat` (the C library's pickles) is not needed; the session's own # serde pickle is what the ratchet file keeps. vodozemac = { version = "=0.11.2", default-features = false } # The recovery code's stretch (`vault::recovery_code`): already the workspace's (the Google token store). scrypt.workspace = true aes-gcm.workspace = true # THE OAUTH TOKEN'S MAC (`src/vault/tokens.rs`). A `cta_`/`ctr_` is signed # under a key HKDF derives from the same master key, so every Mac of a # household verifies one and none of them stores it. `subtle` is the # constant-time compare of the tag — a byte-by-byte `==` on a MAC is a timing # oracle that tells a forger how far it got. hmac.workspace = true # A one-time code (`keys::totp`): RFC 6238 names HMAC-SHA1 as the default every # authenticator uses. Already in the lock (cotton-ffi, cotton-mac). sha1 = "0.10" subtle.workspace = true bech32 = "0.11" # The ephemeral scalar of a wrap, the nonce of a seal and the master key itself. # Every call site that reaches for it has a `*_with` sibling taking the bytes, # so nothing under test depends on an entropy pool. rand.workspace = true # The master key, the private scalars and the derived keys are wiped on the way # out rather than left on a stack for whatever reads it next. zeroize = { version = "1", features = ["derive"] } base64.workspace = true # A backup file (`backup::file`) is deflated before it is sealed: a phone's database is mostly text, and Android # keeps at most 25 MB of an app's files in the Google account. Already the workspace's (cotton-client). flate2.workspace = true ed25519-dalek.workspace = true # A passkey's key pair (`keys::passkey`): ES256 is ECDSA over P-256, signed # RFC 6979 and handed back DER, as WebAuthn wants. Already the workspace's. p256.workspace = true # A passkey handed over in PKCS#8 (`keys::passkey::from_pkcs8`, Credential # Exchange): the SEC1 `ECPrivateKey` inside is read here so a public key that # does not match its private half is refused in words. p256 already pulls it in. sec1 = { version = "0.7", default-features = false, features = ["der"] } # `signedPath` is `new URL(x).pathname + .search`, and the string it returns is # SIGNED: dot segments resolved, non-ASCII percent-encoded, a bare `?` dropped. # Hand-rolled string surgery would diverge from the phone's answer on exactly # those, and a device would be refused rather than told why. url.workspace = true [dev-dependencies] # A passkey's COSE key and attestation object are read back by a CBOR parser # that is not this crate's own (`keys::passkey` tests), so a mistake in our # encoder cannot agree with itself. ciborium = "0.2" # The RECOVERY KEY's round trip, and only that. `vault::recovery` parses age's # own bech32 formats with the `bech32` crate rather than linking age, because a # phone has no business carrying an encryption container it never opens — but a # test that generated its own key by hand would be a test of this crate's idea # of the format rather than of age's. So the vectors are generated BY age, in # the test, and never committed: a real recovery key in a public tree is the # whole vault. age = { version = "0.12", default-features = false } secrecy = "0.10" # The sharing membership function is driver-in: `sharing::scopes::ScopeDriver` # is the pure seam the library ships, and the TESTS drive it against a REAL # in-memory file built from `cotton-store`'s own generated `SCHEMA_DDL`. A hand # rolled fake would be a second answer to "what shape is this table", and the # suite would keep passing after the shape changed under it. The library itself # still opens nothing — this dependency is `[dev-dependencies]` on purpose, and # rusqlite is already compiled for `cotton-store`. rusqlite.workspace = true # The store with its test-only constructors on, so a test can hand a key builder # a `FileId` and a derive a `Namespace` without opening a file for each. cotton-store = { path = "../cotton-store", features = ["test-template"] } [build-dependencies] sha2.workspace = true serde_json.workspace = true [features] # Read a lab report's PDF (`health::lab::pdf`). lab-pdf = ["dep:lopdf"]