Files
SeedPass/js/packages/test-vectors/fixtures/entry_mods.json
T
thePR0M3TH3ANandClaude Opus 5 e3b1325a2b fix(vault): entry ids are never reused -- allocate from a persisted watermark
An entry id doubles as the BIP-85 derivation index for managed_account and
seed entries, which makes it a permanent cryptographic coordinate: "Alice is
account #184" is a recovery claim, and #184 must mean Alice forever. But both
implementations allocated ids as max(live ids)+1, and sync deletion removes
entries via tombstones -- so deleting #184 on one device let the next
creation reissue #184 to a NEW entry, which then re-derived the departed
identity's exact child seed and npub. Tombstone retention (capped at 2048)
made even the evidence expire.

Allocation now comes from a high-watermark persisted in _sync_meta.next_index:
never-decreasing, bumped on every insert/save (explicit-id inserts included),
merged as max(both sides' watermarks, one past any merged entry or tombstone
id), and identical in both implementations -- the merge computation must stay
byte-for-byte the same in sync_conflict.py and sync/merge.ts. _sync_meta was
chosen because both sides already round-trip it (it carries the tombstones),
so old builds preserve the field and no schema version bump is needed.
Legacy vaults heal on their next allocation: the floor folds in tombstone ids
still within retention, and the first save persists the watermark.

Python-side key parsing mirrors the TS regex exactly (ASCII digits, no
leading zeros, JS safe-integer range): str.isdigit() alone accepts Unicode
digits that Number() rejects, which would have made the two implementations
compute different watermarks from the same payload.

Fixtures regenerated from Python; the byte-for-byte entry-creation parity
test now passes with the watermark present, proving TS's insert-time bump
and Python's save-time bump converge on identical indexes. Verified: the
recycle regression tests fail on both pre-fix implementations; 1180 Python,
224 core, 149 CLI tests and all 36 cross-impl checks pass with the fix.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Tkj4rzKBA3uhfgk7kqjsb8
2026-08-18 13:11:50 -04:00

190 lines
5.0 KiB
JSON

{
"description": "Entries index after a modification sequence (modify_entry, archive/restore, add_link/remove_link) applied by the real EntryManager at MOD_UNIX. TS replays the same ops from the creation state and must match.",
"entries": {
"_sync_meta": {
"next_index": 10
},
"entries": {
"0": {
"archived": false,
"custom_fields": [],
"date_added": "2023-11-14T22:13:20+00:00",
"date_modified": "2023-11-14T22:15:00+00:00",
"gen_version": 2,
"kind": "password",
"label": "example.com",
"length": 16,
"links": [
{
"note": "2fa for site",
"relation": "totp",
"target_id": 1
}
],
"modified_ts": 1700000100,
"notes": "updated note",
"policy": {
"min_digits": 3,
"special_mode": "safe"
},
"tags": [
"web",
"prod"
],
"type": "password",
"url": "https://example.org",
"username": "alice2"
},
"1": {
"archived": false,
"date_added": "2023-11-14T22:13:20+00:00",
"date_modified": "2023-11-14T22:15:00+00:00",
"deterministic": true,
"digits": 8,
"index": 0,
"kind": "totp",
"label": "example-totp",
"links": [],
"modified_ts": 1700000100,
"notes": "",
"period": 60,
"tags": [
"otp"
],
"type": "totp"
},
"2": {
"archived": false,
"date_added": "2023-11-14T22:13:20+00:00",
"date_modified": "2023-11-14T22:13:20+00:00",
"deterministic": false,
"digits": 8,
"kind": "totp",
"label": "imported-totp",
"links": [],
"modified_ts": 1700000000,
"notes": "",
"period": 45,
"secret": "JBSWY3DPEHPK3PXP",
"tags": [],
"type": "totp"
},
"3": {
"archived": true,
"custom_fields": [],
"date_added": "2023-11-14T22:13:20+00:00",
"date_modified": "2023-11-14T22:15:00+00:00",
"index": 3,
"kind": "ssh",
"label": "example-ssh",
"links": [],
"modified_ts": 1700000100,
"notes": "ssh note",
"tags": [],
"type": "ssh"
},
"4": {
"archived": false,
"date_added": "2023-11-14T22:13:20+00:00",
"date_modified": "2023-11-14T22:13:20+00:00",
"index": 4,
"kind": "nostr",
"label": "example-nostr",
"links": [],
"modified_ts": 1700000000,
"notes": "",
"tags": [],
"type": "nostr"
},
"5": {
"archived": false,
"custom_fields": [],
"date_added": "2023-11-14T22:13:20+00:00",
"date_modified": "2023-11-14T22:15:00+00:00",
"key": "token",
"kind": "key_value",
"label": "api-token-renamed",
"links": [
{
"note": "",
"relation": "related_to",
"target_id": 0
}
],
"modified_ts": 1700000100,
"notes": "",
"tags": [
"api"
],
"type": "key_value",
"value": "rotated-value"
},
"6": {
"archived": false,
"content": "hello fixture world",
"custom_fields": [],
"date_added": "2023-11-14T22:13:20+00:00",
"date_modified": "2023-11-14T22:15:00+00:00",
"file_type": "txt",
"kind": "document",
"label": "example-doc",
"links": [],
"modified_ts": 1700000100,
"notes": "",
"tags": [],
"type": "document"
},
"7": {
"archived": false,
"date_added": "2023-11-14T22:13:20+00:00",
"date_modified": "2023-11-14T22:13:20+00:00",
"index": 7,
"kind": "seed",
"label": "example-seed",
"links": [],
"modified_ts": 1700000000,
"notes": "",
"tags": [],
"type": "seed",
"word_count": 24
},
"8": {
"archived": false,
"custom_fields": [],
"date_added": "2023-11-14T22:13:20+00:00",
"date_modified": "2023-11-14T22:13:20+00:00",
"fingerprint": "DC982FD44E32F59A",
"index": 8,
"kind": "managed_account",
"label": "example-managed",
"links": [],
"modified_ts": 1700000000,
"notes": "",
"tags": [],
"type": "managed_account",
"word_count": 12
},
"9": {
"archived": false,
"date_added": "2023-11-14T22:13:20+00:00",
"date_modified": "2023-11-14T22:13:20+00:00",
"index": 9,
"key_type": "ed25519",
"kind": "pgp",
"label": "example-pgp",
"links": [],
"modified_ts": 1700000000,
"notes": "",
"tags": [],
"type": "pgp",
"user_id": "[email protected]"
}
},
"schema_version": 4
},
"fixed_unix": 1700000000,
"fixture_version": 1,
"mnemonic_id": "abandon12",
"mod_unix": 1700000100
}