-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrespondent-ledger-event.schema.json
More file actions
492 lines (492 loc) · 16.7 KB
/
respondent-ledger-event.schema.json
File metadata and controls
492 lines (492 loc) · 16.7 KB
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
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://formspec.org/schemas/respondent-ledger-event.schema.json",
"title": "Formspec Respondent Ledger Event",
"description": "A single append-only respondent-side audit event for the optional Respondent Ledger add-on. Events capture material draft, submission, amendment, attachment, prepopulation, and validation milestones without redefining a Formspec Response as an event stream.",
"type": "object",
"required": [
"eventId",
"sequence",
"eventType",
"occurredAt",
"recordedAt",
"responseId",
"definitionUrl",
"definitionVersion",
"actor",
"source"
],
"additionalProperties": false,
"properties": {
"eventId": {
"type": "string",
"minLength": 1,
"description": "Unique identifier for this event within the ledger.",
"examples": ["evt-0004"]
},
"sequence": {
"type": "integer",
"minimum": 1,
"description": "Monotonic sequence number within the ledger.",
"examples": [4]
},
"eventType": {
"$ref": "#/$defs/EventType"
},
"occurredAt": {
"type": "string",
"format": "date-time",
"description": "When the underlying material action occurred."
},
"recordedAt": {
"type": "string",
"format": "date-time",
"description": "When the processor durably recorded the event."
},
"responseId": {
"type": "string",
"minLength": 1,
"description": "Identifier of the Formspec Response this event belongs to."
},
"definitionUrl": {
"type": "string",
"format": "uri",
"description": "Canonical URL of the pinned Definition in force for this event."
},
"definitionVersion": {
"type": "string",
"minLength": 1,
"description": "Exact pinned Definition version in force for this event."
},
"actor": {
"$ref": "#/$defs/Actor"
},
"source": {
"$ref": "#/$defs/Source"
},
"changes": {
"type": "array",
"description": "Ordered set of atomic material changes associated with this event.",
"minItems": 1,
"items": {
"$ref": "#/$defs/ChangeSetEntry"
}
},
"validationSnapshot": {
"$ref": "#/$defs/ValidationSnapshot"
},
"identityAttestation": {
"$ref": "#/$defs/IdentityAttestation"
},
"attachmentBinding": {
"$ref": "#/$defs/EvidenceAttachmentBinding"
},
"priorAttachmentBindingHash": {
"$ref": "#/$defs/HashString",
"description": "Prior attachment-binding event hash referenced by an attachment.removed event."
},
"sessionRef": {
"type": "string",
"minLength": 1,
"description": "Implementation-specific identifier for the respondent session segment associated with the event."
},
"amendmentRef": {
"type": "string",
"minLength": 1,
"description": "Identifier for the amendment cycle this event belongs to, when applicable."
},
"priorEventHash": {
"oneOf": [
{ "$ref": "#/$defs/HashString" },
{ "type": "null" }
],
"description": "Previous event hash in the respondent-ledger chain, or null for the first event in a Trellis-wrapped chain."
},
"eventHash": {
"$ref": "#/$defs/HashString"
},
"extensions": {
"$ref": "#/$defs/Extensions"
}
},
"allOf": [
{
"if": {
"properties": { "eventType": { "const": "attachment.added" } },
"required": ["eventType"]
},
"then": {
"required": ["changes", "attachmentBinding"],
"not": { "required": ["priorAttachmentBindingHash"] },
"properties": {
"attachmentBinding": {
"properties": {
"prior_binding_hash": { "type": "null" }
}
}
}
}
},
{
"if": {
"properties": { "eventType": { "const": "attachment.replaced" } },
"required": ["eventType"]
},
"then": {
"required": ["changes", "attachmentBinding"],
"not": { "required": ["priorAttachmentBindingHash"] },
"properties": {
"attachmentBinding": {
"properties": {
"prior_binding_hash": { "$ref": "#/$defs/HashString" }
},
"required": ["prior_binding_hash"]
}
}
}
},
{
"if": {
"properties": { "eventType": { "const": "attachment.removed" } },
"required": ["eventType"]
},
"then": {
"required": ["changes", "priorAttachmentBindingHash"],
"not": { "required": ["attachmentBinding"] }
}
}
],
"$defs": {
"EventType": {
"type": "string",
"enum": [
"session.started",
"draft.saved",
"draft.resumed",
"response.completed",
"response.amendment-opened",
"response.amended",
"response.stopped",
"attachment.added",
"attachment.replaced",
"attachment.removed",
"prepopulation.applied",
"system.merge-resolved",
"validation.snapshot-recorded",
"calculation.material-change",
"nonrelevant.pruned",
"autosave.coalesced",
"device-linked",
"identity-verified",
"attestation.captured",
"response.submit-attempted",
"response.migrated"
],
"description": "Canonical event classifications defined by the Respondent Ledger add-on. The first thirteen values are required event types; the remaining values are optional but standardized extension points."
},
"Actor": {
"type": "object",
"required": ["kind"],
"additionalProperties": false,
"properties": {
"kind": {
"type": "string",
"enum": ["respondent", "delegate", "system", "support-agent", "unknown"],
"description": "Who initiated or is attributed with the event."
},
"id": {
"type": "string",
"description": "Stable actor identifier when available."
},
"display": {
"type": "string",
"description": "Human-readable actor label for timeline and support views."
},
"assuranceLevel": {
"type": "string",
"description": "Ordered assurance level per spec §6.6.1. Implementations MAY define additional levels; the base four are enumerated here.",
"examples": ["L1", "L2", "L3", "L4"]
},
"privacyTier": {
"$ref": "#/$defs/PrivacyTier"
},
"did": {
"$ref": "#/$defs/DidString"
},
"identityProviderRef": {
"type": "string",
"description": "Reference to the normalized identity provider, verifier, or adapter used for this actor context."
},
"subjectRef": {
"type": "string",
"description": "Stable pseudonymous subject or continuity identifier used by the ledger independent of any specific identity provider or proofing implementation."
},
"extensions": {
"$ref": "#/$defs/Extensions"
}
}
},
"Source": {
"type": "object",
"required": ["kind"],
"additionalProperties": false,
"properties": {
"kind": {
"type": "string",
"enum": ["web", "mobile", "api", "import", "system-job", "unknown"],
"description": "Capture channel or subsystem that produced the event."
},
"channelId": {
"type": "string",
"description": "Implementation-specific channel identifier."
},
"deviceId": {
"type": "string",
"description": "Stable or session-local device identifier when tracked."
},
"ipAddressRef": {
"type": "string",
"description": "Protected derivative or reference for network address metadata."
},
"userAgentRef": {
"type": "string",
"description": "Protected derivative or reference for user-agent metadata."
},
"extensions": {
"$ref": "#/$defs/Extensions"
}
}
},
"ChangeSetEntry": {
"type": "object",
"required": ["op", "path", "valueClass"],
"additionalProperties": false,
"properties": {
"op": {
"type": "string",
"enum": ["set", "unset", "add", "remove", "replace", "reorder", "status-transition"],
"description": "Atomic operation represented by this material change entry."
},
"path": {
"type": "string",
"minLength": 1,
"description": "Logical Formspec response path identifying the changed node."
},
"valueClass": {
"type": "string",
"enum": ["user-input", "prepopulated", "calculated", "imported", "attachment", "system-derived", "migration-derived"],
"description": "Origin class of the changed value."
},
"itemKey": {
"type": "string",
"description": "Stable Formspec item key when the path maps directly to one."
},
"before": {
"description": "Prior value when retained under the implementation's privacy policy."
},
"after": {
"description": "Resulting value when retained under the implementation's privacy policy."
},
"beforeHash": {
"$ref": "#/$defs/HashString"
},
"afterHash": {
"$ref": "#/$defs/HashString"
},
"displayBefore": {
"type": "string",
"description": "Human-readable prior value summary safe for timeline display."
},
"displayAfter": {
"type": "string",
"description": "Human-readable resulting value summary safe for timeline display."
},
"reasonCode": {
"type": "string",
"description": "Machine-readable explanation for why the change happened."
},
"dataPointer": {
"type": "string",
"description": "Optional JSON Pointer or equivalent row discriminator for precise targeting in repeated structures."
},
"extensions": {
"$ref": "#/$defs/Extensions"
}
}
},
"IdentityAttestation": {
"type": "object",
"required": ["provider", "credentialType"],
"additionalProperties": false,
"properties": {
"provider": {
"type": "string",
"description": "Provider or issuer identifier, such as idme, login.gov, an internal proofing service, or a DID issuer."
},
"adapter": {
"type": "string",
"description": "Implementation adapter/interface identifier used to normalize a provider-specific identity flow into the canonical ledger shape."
},
"subjectRef": {
"type": "string",
"description": "Stable pseudonymous subject or continuity identifier bound to this attestation without requiring disclosure of a real-world identity in the ledger itself."
},
"did": {
"$ref": "#/$defs/DidString"
},
"verificationMethod": {
"type": "string",
"description": "DID URL, key identifier, or equivalent verification-method reference used to validate the attestation."
},
"credentialType": {
"type": "string",
"enum": ["oidc-token", "verifiable-credential", "proof-of-personhood", "delegation-assertion", "provider-assertion", "other"],
"description": "High-level credential or attestation category captured by the event."
},
"credentialRef": {
"type": "string",
"description": "Reference to an encrypted token, credential, presentation, or provider-response envelope rather than the raw secret itself."
},
"personhoodCheck": {
"type": "string",
"enum": ["passed", "failed", "inconclusive", "not-performed"],
"description": "Outcome of proof-of-personhood, liveness, or uniqueness checks when applicable."
},
"subjectBinding": {
"type": "string",
"enum": ["respondent", "subject", "delegate", "other", "unknown"],
"description": "Which party in the workflow the attestation is about."
},
"assuranceLevel": {
"type": "string",
"description": "Ordered assurance level per spec §6.6.1. Implementations MAY define additional levels; the base four are enumerated here.",
"examples": ["L1", "L2", "L3", "L4"]
},
"privacyTier": {
"$ref": "#/$defs/PrivacyTier"
},
"selectiveDisclosureProfile": {
"type": "string",
"description": "Named policy profile controlling what portions of the attestation may be revealed in support, review, export, or dispute contexts."
},
"evidenceRef": {
"type": "string",
"description": "Reference to encrypted reveal material, redacted export evidence, or provider-response evidence."
},
"extensions": {
"$ref": "#/$defs/Extensions"
}
}
},
"EvidenceAttachmentBinding": {
"type": "object",
"required": [
"attachment_id",
"slot_path",
"media_type",
"byte_length",
"attachment_sha256",
"payload_content_hash",
"filename",
"prior_binding_hash"
],
"additionalProperties": false,
"properties": {
"attachment_id": {
"type": "string",
"minLength": 1,
"description": "Stable logical attachment identifier within the current response and origin-layer scope."
},
"slot_path": {
"type": "string",
"minLength": 1,
"description": "Formspec response path or evidence slot where the attachment is bound."
},
"media_type": {
"type": "string",
"pattern": "^[A-Za-z0-9!#$&^_.+-]+/[A-Za-z0-9!#$&^_.+-]+$",
"description": "RFC 6838 media type of the attachment bytes."
},
"byte_length": {
"type": "integer",
"minimum": 0,
"description": "Exact attachment byte length before Trellis envelope encryption."
},
"attachment_sha256": {
"$ref": "#/$defs/HashString",
"description": "SHA-256 over the exact attachment bytes before Trellis envelope encryption."
},
"payload_content_hash": {
"$ref": "#/$defs/HashString",
"description": "Trellis ciphertext hash; equals EventPayload.content_hash and PayloadExternal.content_hash when Trellis-wrapped."
},
"filename": {
"type": ["string", "null"],
"description": "Display-only filename; not attachment identity."
},
"prior_binding_hash": {
"oneOf": [
{ "$ref": "#/$defs/HashString" },
{ "type": "null" }
],
"description": "Prior attachment-binding event hash for replacement, or null for first bind."
}
}
},
"PrivacyTier": {
"type": "string",
"enum": ["anonymous", "pseudonymous", "identified", "public"],
"description": "Disclosure tier describing how linkable or revealed the subject identity is for the actor or attestation at this event boundary."
},
"ValidationSnapshot": {
"type": "object",
"required": ["errors", "warnings", "infos"],
"additionalProperties": false,
"properties": {
"errors": {
"type": "integer",
"minimum": 0,
"description": "Count of error-severity validation findings at the event boundary."
},
"warnings": {
"type": "integer",
"minimum": 0,
"description": "Count of warning-severity validation findings at the event boundary."
},
"infos": {
"type": "integer",
"minimum": 0,
"description": "Count of info-severity validation findings at the event boundary."
},
"results": {
"type": "array",
"description": "Optional detailed ValidationResult snapshot captured alongside the summary counts.",
"items": {
"$ref": "https://formspec.org/schemas/validationResult/1.0"
}
},
"extensions": {
"$ref": "#/$defs/Extensions"
}
}
},
"DidString": {
"type": "string",
"pattern": "^did:[A-Za-z0-9._:%-]+:.+$",
"description": "Decentralized identifier string in DID syntax."
},
"HashString": {
"type": "string",
"pattern": "^[A-Za-z0-9._:+-]+:.+$",
"description": "Algorithm-prefixed digest or integrity token, such as 'sha256:...'."
},
"Extensions": {
"type": "object",
"propertyNames": {
"pattern": "^x-"
},
"additionalProperties": true,
"description": "Implementation-specific extension data. Keys must be namespaced with an 'x-' prefix."
}
}
}