trackslash
VAULT-42 P2

Encryption 3: add the in-memory record store

0
Sub-issue of VAULT-22 P2 Add an optional password to the app lock

Description

Sub-issue 3 of the on-device encryption design (VAULT-26, docs/on-device-encryption.md).

The change:

  • Add a RecordVaultStore that implements every vault store protocol over VaultRecords, held in memory.
  • Turn the existing store test suite into a contract suite that runs against both the SwiftData store and the record store.
  • Add a differential test that runs random sequences of operations on both stores and checks they return the same results.

Behaviour: none changes; the store isn't wired into the app yet.

Linked issues

0

GitHub

0

No branches or pull requests linked.

Comments

1
Bradley

Fixed in https://github.com/badbundle/vault-app/pull/625 (merged as 736be18f).

  • RecordVaultStore: an in-memory store over VaultRecords that implements every vault store protocol and matches the SwiftData store's behaviour, including its quirks. Every operation builds the new state before swapping it in, so a failure changes nothing. It isn't wired into the app yet.
  • Contract suite: the old PersistedLocalVaultStoreTests is now VaultStoreContractTests, with 118 tests that run against SwiftData in memory, SwiftData on SQLite (the setup the app actually uses) and the record store.
  • Differential test: 80 seeded random operation sequences, compared after every step across both engines.
  • Bug found: the differential test caught a real bug in today's store, fixed in the same PR as VAULT-56. It also found a non-atomic override import, filed as VAULT-57.