@openvtc/trust-tasks 0.12.11 → 0.12.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,409 @@
1
+ /**
2
+ * Generated by scripts/build-ts-bindings.mjs — DO NOT EDIT BY HAND.
3
+ * Source: specs/vtc/join-requests/submit/0.2/payload.schema.json
4
+ */
5
+
6
+ /**
7
+ * What the policy decided.
8
+ *
9
+ * `allow` — admitted. `deny` — refused, terminally for this submission. `refer` — parked for a human or quorum decision; the applicant is neither in nor out. `requestMore` — the policy cannot decide yet and names what further evidence it needs.
10
+ *
11
+ * The four are not reducible to a pending/decided pair. `refer` and `requestMore` are both 'not decided', but they place the next action with different parties: `refer` waits on the community, `requestMore` waits on the applicant. A consumer that cannot tell them apart cannot tell a user whether to wait or to act.
12
+ */
13
+ export type VerdictEffect = "allow" | "deny" | "refer" | "requestMore";
14
+
15
+ export interface VTCJoinRequestsSubmitPayload {
16
+ /**
17
+ * The applicant's W3C Verifiable Presentation (opaque here), satisfying the community's join policy. The applicant DID is the document proof's signer — not a payload field.
18
+ */
19
+ vp: {};
20
+ /**
21
+ * Whether the applicant consents to trust-registry publication.
22
+ */
23
+ registryConsent?: boolean;
24
+ /**
25
+ * Opaque applicant-supplied extension bag.
26
+ */
27
+ extensions?: {};
28
+ ext?: Ext;
29
+ }
30
+ /**
31
+ * Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.
32
+ */
33
+ export interface Ext {
34
+ [k: string]: unknown | undefined;
35
+ }
36
+ export interface VTCJoinRequestsSubmitResponsePayload {
37
+ /**
38
+ * Id of the created join request (a UUID).
39
+ */
40
+ requestId: string;
41
+ verdict: Verdict;
42
+ ext?: Ext;
43
+ }
44
+ /**
45
+ * What the community decided about this submission.
46
+ *
47
+ * `0.1` returned `status: "pending"` — a constant, which could express only one of the four outcomes a submission actually has. A policy that admits outright, refuses outright, or asks for more evidence had to be reported as 'pending' or not at all.
48
+ */
49
+ export interface Verdict {
50
+ effect: VerdictEffect;
51
+ with: VerdictWith;
52
+ }
53
+ /**
54
+ * The effect-dependent detail of a verdict.
55
+ *
56
+ * Every member is optional at the schema level and which ones are meaningful depends on `effect`: `role` / `obligations` / `bundleRef` on `allow`, `code` / `reason` on `deny`, `queue` / `reason` on `refer`, `needs` / `presentationDefinition` on `requestMore`. The dependency is stated here rather than enforced by `if`/`then` per effect, so that the shape stays a single flat object a generated type can carry without a discriminated union per family — a deliberate trade of schema strictness for implementability, and the reason a consumer MUST branch on `effect` rather than on which members happen to be present.
57
+ */
58
+ export interface VerdictWith {
59
+ /**
60
+ * The granted local role. `allow` only.
61
+ */
62
+ role?: string;
63
+ /**
64
+ * Conditions attached to the grant. `allow` only.
65
+ */
66
+ obligations?: {};
67
+ /**
68
+ * Pointer to a sealed credential bundle, added by the community where issuance occurred rather than emitted by the policy. `allow` only.
69
+ */
70
+ bundleRef?: {};
71
+ /**
72
+ * Stable refusal code, safe to branch on. `deny` only.
73
+ */
74
+ code?: string;
75
+ /**
76
+ * Elaboration in prose, when the decider gave one. `deny` and `refer`.
77
+ */
78
+ reason?: string | null;
79
+ /**
80
+ * Which review queue the decision was parked in, so an applicant can be told who now holds it. `refer` only.
81
+ */
82
+ queue?: string;
83
+ /**
84
+ * What further evidence is required, named so the applicant can act without a support conversation. `requestMore` only.
85
+ */
86
+ needs?: string[];
87
+ /**
88
+ * A machine-readable statement of the same request, so a wallet can satisfy it without a human reading `needs`. `requestMore` only.
89
+ */
90
+ presentationDefinition?: {};
91
+ }
92
+
93
+ /** Trust Task type URI. */
94
+ export const TYPE_URI = "https://trusttasks.org/spec/vtc/join-requests/submit/0.2" as const;
95
+
96
+ /** Stable alias for this specification's request payload shape. */
97
+ export type Payload = VTCJoinRequestsSubmitPayload;
98
+
99
+ /** Trust Task response type URI (request type URI + "#response"). */
100
+ export const RESPONSE_TYPE_URI = "https://trusttasks.org/spec/vtc/join-requests/submit/0.2#response" as const;
101
+
102
+ /** Stable alias for this specification's success-response payload shape. */
103
+ export type Response = VTCJoinRequestsSubmitResponsePayload;
104
+
105
+ /**
106
+ * This specification's payload schema, as a value.
107
+ *
108
+ * SPEC.md §7.2 item 2 is performed against this. It is shipped as data
109
+ * rather than only as a `.json` file because TypeScript types are erased
110
+ * at runtime: without a schema a consumer has nothing to validate, and
111
+ * every REQUIRED payload member is optional in practice. Cross-file
112
+ * `$ref`s are already inlined, so it needs no resolver.
113
+ */
114
+ export const PAYLOAD_SCHEMA = {
115
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
116
+ "$id": "https://trusttasks.org/spec/vtc/join-requests/submit/0.2",
117
+ "title": "VTC Join-Requests Submit — payload",
118
+ "type": "object",
119
+ "additionalProperties": false,
120
+ "required": [
121
+ "vp"
122
+ ],
123
+ "properties": {
124
+ "vp": {
125
+ "type": "object",
126
+ "description": "The applicant's W3C Verifiable Presentation (opaque here), satisfying the community's join policy. The applicant DID is the document proof's signer — not a payload field."
127
+ },
128
+ "registryConsent": {
129
+ "type": "boolean",
130
+ "description": "Whether the applicant consents to trust-registry publication."
131
+ },
132
+ "extensions": {
133
+ "type": "object",
134
+ "description": "Opaque applicant-supplied extension bag."
135
+ },
136
+ "ext": {
137
+ "$ref": "#/$defs/Ext"
138
+ }
139
+ },
140
+ "$defs": {
141
+ "Response": {
142
+ "$anchor": "response",
143
+ "title": "VTC Join-Requests Submit — response payload",
144
+ "type": "object",
145
+ "additionalProperties": false,
146
+ "required": [
147
+ "requestId",
148
+ "verdict"
149
+ ],
150
+ "properties": {
151
+ "requestId": {
152
+ "type": "string",
153
+ "minLength": 1,
154
+ "description": "Id of the created join request (a UUID)."
155
+ },
156
+ "verdict": {
157
+ "$ref": "#/$defs/Verdict",
158
+ "description": "What the community decided about this submission.\n\n`0.1` returned `status: \"pending\"` — a constant, which could express only one of the four outcomes a submission actually has. A policy that admits outright, refuses outright, or asks for more evidence had to be reported as 'pending' or not at all."
159
+ },
160
+ "ext": {
161
+ "$ref": "#/$defs/Ext"
162
+ }
163
+ }
164
+ },
165
+ "Ext": {
166
+ "title": "Ext",
167
+ "description": "Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.",
168
+ "type": "object",
169
+ "minProperties": 1,
170
+ "additionalProperties": true,
171
+ "propertyNames": {
172
+ "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
173
+ }
174
+ },
175
+ "Verdict": {
176
+ "$anchor": "verdict",
177
+ "title": "Verdict",
178
+ "type": "object",
179
+ "additionalProperties": false,
180
+ "required": [
181
+ "effect",
182
+ "with"
183
+ ],
184
+ "description": "A ceremony decision: the effect, plus its effect-dependent detail.",
185
+ "properties": {
186
+ "effect": {
187
+ "$ref": "#/$defs/VerdictEffect"
188
+ },
189
+ "with": {
190
+ "$ref": "#/$defs/VerdictWith"
191
+ }
192
+ }
193
+ },
194
+ "VerdictWith": {
195
+ "$anchor": "verdictWith",
196
+ "title": "VerdictWith",
197
+ "type": "object",
198
+ "additionalProperties": false,
199
+ "description": "The effect-dependent detail of a verdict.\n\nEvery member is optional at the schema level and which ones are meaningful depends on `effect`: `role` / `obligations` / `bundleRef` on `allow`, `code` / `reason` on `deny`, `queue` / `reason` on `refer`, `needs` / `presentationDefinition` on `requestMore`. The dependency is stated here rather than enforced by `if`/`then` per effect, so that the shape stays a single flat object a generated type can carry without a discriminated union per family — a deliberate trade of schema strictness for implementability, and the reason a consumer MUST branch on `effect` rather than on which members happen to be present.",
200
+ "properties": {
201
+ "role": {
202
+ "type": "string",
203
+ "minLength": 1,
204
+ "description": "The granted local role. `allow` only."
205
+ },
206
+ "obligations": {
207
+ "type": "object",
208
+ "description": "Conditions attached to the grant. `allow` only."
209
+ },
210
+ "bundleRef": {
211
+ "type": "object",
212
+ "description": "Pointer to a sealed credential bundle, added by the community where issuance occurred rather than emitted by the policy. `allow` only."
213
+ },
214
+ "code": {
215
+ "type": "string",
216
+ "minLength": 1,
217
+ "description": "Stable refusal code, safe to branch on. `deny` only."
218
+ },
219
+ "reason": {
220
+ "type": [
221
+ "string",
222
+ "null"
223
+ ],
224
+ "description": "Elaboration in prose, when the decider gave one. `deny` and `refer`."
225
+ },
226
+ "queue": {
227
+ "type": "string",
228
+ "minLength": 1,
229
+ "description": "Which review queue the decision was parked in, so an applicant can be told who now holds it. `refer` only."
230
+ },
231
+ "needs": {
232
+ "type": "array",
233
+ "items": {
234
+ "type": "string",
235
+ "minLength": 1
236
+ },
237
+ "description": "What further evidence is required, named so the applicant can act without a support conversation. `requestMore` only."
238
+ },
239
+ "presentationDefinition": {
240
+ "type": "object",
241
+ "description": "A machine-readable statement of the same request, so a wallet can satisfy it without a human reading `needs`. `requestMore` only."
242
+ }
243
+ }
244
+ },
245
+ "VerdictEffect": {
246
+ "$anchor": "verdictEffect",
247
+ "title": "VerdictEffect",
248
+ "type": "string",
249
+ "enum": [
250
+ "allow",
251
+ "deny",
252
+ "refer",
253
+ "requestMore"
254
+ ],
255
+ "description": "What the policy decided.\n\n`allow` — admitted. `deny` — refused, terminally for this submission. `refer` — parked for a human or quorum decision; the applicant is neither in nor out. `requestMore` — the policy cannot decide yet and names what further evidence it needs.\n\nThe four are not reducible to a pending/decided pair. `refer` and `requestMore` are both 'not decided', but they place the next action with different parties: `refer` waits on the community, `requestMore` waits on the applicant. A consumer that cannot tell them apart cannot tell a user whether to wait or to act."
256
+ }
257
+ }
258
+ } as const;
259
+
260
+ /** As {@link PAYLOAD_SCHEMA}, for the success-response variant. */
261
+ export const RESPONSE_PAYLOAD_SCHEMA = {
262
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
263
+ "$ref": "#/$defs/Response",
264
+ "$defs": {
265
+ "Response": {
266
+ "$anchor": "response",
267
+ "title": "VTC Join-Requests Submit — response payload",
268
+ "type": "object",
269
+ "additionalProperties": false,
270
+ "required": [
271
+ "requestId",
272
+ "verdict"
273
+ ],
274
+ "properties": {
275
+ "requestId": {
276
+ "type": "string",
277
+ "minLength": 1,
278
+ "description": "Id of the created join request (a UUID)."
279
+ },
280
+ "verdict": {
281
+ "$ref": "#/$defs/Verdict",
282
+ "description": "What the community decided about this submission.\n\n`0.1` returned `status: \"pending\"` — a constant, which could express only one of the four outcomes a submission actually has. A policy that admits outright, refuses outright, or asks for more evidence had to be reported as 'pending' or not at all."
283
+ },
284
+ "ext": {
285
+ "$ref": "#/$defs/Ext"
286
+ }
287
+ }
288
+ },
289
+ "Ext": {
290
+ "title": "Ext",
291
+ "description": "Vendor-namespaced extension object per SPEC.md §4.5.1. Each immediate key MUST be a reverse-DNS namespace; structure under each namespace is opaque to the framework.",
292
+ "type": "object",
293
+ "minProperties": 1,
294
+ "additionalProperties": true,
295
+ "propertyNames": {
296
+ "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
297
+ }
298
+ },
299
+ "Verdict": {
300
+ "$anchor": "verdict",
301
+ "title": "Verdict",
302
+ "type": "object",
303
+ "additionalProperties": false,
304
+ "required": [
305
+ "effect",
306
+ "with"
307
+ ],
308
+ "description": "A ceremony decision: the effect, plus its effect-dependent detail.",
309
+ "properties": {
310
+ "effect": {
311
+ "$ref": "#/$defs/VerdictEffect"
312
+ },
313
+ "with": {
314
+ "$ref": "#/$defs/VerdictWith"
315
+ }
316
+ }
317
+ },
318
+ "VerdictWith": {
319
+ "$anchor": "verdictWith",
320
+ "title": "VerdictWith",
321
+ "type": "object",
322
+ "additionalProperties": false,
323
+ "description": "The effect-dependent detail of a verdict.\n\nEvery member is optional at the schema level and which ones are meaningful depends on `effect`: `role` / `obligations` / `bundleRef` on `allow`, `code` / `reason` on `deny`, `queue` / `reason` on `refer`, `needs` / `presentationDefinition` on `requestMore`. The dependency is stated here rather than enforced by `if`/`then` per effect, so that the shape stays a single flat object a generated type can carry without a discriminated union per family — a deliberate trade of schema strictness for implementability, and the reason a consumer MUST branch on `effect` rather than on which members happen to be present.",
324
+ "properties": {
325
+ "role": {
326
+ "type": "string",
327
+ "minLength": 1,
328
+ "description": "The granted local role. `allow` only."
329
+ },
330
+ "obligations": {
331
+ "type": "object",
332
+ "description": "Conditions attached to the grant. `allow` only."
333
+ },
334
+ "bundleRef": {
335
+ "type": "object",
336
+ "description": "Pointer to a sealed credential bundle, added by the community where issuance occurred rather than emitted by the policy. `allow` only."
337
+ },
338
+ "code": {
339
+ "type": "string",
340
+ "minLength": 1,
341
+ "description": "Stable refusal code, safe to branch on. `deny` only."
342
+ },
343
+ "reason": {
344
+ "type": [
345
+ "string",
346
+ "null"
347
+ ],
348
+ "description": "Elaboration in prose, when the decider gave one. `deny` and `refer`."
349
+ },
350
+ "queue": {
351
+ "type": "string",
352
+ "minLength": 1,
353
+ "description": "Which review queue the decision was parked in, so an applicant can be told who now holds it. `refer` only."
354
+ },
355
+ "needs": {
356
+ "type": "array",
357
+ "items": {
358
+ "type": "string",
359
+ "minLength": 1
360
+ },
361
+ "description": "What further evidence is required, named so the applicant can act without a support conversation. `requestMore` only."
362
+ },
363
+ "presentationDefinition": {
364
+ "type": "object",
365
+ "description": "A machine-readable statement of the same request, so a wallet can satisfy it without a human reading `needs`. `requestMore` only."
366
+ }
367
+ }
368
+ },
369
+ "VerdictEffect": {
370
+ "$anchor": "verdictEffect",
371
+ "title": "VerdictEffect",
372
+ "type": "string",
373
+ "enum": [
374
+ "allow",
375
+ "deny",
376
+ "refer",
377
+ "requestMore"
378
+ ],
379
+ "description": "What the policy decided.\n\n`allow` — admitted. `deny` — refused, terminally for this submission. `refer` — parked for a human or quorum decision; the applicant is neither in nor out. `requestMore` — the policy cannot decide yet and names what further evidence it needs.\n\nThe four are not reducible to a pending/decided pair. `refer` and `requestMore` are both 'not decided', but they place the next action with different parties: `refer` waits on the community, `requestMore` waits on the applicant. A consumer that cannot tell them apart cannot tell a user whether to wait or to act."
380
+ }
381
+ }
382
+ } as const;
383
+
384
+ /**
385
+ * SPEC.md §7.2 policy for the request variant, from this specification's
386
+ * front matter. Pass to `consumeInbound` — items 5b, 7 and 8 are
387
+ * per-specification and cannot be derived from the document alone, and
388
+ * item 2 needs the schema this carries.
389
+ */
390
+ export const SPEC = {
391
+ typeUri: TYPE_URI,
392
+ isBearer: false,
393
+ isProofRequired: true,
394
+ isRecipientRequired: true,
395
+ payloadSchema: PAYLOAD_SCHEMA,
396
+ } as const;
397
+
398
+ /**
399
+ * SPEC.md §7.2 policy for the success-response variant. `isRecipientRequired`
400
+ * tracks the *issuer* party's requirement because a response swaps the
401
+ * parties (§7.3 item 5).
402
+ */
403
+ export const RESPONSE_SPEC = {
404
+ typeUri: RESPONSE_TYPE_URI,
405
+ isBearer: false,
406
+ isProofRequired: true,
407
+ isRecipientRequired: true,
408
+ payloadSchema: RESPONSE_PAYLOAD_SCHEMA,
409
+ } as const;