Expand description
Metadata and encryption key management for password-protected Turso indexes
using companion *.cscidxmeta files.
Structs§
- FsIndex
Meta - Metadata stored in companion
*.cscidxmetafiles for password-protected indexes. - Index
KekParams - Parameters for Argon2id key derivation stored in
*.cscidxmeta.
Functions§
- acquire_
password - Securely acquires a password from CLI flags, environment variable, or terminal prompt.
- create_
encrypted_ index_ meta - Securely generates a new random DEK, derives an Argon2id KEK from the password, wraps the DEK under AES-256-GCM, and returns both the metadata structure and raw DEK.
- find_
meta_ path - Discovers an existing *.cscidxmeta file for the database.
Checks the standard
<stem>.cscidxmetafirst, then<db_path>.cscidxmeta. - is_
database_ encrypted - Inspects the first 5 bytes of a file to check if it matches Turso’s encrypted
page header (
b"Turso"). Returns false if the file does not exist or has fewer than 5 bytes. - load_
index_ meta - Loads and parses index metadata from the specified path.
- open_
index_ database - Opens or creates a Turso SQLite database, automatically detecting whether
encryption is present or requested, loading companion
*.cscidxmetametadata, and configuring page-level AEAD encryption. - resolve_
meta_ path - Computes the expected companion *.cscidxmeta path for a given database path.
E.g.
foo.cscindex.sqlite->foo.cscidxmeta,bar.db->bar.cscidxmeta. - save_
index_ meta - Saves index metadata as formatted JSON to the specified path.
- unlock_
index_ dek - Derives the KEK from the password using the salt and parameters stored in
meta, then unwraps and authenticates the DEK using AES-256-GCM.