fix(train): no row's ID tells the instance a date: the days' IDs are keyed by the account (ADR 0030, D57)

A day's, night's and heart chunk's ID was a UUID of version 5 of the
person and the date, which the instance can hash for every date itself:
each ID told it which days the band was worn. halkyon_keys' keyedRowId
hashes the name under the account's X25519 secret key (BLAKE2b, a UUID of
version 8), the same on every device of the account and unreadable
without its keys; ContentCipher.rowId and TrainKeys.rowId hand it on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-30 16:12:00 +01:00
commit 839d49c4cc
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -92,6 +92,26 @@ void main() {
expect(device.unseal(sealed, context: context), plain);
});
test(
"a row's keyed ID (ADR 0030, D57) is the same on every device of the "
"account, another on another account's, and none before unlocking",
() async {
final other = SodiumContentCipher();
await other.unlock(alice);
addTearDown(other.dispose);
final bobs = SodiumContentCipher();
await bobs.unlock(bob);
addTearDown(bobs.dispose);
final locked = SodiumContentCipher();
final id = device.rowId('train/day/2026-10-30');
expect(other.rowId('train/day/2026-10-30'), id);
expect(bobs.rowId('train/day/2026-10-30'), isNot(id));
expect(device.rowId('train/day/2026-10-31'), isNot(id));
expect(() => locked.rowId('train/day/2026-10-30'), throwsStateError);
},
);
test('without its key nothing opens, nor is sealed', () {
final sealed = SealedPayload(
keyId: 'unknown',