1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
//! Canonical keyspace names (P2.5).
//!
//! Every keyspace the daemon opens is named exactly once here so the
//! literals can't drift across `server.rs`, the offline CLIs, and the
//! setup wizard's pre-create pass. [`ALL`] is the full set — the
//! wizard's `open_keyspaces` iterates it so it can no longer silently
//! pre-create a *subset* (it used to open 8 of 21), and a test pins
//! `ALL.len()` to the `AppState` keyspace-field count so a keyspace
//! can't be added to one without the other.
//!
//! Names are the stable on-disk fjall partition identifiers — changing
//! one orphans existing data, so treat them as a wire contract.
pub const SESSIONS: &str = "sessions";
pub const ACL: &str = "acl";
pub const COMMUNITY: &str = "community";
pub const CONFIG: &str = "config";
pub const PASSKEY: &str = "passkey";
pub const INSTALL: &str = "install";
pub const MEMBERS: &str = "members";
pub const JOIN_REQUESTS: &str = "join_requests";
/// Durable queue of pending capability-grant hook jobs (membership → grant).
pub const HOOKS_QUEUE: &str = "hooks_queue";
/// Singleton audit-tail cursor for the hook relay.
pub const HOOKS_CURSOR: &str = "hooks_cursor";
pub const POLICIES: &str = "policies";
pub const ACTIVE_POLICIES: &str = "active_policies";
pub const STATUS_LISTS: &str = "status_lists";
pub const REGISTRY_RECORDS: &str = "registry_records";
pub const SYNC_QUEUE: &str = "sync_queue";
pub const SYNC_CURSOR: &str = "sync_cursor";
pub const RELATIONSHIPS: &str = "relationships";
pub const RELATIONSHIPS_BY_DID: &str = "relationships_by_did";
pub const ENDORSEMENT_TYPES: &str = "endorsement_types";
pub const SCHEMAS: &str = "schemas";
pub const ENDORSEMENTS: &str = "endorsements";
/// Data rooms: one row per room at `rooms:<roomId>`.
///
/// Holds an owner, a visibility, an epoch and a retention period — and deliberately **no
/// member list**. Membership is decided by credentials the room itself issued, so a roster
/// here would make the room unmovable and make this service part of its membership.
pub use ROOMS_KEYSPACE as ROOMS;
/// Room records at `room_records:<roomId>:<key>`. Ciphertext on the sealed tiers.
pub use ROOM_RECORDS_KEYSPACE as ROOM_RECORDS;
/// The epoch key chain at `room_epoch_links:<roomId>:<epoch>`. Wrapped key material this
/// service cannot read — the key that opens a rung is a storage key no host ever holds.
///
/// **Backed up, and not optionally.** A room's records survive a restore as ciphertext; the
/// chain is what makes anything written before the last membership change openable at all.
/// Restoring the records without it hands the members a room they can see the shape of and
/// cannot read.
pub use ROOM_EPOCH_LINKS_KEYSPACE as ROOM_EPOCH_LINKS;
/// Each hosted room's revocation list at `room_revocations:<roomId>`: the latest list the
/// room signed and an administrator delivered (`rooms/revocations/put`), with when this
/// host began enforcing it.
///
/// **Backed up.** It is the room's state, not this host's: a restore without it would
/// honour again every credential the room withdrew, until somebody re-delivered the list.
pub use ROOM_REVOCATIONS_KEYSPACE as ROOM_REVOCATIONS;
/// The VTC's OpenID4VP verifier identities (`crate::oid4vp`): one record per
/// identity, each holding the private P-256 key its request objects are
/// signed with. Encrypted at rest under the storage key, like `install` and
/// `passkey`.
pub const OID4VP_KEYS: &str = "oid4vp_keys";
/// OpenID4VP wallet sessions (`crate::oid4vp::session`): each holds a
/// single-use nonce, the ephemeral private key the wallet's response is
/// encrypted to, and — once a wallet answers — the presented claims held as
/// evidence for the applicant's join. Encrypted at rest under the storage key.
pub const OID4VP_SESSIONS: &str = "oid4vp_sessions";
/// Room files' index at `room_blobs`: which blobs each room holds, on which storage config,
/// which records name them, and the usage they add up to. **Backed up**, so a restored
/// community still knows its files and their charges. The bytes are not in it, and are
/// not in a VTC backup: they live in the blob store.
pub use ROOM_BLOBS_KEYSPACE as ROOM_BLOBS;
/// Storage configs (`crate::rooms::storage_configs`): the backends room files are
/// stored to, which config each room's new uploads go to, and each config's last probe.
/// **Backed up**: nothing in it is a secret, and the blob index names its configs.
pub const STORAGE_CONFIGS: &str = "storage_configs";
/// The rooms this community **owns** (`crate::rooms::community`): one row per room
/// (its label, the signing key the community's VTA holds for it, who created it), one per
/// member admitted or offered admission, with the offer's credentials and, for a while
/// after acceptance, the Welcome a repeated accept is answered with, the `did.jsonl`
/// of each room whose identity this community publishes itself, and one row per removal
/// owed to a member who left the community (`crate::rooms::departures`).
///
/// The owner's record, **never read on the host path**: a community room's records are
/// authorized by credential chains exactly as a member's room's are (invariant I5).
/// **Backed up**: a restored community that forgot whom it admitted could not remove
/// them, one that forgot a removal owed on a departure would leave the departed member in
/// the room, and a room whose log it no longer served would stop resolving.
pub const COMMUNITY_ROOMS: &str = "community_rooms";
/// The member directory (`crate::directory`): the community's field schema
/// (`field:<key>`), every member's card (`card:<entryId>`), and the index from a
/// member's DID to their entry (`entry:<did>`).
///
/// **Backed up**: it is the community's social state. A restore without it would
/// give every member a new entry identifier, which every reference to an entry —
/// a link a member shared, a group membership — would then miss.
pub const DIRECTORY: &str = "directory";
/// Uploads and downloads in flight. Hours long at most, so **not backed up**: a restored
/// host starts with none, and a client resumes from `begin`.
pub use ROOM_BLOB_TRANSFERS_KEYSPACE as ROOM_BLOB_TRANSFERS;
pub const AUDIT: &str = "audit";
pub const AUDIT_KEY: &str = "audit_key";
/// Signed audit checkpoints (#708) — periodic Ed25519-signed commitments to
/// the audit chain head *and its entry count*, which is what makes truncation
/// detectable. Separate from [`AUDIT`] so a checkpoint is not just another row
/// in the keyspace an adversary is assumed to control.
pub const AUDIT_CHECKPOINT: &str = "audit_checkpoint";
/// Single-use ledger for redeemed Invitation Credentials (VICs): one
/// row per consumed VIC `id`, written when a VIC-driven join is
/// admitted. Read at verify time to set `Invitation.consumed`.
pub const CONSUMED_INVITATIONS: &str = "consumed_invitations";
/// Registry of *issued* Invitation Credentials: one row per VIC `id`
/// recording its revocation-list slot, subject, granted role, and
/// revocation state — drives the list + revoke operator surfaces.
pub const INVITATIONS: &str = "invitations";
/// Durable delivery-layer outbox (D2 P1a): backs
/// [`vti_common::outbox_store::VtiOutboxStore`] for `MessagingService`
/// `Guaranteed` sends so delivery-critical work survives a restart.
/// Ephemeral, re-driven from live state — excluded from backup.
pub const OUTBOX: &str = "outbox";
/// Durable TSP relationship state (`vti_common::relationship_store`) — the Rev 3
/// §7.2.2 recovery store, keyed and serialised by the SDK. Transport state, not
/// community data: excluded from backup, like [`OUTBOX`]. Distinct from
/// [`RELATIONSHIPS`], which is the community's social graph.
pub const TSP_RELATIONSHIPS: &str = "tsp_relationships";
/// Vetting statement withdrawal notices (`vtc/vetting/revoke-statement/0.1`):
/// one row per (issuer, statement id, statement digest), written when a vetter
/// withdraws a statement and read whenever presented statements are counted.
pub const VETTING_REVOCATIONS: &str = "vetting_revocations";
/// Hidden-vetter admission (ZKP, development branch `zkp-pcs`): the spent
/// attestation tokens, one row per `(token label, serial)`, written when a
/// hidden submission is counted and read on every later one. A serial that
/// un-spends is a double spend, so this is backed up for the same reason
/// `VETTING_REVOCATIONS` is.
pub const VETTING_PCS_SPENT: &str = "vetting_pcs_spent";
/// Hidden-vetter admission (ZKP, development branch `zkp-pcs`): what the
/// community minted — one enrolment row per vetter (the class labels they
/// hold a credential under, and the PCS identifier they are bound to) and one
/// row per served drip tick. Backed up: losing an enrolment row lets a member
/// enrol twice under one label and count twice in one proof, which is the
/// invariant the whole counting rule rests on.
pub const VETTING_PCS_ISSUE: &str = "vetting_pcs_issue";
/// Vetter profiles (`vtc/vetting/vetters/profile/0.1`): one row per vetter DID,
/// written by the vetter, deleted when they no longer hold a live grant, and
/// read by the vetter listing.
pub const VETTER_PROFILES: &str = "vetter_profiles";
/// The accepted-document-id record (VTI-OPS-025…027, SPEC §7.2 item 11): one
/// row per Trust Task document `id` accepted for execution, carrying the
/// digest of the document accepted under it and the instant the record may be
/// dropped. In the store rather than in a process-local map because VTI-OPS-027
/// requires the record to be **shared across every binding** — see
/// `crate::trust_tasks::accepted_ids`.
pub const ACCEPTED_IDS: &str = "accepted_ids";
/// Git namespaces (`crate::git_ns`): the namespaces this community has bound
/// on the forges, the repositories in them, the git rights recorded on each,
/// and forge-account link attempts. The source of truth for every git right
/// the community publishes — the registry and the forge are projections of it.
pub const GIT_NS: &str = "git_ns";
/// Outstanding `git-ns/bridge/job` jobs and their results.
pub const GIT_NS_JOBS: &str = "git_ns_jobs";
/// The mirror of what the git-namespace projection has published to the Trust
/// Registry, and its audit-tail cursor. A cache of a remote effect, rebuilt by
/// reconciling against [`GIT_NS`].
pub const GIT_NS_PROJECTION: &str = "git_ns_projection";
/// Console signing-key delegations (#1684): one row per console `did:key` at
/// `console_key:<consoleDid>`, saying which admin DID that key may act as.
///
/// A *credential* of an existing admin identity, the way a registered passkey
/// is — it carries no role and confers nothing on its own, so a console key
/// never appears in `acl list`. See `crate::acl::console_key`.
pub const CONSOLE_KEYS: &str = "console_keys";
/// Operation-bound step-up marks (#1641): a pending mark per outstanding
/// WebAuthn challenge (`pending:<challenge>`) and a redeemable one per
/// recorded gesture (`mark:<adminDid>:<digest>`), each living 300 s. See
/// `crate::acl::bound_step_up`.
pub const STEP_UP_MARKS: &str = "step_up_marks";
/// Members' step-up passkeys (`auth/passkey/enroll/invite/0.2`,
/// `purpose: stepUp`): the invites (`invite:<tokenHash>`), redemption and
/// revocation ceremonies, and the credentials themselves in the passkey
/// store's own row format. A keyspace of its own **by construction**: login and
/// session step-up read [`PASSKEY`] only, so a step-up passkey can never open
/// or elevate a session. See `crate::step_up_passkey`.
pub const STEP_UP_PASSKEYS: &str = "step_up_passkeys";
/// Member-portal sessions (`session:<id>`, `refresh:<hash>`, …, the shared
/// session store's own row format). A keyspace of its own **by construction**:
/// the administrator auth path reads [`SESSIONS`] only, so a member's refresh
/// token can never be redeemed at `/v1/auth/refresh` for a console token —
/// not even by a member who is also an administrator. See
/// `crate::member_portal`.
pub const MEMBER_SESSIONS: &str = "member_sessions";
/// Member-portal passkeys and their WebAuthn ceremony state, in the passkey
/// store's own row format. Kept apart from [`PASSKEY`] for the reason
/// [`STEP_UP_PASSKEYS`] is: console login and every step-up read [`PASSKEY`]
/// only, so a passkey a member enrolled for the portal can neither open a
/// console session nor answer a step-up. See `crate::member_portal`.
pub const MEMBER_PASSKEYS: &str = "member_passkeys";
/// The administrator action list (`docs/05-design-notes/vtc-action-list.md`):
/// every operation parked for other administrators' approval — VTI-APV-014's
/// unrestricted grants, VTI-APV-019's reductions, VTI-APV-020's threshold
/// lowerings, VTI-VTC-022's authority-policy changes — at `action:<id>`, with
/// each approver's salted wire digest indexed at `wire:<digest>`. Open actions,
/// and closed ones for 30 days of history. See `crate::admin_actions`.
///
/// Replaces the `task_consent` keyspace the re-send model kept its pending
/// requests and grants in (design §8a: net-new, nothing is migrated).
pub const ADMIN_ACTIONS: &str = "admin_actions";
/// Step-up **approvers** (VTI-APV-015, VTI-APV-016): `did:key`s bound to one
/// subject each as that subject's step-up factor (`approver:<did>` live
/// bindings and revoked tombstones, `subject:<did>` the live index), plus the
/// enrolment state that binds them — invites (`invite:<tokenHash>`),
/// redemption ceremonies (`redeem:<enrollmentId>`), install claims
/// (`claim:<claimId>`) and claimed-but-not-bootstrapped bindings
/// (`pending:<installJti>`) — and the spent statement ids (`spent:<hash>`). A
/// keyspace of its own **by construction**, like [`STEP_UP_PASSKEYS`]: only the
/// bound step-up gate reads it, never login or session step-up. See
/// `crate::acl::approver` and `crate::step_up_approver`.
pub const STEP_UP_APPROVERS: &str = "step_up_approvers";
/// Member pushes in flight and recently finished (`push:<id>`): the signed
/// Trust Task, the transports still to try, and how it ended. Encrypted at rest
/// under the storage key. See `crate::member_push`.
pub const MEMBER_PUSHES: &str = "member_pushes";
/// In-flight backup bundles (#1641): `bundle:<id>` records and `chunks:<id>`
/// manifests for the chunked `backup/*` transfer, whose bytes are staged under
/// `<data_dir>/backups`. See `vti_common::backup_transfer`.
pub const BACKUP_BUNDLES: &str = "backup_bundles";
/// Every keyspace the daemon opens, in `AppState` field order. The
/// setup wizard pre-creates exactly this set; `server::run` opens
/// exactly this set.
pub const ALL: & = &;
/// Keyspaces captured by `POST /v1/backup/export` (P3.9). These hold
/// the community's durable, irreplaceable state. `audit` is included
/// only when the caller passes `include_audit = true`; its HMAC key
/// (`audit_key`) is always included so restored logs stay verifiable.
///
/// `BACKED_UP` and [`EXCLUDED_FROM_BACKUP`] must partition [`ALL`]
/// exactly — enforced by `backup_partition_is_total`. The signing key
/// bundle is NOT a keyspace (it lives in the `secrets` backend) and is
/// captured separately by the backup payload.
pub const BACKED_UP: & = &;
/// Keyspaces deliberately omitted from backup (P3.9): ephemeral auth,
/// one-shot ceremony state, re-syncable registry mirrors, and config
/// (carried by the backup payload's config snapshot + re-applied on
/// import). Restoring these would resurrect stale sessions or clobber
/// runtime state. Partitions [`ALL`] with [`BACKED_UP`].
pub const EXCLUDED_FROM_BACKUP: & = &;