Skip to content

miniproto.session.storage.EncryptedSQLiteSessionStorage

miniproto.session.storage.EncryptedSQLiteSessionStorage

Section titled “miniproto.session.storage.EncryptedSQLiteSessionStorage”
EncryptedSQLiteSessionStorage(path: str | os.PathLike[str], key: bytes | str | None = None) -> None

Thread-safe SQLite persistence with per-domain authenticated encryption.

Encryption and MAC keys derive from supplied key material. Reads and writes run off the event loop, while SQLite BEGIN IMMEDIATE serializes mutations. Legacy single-record payloads migrate to independently encrypted domains on the next replacement or mutation.

Open a lazy encrypted database using explicit or environment key material.

Parameters:

  • path (str | PathLike[str]) – SQLite database path created lazily on first write.
  • key (bytes | str | None) – Secret bytes/text, or None to read MINIPROTO_SESSION_KEY.

Raises:

  • ValueError – If no key is supplied or its material is under 16 bytes.