Skip to content

bothy 0.2.0: encryption, conflict log, Flutter

Choose a tag to compare

@alitalhq alitalhq released this 22 Oct 19:14
· 26 commits to main since this release
ebba5c6

Encryption, the conflict log and the Flutter binding. On-remote format still
bothy_format = 1: encrypted files use the encrypted flag that format 1 reserved, and
key files are new files that 0.1 readers ignore.

Added

  • Client-side encryption (crypto feature, on by default): XChaCha20-Poly1305 for segment
    bodies, snapshot chunks and device.json, with a random data key wrapped under an
    Argon2id-derived key in per-device key files (keys/<device>/key-<hlc>.json).
  • Config::encrypt, Config::password, Config::key and Config::kdf_cost;
    Database::{is_encrypted, is_locked, unlock, unlock_with_key, lock, export_key, change_password}, mirrored in the blocking API. A password unlocks offline from the cached
    key file.
  • Password change re-wraps the data key; the old password stops working on every device and
    SyncReport::password_changed reports it. Cached data keys keep working.
  • ErrorKind::KeyRequired for syncing a locked database.
  • Conflict log across the database: Database::conflicts(since_ms) and clear_conflicts(),
    Config::conflict_log(limit) (default 1,000 records, None turns logging off), and the
    CLI command bothy conflicts [--since <duration|date>] [--clear]. Conflict now carries
    the collection, document id and the time it was recorded, and is #[non_exhaustive].
  • CLI: init --encrypt, unlock [--remember], lock, passwd, --remember on init and
    join, the global --password-stdin flag, and BOTHY_PASSWORD / BOTHY_NEW_PASSWORD.
    status shows whether the database is encrypted and locked.
  • CLI: bothy inspect scan <text>... downloads every remote file of the database and fails
    if any contains the text, to check that an encrypted database leaks nothing.
  • Conformance vectors for the crypto primitives and encrypted segments and snapshots; a fuzz
    target for key files and sealed JSON; encrypted seeds in the simulation.

Changed

  • A segment with the encrypted flag and no key now fails with KeyRequired instead of
    FormatTooNew (vector segment/invalid.json, case encrypted_without_key).

Fixed

  • On Android the Drive backend verifies TLS against the Mozilla root store (webpki-roots);
    the platform verifier needs JNI setup there and panicked on the first request.

Packages

Full changelog: v0.1.0...v0.2.0