@openvtc/trust-tasks 0.28.22 → 0.28.24

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.
Files changed (105) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/dist/_shared/components.d.ts +520 -0
  3. package/dist/_shared/components.d.ts.map +1 -1
  4. package/dist/index.d.ts +45 -0
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +45 -0
  7. package/dist/index.js.map +1 -1
  8. package/dist/messaging/mux/_shared/0.1/mux.d.ts +16 -0
  9. package/dist/messaging/mux/_shared/0.1/mux.d.ts.map +1 -0
  10. package/dist/messaging/mux/_shared/0.1/mux.js +6 -0
  11. package/dist/messaging/mux/_shared/0.1/mux.js.map +1 -0
  12. package/dist/messaging/mux/attach/0.1/payload.d.ts +996 -0
  13. package/dist/messaging/mux/attach/0.1/payload.d.ts.map +1 -0
  14. package/dist/messaging/mux/attach/0.1/payload.js +594 -0
  15. package/dist/messaging/mux/attach/0.1/payload.js.map +1 -0
  16. package/dist/messaging/mux/detach/0.1/payload.d.ts +398 -0
  17. package/dist/messaging/mux/detach/0.1/payload.d.ts.map +1 -0
  18. package/dist/messaging/mux/detach/0.1/payload.js +215 -0
  19. package/dist/messaging/mux/detach/0.1/payload.js.map +1 -0
  20. package/dist/messaging/mux/event/0.1/payload.d.ts +513 -0
  21. package/dist/messaging/mux/event/0.1/payload.d.ts.map +1 -0
  22. package/dist/messaging/mux/event/0.1/payload.js +260 -0
  23. package/dist/messaging/mux/event/0.1/payload.js.map +1 -0
  24. package/dist/messaging/mux/grant/0.1/payload.d.ts +1008 -0
  25. package/dist/messaging/mux/grant/0.1/payload.d.ts.map +1 -0
  26. package/dist/messaging/mux/grant/0.1/payload.js +606 -0
  27. package/dist/messaging/mux/grant/0.1/payload.js.map +1 -0
  28. package/dist/messaging/mux/list/0.1/payload.d.ts +1241 -0
  29. package/dist/messaging/mux/list/0.1/payload.d.ts.map +1 -0
  30. package/dist/messaging/mux/list/0.1/payload.js +715 -0
  31. package/dist/messaging/mux/list/0.1/payload.js.map +1 -0
  32. package/dist/messaging/mux/notice/0.1/payload.d.ts +489 -0
  33. package/dist/messaging/mux/notice/0.1/payload.d.ts.map +1 -0
  34. package/dist/messaging/mux/notice/0.1/payload.js +249 -0
  35. package/dist/messaging/mux/notice/0.1/payload.js.map +1 -0
  36. package/dist/messaging/mux/revoke/0.1/payload.d.ts +585 -0
  37. package/dist/messaging/mux/revoke/0.1/payload.d.ts.map +1 -0
  38. package/dist/messaging/mux/revoke/0.1/payload.js +311 -0
  39. package/dist/messaging/mux/revoke/0.1/payload.js.map +1 -0
  40. package/dist/messaging/mux/revoke-all/0.1/payload.d.ts +682 -0
  41. package/dist/messaging/mux/revoke-all/0.1/payload.d.ts.map +1 -0
  42. package/dist/messaging/mux/revoke-all/0.1/payload.js +397 -0
  43. package/dist/messaging/mux/revoke-all/0.1/payload.js.map +1 -0
  44. package/dist/messaging/mux/update/0.1/payload.d.ts +995 -0
  45. package/dist/messaging/mux/update/0.1/payload.d.ts.map +1 -0
  46. package/dist/messaging/mux/update/0.1/payload.js +586 -0
  47. package/dist/messaging/mux/update/0.1/payload.js.map +1 -0
  48. package/dist/vta/_shared/0.1/memory-record.d.ts +22 -0
  49. package/dist/vta/_shared/0.1/memory-record.d.ts.map +1 -0
  50. package/dist/vta/_shared/0.1/memory-record.js +6 -0
  51. package/dist/vta/_shared/0.1/memory-record.js.map +1 -0
  52. package/dist/vta/memory/delete/0.1/payload.d.ts +13 -2
  53. package/dist/vta/memory/delete/0.1/payload.d.ts.map +1 -1
  54. package/dist/vta/memory/delete/0.1/payload.js +1 -1
  55. package/dist/vta/memory/delete/0.1/payload.js.map +1 -1
  56. package/dist/vta/memory/delete/0.2/payload.d.ts +415 -0
  57. package/dist/vta/memory/delete/0.2/payload.d.ts.map +1 -0
  58. package/dist/vta/memory/delete/0.2/payload.js +224 -0
  59. package/dist/vta/memory/delete/0.2/payload.js.map +1 -0
  60. package/dist/vta/memory/get/0.1/payload.d.ts +646 -0
  61. package/dist/vta/memory/get/0.1/payload.d.ts.map +1 -0
  62. package/dist/vta/memory/get/0.1/payload.js +349 -0
  63. package/dist/vta/memory/get/0.1/payload.js.map +1 -0
  64. package/dist/vta/memory/list/0.1/payload.d.ts +13 -2
  65. package/dist/vta/memory/list/0.1/payload.d.ts.map +1 -1
  66. package/dist/vta/memory/list/0.1/payload.js +1 -1
  67. package/dist/vta/memory/list/0.1/payload.js.map +1 -1
  68. package/dist/vta/memory/list/0.2/payload.d.ts +693 -0
  69. package/dist/vta/memory/list/0.2/payload.d.ts.map +1 -0
  70. package/dist/vta/memory/list/0.2/payload.js +363 -0
  71. package/dist/vta/memory/list/0.2/payload.js.map +1 -0
  72. package/dist/vta/memory/put/0.1/payload.d.ts +13 -2
  73. package/dist/vta/memory/put/0.1/payload.d.ts.map +1 -1
  74. package/dist/vta/memory/put/0.1/payload.js +1 -1
  75. package/dist/vta/memory/put/0.1/payload.js.map +1 -1
  76. package/dist/vta/memory/put/0.2/payload.d.ts +490 -0
  77. package/dist/vta/memory/put/0.2/payload.d.ts.map +1 -0
  78. package/dist/vta/memory/put/0.2/payload.js +264 -0
  79. package/dist/vta/memory/put/0.2/payload.js.map +1 -0
  80. package/dist/vtc/members/rotate/0.1/payload.d.ts +12 -5
  81. package/dist/vtc/members/rotate/0.1/payload.d.ts.map +1 -1
  82. package/dist/vtc/members/rotate/0.1/payload.js +8 -2
  83. package/dist/vtc/members/rotate/0.1/payload.js.map +1 -1
  84. package/package.json +1 -1
  85. package/src/_shared/components.ts +581 -0
  86. package/src/index.ts +45 -0
  87. package/src/messaging/mux/_shared/0.1/mux.ts +17 -0
  88. package/src/messaging/mux/attach/0.1/payload.ts +682 -0
  89. package/src/messaging/mux/detach/0.1/payload.ts +278 -0
  90. package/src/messaging/mux/event/0.1/payload.ts +371 -0
  91. package/src/messaging/mux/grant/0.1/payload.ts +710 -0
  92. package/src/messaging/mux/list/0.1/payload.ts +793 -0
  93. package/src/messaging/mux/notice/0.1/payload.ts +362 -0
  94. package/src/messaging/mux/revoke/0.1/payload.ts +389 -0
  95. package/src/messaging/mux/revoke-all/0.1/payload.ts +452 -0
  96. package/src/messaging/mux/update/0.1/payload.ts +644 -0
  97. package/src/vta/_shared/0.1/memory-record.ts +23 -0
  98. package/src/vta/memory/delete/0.1/payload.ts +14 -3
  99. package/src/vta/memory/delete/0.2/payload.ts +288 -0
  100. package/src/vta/memory/get/0.1/payload.ts +414 -0
  101. package/src/vta/memory/list/0.1/payload.ts +14 -3
  102. package/src/vta/memory/list/0.2/payload.ts +445 -0
  103. package/src/vta/memory/put/0.1/payload.ts +14 -3
  104. package/src/vta/memory/put/0.2/payload.ts +333 -0
  105. package/src/vtc/members/rotate/0.1/payload.ts +12 -3
@@ -0,0 +1,278 @@
1
+ /**
2
+ * Generated by scripts/build-ts-bindings.mjs — DO NOT EDIT BY HAND.
3
+ * Source: specs/messaging/mux/detach/0.1/payload.schema.json
4
+ */
5
+
6
+ import type { Ext, MuxDid } from "../../../../_shared/components.js";
7
+
8
+
9
+ /**
10
+ * A principal removes session attaches from the connection that carries the request. The outer document members are owned by the framework — SPEC §6.3.
11
+ */
12
+ export interface MessagingMuxDetachPayload {
13
+ /**
14
+ * The member DIDs whose session attaches on this connection are removed. A DID appears at most once.
15
+ *
16
+ * @minItems 1
17
+ * @maxItems 256
18
+ */
19
+ dids: [MuxDid, ...MuxDid[]];
20
+ /**
21
+ * Ecosystem-defined extension members per SPEC.md §4.5.1.
22
+ */
23
+ ext?: Ext;
24
+ }
25
+ /**
26
+ * The success response to a messaging/mux/detach request: every requested DID appears in `detached` or `notAttached`. Carried in a Trust Task document whose type is https://trusttasks.org/spec/messaging/mux/detach/0.1#response.
27
+ */
28
+ export interface MessagingMuxDetachResponsePayload {
29
+ /**
30
+ * DIDs whose session attach was removed. Each has left the connection, unless it is also listed in `retainedByGrant`.
31
+ *
32
+ * @maxItems 256
33
+ */
34
+ detached: MuxDid[];
35
+ /**
36
+ * DIDs that are also members through a stored grant: their session attach was removed, and they stay on the connection under the grant's scope. Revoke the grant with messaging/mux/revoke to remove them.
37
+ *
38
+ * @maxItems 256
39
+ */
40
+ retainedByGrant: MuxDid[];
41
+ /**
42
+ * DIDs that had no session attach on this connection. Nothing changed for them.
43
+ *
44
+ * @maxItems 256
45
+ */
46
+ notAttached: MuxDid[];
47
+ /**
48
+ * Ecosystem-defined extension members per SPEC.md §4.5.1.
49
+ */
50
+ ext?: Ext;
51
+ }
52
+
53
+ /** Shared definitions this specification references, re-exported under the names it used to declare them with. */
54
+ export type { Ext, MuxDid };
55
+
56
+ /** Trust Task type URI. */
57
+ export const TYPE_URI = "https://trusttasks.org/spec/messaging/mux/detach/0.1" as const;
58
+
59
+ /**
60
+ * The earlier version of this specification that this one declares it
61
+ * extends (front matter `extends`, SPEC §5.2 "Declared extension"), or
62
+ * `null`. Only the direct declaration — follow the chain with
63
+ * `extendsChain` / `readForSpec`.
64
+ */
65
+ export const EXTENDS: string | null = null;
66
+
67
+ /**
68
+ * Why this version is deprecated, or `null` while it is current. A
69
+ * superseded or retired version is still supported, and is withdrawn from
70
+ * this package in a later scheduled batch (SPEC "Superseded and Withdrawn
71
+ * Versions").
72
+ */
73
+ export const DEPRECATION: string | null = null;
74
+
75
+ /** Stable alias for this specification's request payload shape. */
76
+ export type Payload = MessagingMuxDetachPayload;
77
+
78
+ /** Trust Task response type URI (request type URI + "#response"). */
79
+ export const RESPONSE_TYPE_URI = "https://trusttasks.org/spec/messaging/mux/detach/0.1#response" as const;
80
+
81
+ /** Stable alias for this specification's success-response payload shape. */
82
+ export type Response = MessagingMuxDetachResponsePayload;
83
+
84
+ /**
85
+ * This specification's payload schema, as a value.
86
+ *
87
+ * SPEC.md §7.2 item 2 is performed against this. It is shipped as data
88
+ * rather than only as a `.json` file because TypeScript types are erased
89
+ * at runtime: without a schema a consumer has nothing to validate, and
90
+ * every REQUIRED payload member is optional in practice. Cross-file
91
+ * `$ref`s are already inlined, so it needs no resolver.
92
+ */
93
+ export const PAYLOAD_SCHEMA = {
94
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
95
+ "$id": "https://trusttasks.org/spec/messaging/mux/detach/0.1",
96
+ "title": "Messaging — Mux Detach — payload",
97
+ "description": "A principal removes session attaches from the connection that carries the request. The outer document members are owned by the framework — SPEC §6.3.",
98
+ "type": "object",
99
+ "additionalProperties": false,
100
+ "required": [
101
+ "dids"
102
+ ],
103
+ "properties": {
104
+ "dids": {
105
+ "type": "array",
106
+ "minItems": 1,
107
+ "maxItems": 256,
108
+ "uniqueItems": true,
109
+ "items": {
110
+ "$ref": "#/$defs/MuxDid"
111
+ },
112
+ "description": "The member DIDs whose session attaches on this connection are removed. A DID appears at most once."
113
+ },
114
+ "ext": {
115
+ "$ref": "#/$defs/Ext",
116
+ "description": "Ecosystem-defined extension members per SPEC.md §4.5.1."
117
+ }
118
+ },
119
+ "$defs": {
120
+ "Response": {
121
+ "$anchor": "response",
122
+ "title": "Messaging — Mux Detach — response payload",
123
+ "description": "The success response to a messaging/mux/detach request: every requested DID appears in `detached` or `notAttached`. Carried in a Trust Task document whose type is https://trusttasks.org/spec/messaging/mux/detach/0.1#response.",
124
+ "type": "object",
125
+ "additionalProperties": false,
126
+ "required": [
127
+ "detached",
128
+ "retainedByGrant",
129
+ "notAttached"
130
+ ],
131
+ "properties": {
132
+ "detached": {
133
+ "type": "array",
134
+ "maxItems": 256,
135
+ "items": {
136
+ "$ref": "#/$defs/MuxDid"
137
+ },
138
+ "description": "DIDs whose session attach was removed. Each has left the connection, unless it is also listed in `retainedByGrant`."
139
+ },
140
+ "retainedByGrant": {
141
+ "type": "array",
142
+ "maxItems": 256,
143
+ "items": {
144
+ "$ref": "#/$defs/MuxDid"
145
+ },
146
+ "description": "DIDs that are also members through a stored grant: their session attach was removed, and they stay on the connection under the grant's scope. Revoke the grant with messaging/mux/revoke to remove them."
147
+ },
148
+ "notAttached": {
149
+ "type": "array",
150
+ "maxItems": 256,
151
+ "items": {
152
+ "$ref": "#/$defs/MuxDid"
153
+ },
154
+ "description": "DIDs that had no session attach on this connection. Nothing changed for them."
155
+ },
156
+ "ext": {
157
+ "$ref": "#/$defs/Ext",
158
+ "description": "Ecosystem-defined extension members per SPEC.md §4.5.1."
159
+ }
160
+ }
161
+ },
162
+ "Ext": {
163
+ "title": "Ext",
164
+ "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.",
165
+ "type": "object",
166
+ "minProperties": 1,
167
+ "additionalProperties": true,
168
+ "propertyNames": {
169
+ "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
170
+ }
171
+ },
172
+ "MuxDid": {
173
+ "title": "MuxDid",
174
+ "type": "string",
175
+ "minLength": 7,
176
+ "maxLength": 2048,
177
+ "pattern": "^did:[a-z0-9]+:\\S+$",
178
+ "description": "A DID, carried verbatim and compared by exact string equality. Unlike the messaging family's `Vid`, never a hash: the mediator resolves it to verify a statement signed by it. For a member DID reached over TSP, the TSP VID is the DID itself."
179
+ }
180
+ }
181
+ } as const;
182
+
183
+ /** As {@link PAYLOAD_SCHEMA}, for the success-response variant. */
184
+ export const RESPONSE_PAYLOAD_SCHEMA = {
185
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
186
+ "$ref": "#/$defs/Response",
187
+ "$defs": {
188
+ "Response": {
189
+ "$anchor": "response",
190
+ "title": "Messaging — Mux Detach — response payload",
191
+ "description": "The success response to a messaging/mux/detach request: every requested DID appears in `detached` or `notAttached`. Carried in a Trust Task document whose type is https://trusttasks.org/spec/messaging/mux/detach/0.1#response.",
192
+ "type": "object",
193
+ "additionalProperties": false,
194
+ "required": [
195
+ "detached",
196
+ "retainedByGrant",
197
+ "notAttached"
198
+ ],
199
+ "properties": {
200
+ "detached": {
201
+ "type": "array",
202
+ "maxItems": 256,
203
+ "items": {
204
+ "$ref": "#/$defs/MuxDid"
205
+ },
206
+ "description": "DIDs whose session attach was removed. Each has left the connection, unless it is also listed in `retainedByGrant`."
207
+ },
208
+ "retainedByGrant": {
209
+ "type": "array",
210
+ "maxItems": 256,
211
+ "items": {
212
+ "$ref": "#/$defs/MuxDid"
213
+ },
214
+ "description": "DIDs that are also members through a stored grant: their session attach was removed, and they stay on the connection under the grant's scope. Revoke the grant with messaging/mux/revoke to remove them."
215
+ },
216
+ "notAttached": {
217
+ "type": "array",
218
+ "maxItems": 256,
219
+ "items": {
220
+ "$ref": "#/$defs/MuxDid"
221
+ },
222
+ "description": "DIDs that had no session attach on this connection. Nothing changed for them."
223
+ },
224
+ "ext": {
225
+ "$ref": "#/$defs/Ext",
226
+ "description": "Ecosystem-defined extension members per SPEC.md §4.5.1."
227
+ }
228
+ }
229
+ },
230
+ "Ext": {
231
+ "title": "Ext",
232
+ "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.",
233
+ "type": "object",
234
+ "minProperties": 1,
235
+ "additionalProperties": true,
236
+ "propertyNames": {
237
+ "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
238
+ }
239
+ },
240
+ "MuxDid": {
241
+ "title": "MuxDid",
242
+ "type": "string",
243
+ "minLength": 7,
244
+ "maxLength": 2048,
245
+ "pattern": "^did:[a-z0-9]+:\\S+$",
246
+ "description": "A DID, carried verbatim and compared by exact string equality. Unlike the messaging family's `Vid`, never a hash: the mediator resolves it to verify a statement signed by it. For a member DID reached over TSP, the TSP VID is the DID itself."
247
+ }
248
+ }
249
+ } as const;
250
+
251
+ /**
252
+ * SPEC.md §7.2 policy for the request variant, from this specification's
253
+ * front matter. Pass to `consumeInbound` — items 5b, 7 and 8 are
254
+ * per-specification and cannot be derived from the document alone, and
255
+ * item 2 needs the schema this carries.
256
+ */
257
+ export const SPEC = {
258
+ typeUri: TYPE_URI,
259
+ isBearer: false,
260
+ isProofRequired: false,
261
+ isRecipientRequired: true,
262
+ isIssuedAtRequired: true,
263
+ payloadSchema: PAYLOAD_SCHEMA,
264
+ } as const;
265
+
266
+ /**
267
+ * SPEC.md §7.2 policy for the success-response variant. `isRecipientRequired`
268
+ * tracks the *issuer* party's requirement because a response swaps the
269
+ * parties (§7.3 item 5).
270
+ */
271
+ export const RESPONSE_SPEC = {
272
+ typeUri: RESPONSE_TYPE_URI,
273
+ isBearer: false,
274
+ isProofRequired: false,
275
+ isRecipientRequired: true,
276
+ isIssuedAtRequired: true,
277
+ payloadSchema: RESPONSE_PAYLOAD_SCHEMA,
278
+ } as const;
@@ -0,0 +1,371 @@
1
+ /**
2
+ * Generated by scripts/build-ts-bindings.mjs — DO NOT EDIT BY HAND.
3
+ * Source: specs/messaging/mux/event/0.1/payload.schema.json
4
+ */
5
+
6
+ import type { Ext, GrantId, MemberChangeReason, MuxDid, MuxNonce, MuxScope, MuxScopeValue, SessionId_MessagingMuxV0_1 as SessionId } from "../../../../_shared/components.js";
7
+
8
+
9
+ /**
10
+ * A live, unstored event from a mediator to the principal of one mux connection: the connection is ready (with its nonce and limits), members attached or detached, or an inbound frame for a member refused. The members present depend on `event`; see the specification. The outer document members are owned by the framework — SPEC §6.3.
11
+ */
12
+ export interface MessagingMuxEventPayload {
13
+ /**
14
+ * Which event this is. Each kind carries the members the specification lists for it, and no others.
15
+ */
16
+ event: "ready" | "attached" | "detached" | "refused";
17
+ /**
18
+ * `ready` only, REQUIRED: this connection's identifier, which attach statements sign over.
19
+ */
20
+ sessionId?: SessionId;
21
+ /**
22
+ * `ready` only, REQUIRED: this connection's nonce, which attach statements sign over.
23
+ */
24
+ muxNonce?: MuxNonce;
25
+ /**
26
+ * `ready` only, REQUIRED: the most members this connection may carry.
27
+ */
28
+ maxDidsPerConnection?: number;
29
+ /**
30
+ * `ready` only, REQUIRED: the longest `exp − iat` a grant may have.
31
+ */
32
+ maxGrantLifetimeSeconds?: number;
33
+ /**
34
+ * `ready` only, OPTIONAL: the longest an attach statement's `exp` may lie after its `iat`.
35
+ */
36
+ maxAttachLifetimeSeconds?: number;
37
+ /**
38
+ * `ready` only, OPTIONAL: when the principal's authentication of this connection expires and the connection closes. An attach statement's `exp` may not be later.
39
+ */
40
+ sessionExpiresAt?: string;
41
+ /**
42
+ * `ready` only, REQUIRED: how many messaging/mux/notice documents wait in the principal's inbox. Non-zero means the principal must drain them before it trusts its member set.
43
+ */
44
+ pendingNotices?: number;
45
+ /**
46
+ * `attached` and `detached` only, REQUIRED: the members that changed, batched. A larger change is split across several events.
47
+ *
48
+ * @minItems 1
49
+ * @maxItems 1000
50
+ */
51
+ dids?: [MemberChange, ...MemberChange[]];
52
+ /**
53
+ * `refused` only, REQUIRED: the lowercase hex SHA-256 of the refused frame's exact bytes — the identifier `tsp-ack` already uses.
54
+ */
55
+ frameId?: string;
56
+ /**
57
+ * `refused` only, OPTIONAL: the frame's sender, when the mediator could read it.
58
+ */
59
+ sender?: MuxDid;
60
+ /**
61
+ * `refused` only, OPTIONAL: the member DID or principal the frame was addressed to, when the mediator could read it.
62
+ */
63
+ receiver?: MuxDid;
64
+ /**
65
+ * `refused` only, REQUIRED: the mediator's stable refusal code, the same code a traffic-monitor `refused` event reports.
66
+ */
67
+ code?: string;
68
+ /**
69
+ * `refused` only, OPTIONAL: a short human-readable explanation. Never message content.
70
+ */
71
+ reason?: string;
72
+ /**
73
+ * Ecosystem-defined extension members per SPEC.md §4.5.1.
74
+ */
75
+ ext?: Ext;
76
+ }
77
+ /**
78
+ * One member's change in an `attached` or `detached` event.
79
+ */
80
+ export interface MemberChange {
81
+ /**
82
+ * The member DID.
83
+ */
84
+ did: MuxDid;
85
+ /**
86
+ * Why the member changed: an AttachReason value in an `attached` event, a DetachReason value in a `detached` event.
87
+ */
88
+ reason: MemberChangeReason;
89
+ /**
90
+ * The grant concerned, where the member is or was attached through one.
91
+ */
92
+ grantId?: GrantId;
93
+ /**
94
+ * `attached` only: the scope now in force for the member.
95
+ */
96
+ scope?: MuxScope;
97
+ /**
98
+ * `attached` only: when the membership lapses unless renewed.
99
+ */
100
+ expiresAt?: string;
101
+ /**
102
+ * `attached` only: false while the member DID's own direct connection keeps its live traffic.
103
+ */
104
+ deliveryActive?: boolean;
105
+ }
106
+
107
+ /** Shared definitions this specification references, re-exported under the names it used to declare them with. */
108
+ export type { Ext, GrantId, MemberChangeReason, MuxDid, MuxNonce, MuxScope, MuxScopeValue, SessionId };
109
+
110
+ /** Trust Task type URI. */
111
+ export const TYPE_URI = "https://trusttasks.org/spec/messaging/mux/event/0.1" as const;
112
+
113
+ /**
114
+ * The earlier version of this specification that this one declares it
115
+ * extends (front matter `extends`, SPEC §5.2 "Declared extension"), or
116
+ * `null`. Only the direct declaration — follow the chain with
117
+ * `extendsChain` / `readForSpec`.
118
+ */
119
+ export const EXTENDS: string | null = null;
120
+
121
+ /**
122
+ * Why this version is deprecated, or `null` while it is current. A
123
+ * superseded or retired version is still supported, and is withdrawn from
124
+ * this package in a later scheduled batch (SPEC "Superseded and Withdrawn
125
+ * Versions").
126
+ */
127
+ export const DEPRECATION: string | null = null;
128
+
129
+ /** Stable alias for this specification's request payload shape. */
130
+ export type Payload = MessagingMuxEventPayload;
131
+
132
+ /**
133
+ * This specification's payload schema, as a value.
134
+ *
135
+ * SPEC.md §7.2 item 2 is performed against this. It is shipped as data
136
+ * rather than only as a `.json` file because TypeScript types are erased
137
+ * at runtime: without a schema a consumer has nothing to validate, and
138
+ * every REQUIRED payload member is optional in practice. Cross-file
139
+ * `$ref`s are already inlined, so it needs no resolver.
140
+ */
141
+ export const PAYLOAD_SCHEMA = {
142
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
143
+ "$id": "https://trusttasks.org/spec/messaging/mux/event/0.1",
144
+ "title": "Messaging — Mux Event — payload",
145
+ "description": "A live, unstored event from a mediator to the principal of one mux connection: the connection is ready (with its nonce and limits), members attached or detached, or an inbound frame for a member refused. The members present depend on `event`; see the specification. The outer document members are owned by the framework — SPEC §6.3.",
146
+ "type": "object",
147
+ "additionalProperties": false,
148
+ "required": [
149
+ "event"
150
+ ],
151
+ "properties": {
152
+ "event": {
153
+ "type": "string",
154
+ "enum": [
155
+ "ready",
156
+ "attached",
157
+ "detached",
158
+ "refused"
159
+ ],
160
+ "description": "Which event this is. Each kind carries the members the specification lists for it, and no others."
161
+ },
162
+ "sessionId": {
163
+ "$ref": "#/$defs/SessionId",
164
+ "description": "`ready` only, REQUIRED: this connection's identifier, which attach statements sign over."
165
+ },
166
+ "muxNonce": {
167
+ "$ref": "#/$defs/MuxNonce",
168
+ "description": "`ready` only, REQUIRED: this connection's nonce, which attach statements sign over."
169
+ },
170
+ "maxDidsPerConnection": {
171
+ "type": "integer",
172
+ "minimum": 1,
173
+ "description": "`ready` only, REQUIRED: the most members this connection may carry."
174
+ },
175
+ "maxGrantLifetimeSeconds": {
176
+ "type": "integer",
177
+ "minimum": 1,
178
+ "description": "`ready` only, REQUIRED: the longest `exp − iat` a grant may have."
179
+ },
180
+ "maxAttachLifetimeSeconds": {
181
+ "type": "integer",
182
+ "minimum": 1,
183
+ "description": "`ready` only, OPTIONAL: the longest an attach statement's `exp` may lie after its `iat`."
184
+ },
185
+ "sessionExpiresAt": {
186
+ "type": "string",
187
+ "format": "date-time",
188
+ "description": "`ready` only, OPTIONAL: when the principal's authentication of this connection expires and the connection closes. An attach statement's `exp` may not be later."
189
+ },
190
+ "pendingNotices": {
191
+ "type": "integer",
192
+ "minimum": 0,
193
+ "description": "`ready` only, REQUIRED: how many messaging/mux/notice documents wait in the principal's inbox. Non-zero means the principal must drain them before it trusts its member set."
194
+ },
195
+ "dids": {
196
+ "type": "array",
197
+ "minItems": 1,
198
+ "maxItems": 1000,
199
+ "items": {
200
+ "$ref": "#/$defs/MemberChange"
201
+ },
202
+ "description": "`attached` and `detached` only, REQUIRED: the members that changed, batched. A larger change is split across several events."
203
+ },
204
+ "frameId": {
205
+ "type": "string",
206
+ "pattern": "^[0-9a-f]{64}$",
207
+ "description": "`refused` only, REQUIRED: the lowercase hex SHA-256 of the refused frame's exact bytes — the identifier `tsp-ack` already uses."
208
+ },
209
+ "sender": {
210
+ "$ref": "#/$defs/MuxDid",
211
+ "description": "`refused` only, OPTIONAL: the frame's sender, when the mediator could read it."
212
+ },
213
+ "receiver": {
214
+ "$ref": "#/$defs/MuxDid",
215
+ "description": "`refused` only, OPTIONAL: the member DID or principal the frame was addressed to, when the mediator could read it."
216
+ },
217
+ "code": {
218
+ "type": "string",
219
+ "minLength": 1,
220
+ "maxLength": 256,
221
+ "description": "`refused` only, REQUIRED: the mediator's stable refusal code, the same code a traffic-monitor `refused` event reports."
222
+ },
223
+ "reason": {
224
+ "type": "string",
225
+ "minLength": 1,
226
+ "maxLength": 512,
227
+ "description": "`refused` only, OPTIONAL: a short human-readable explanation. Never message content."
228
+ },
229
+ "ext": {
230
+ "$ref": "#/$defs/Ext",
231
+ "description": "Ecosystem-defined extension members per SPEC.md §4.5.1."
232
+ }
233
+ },
234
+ "$defs": {
235
+ "MemberChange": {
236
+ "title": "MemberChange",
237
+ "type": "object",
238
+ "additionalProperties": false,
239
+ "required": [
240
+ "did",
241
+ "reason"
242
+ ],
243
+ "description": "One member's change in an `attached` or `detached` event.",
244
+ "properties": {
245
+ "did": {
246
+ "$ref": "#/$defs/MuxDid",
247
+ "description": "The member DID."
248
+ },
249
+ "reason": {
250
+ "$ref": "#/$defs/MemberChangeReason",
251
+ "description": "Why the member changed: an AttachReason value in an `attached` event, a DetachReason value in a `detached` event."
252
+ },
253
+ "grantId": {
254
+ "$ref": "#/$defs/GrantId",
255
+ "description": "The grant concerned, where the member is or was attached through one."
256
+ },
257
+ "scope": {
258
+ "$ref": "#/$defs/MuxScope",
259
+ "description": "`attached` only: the scope now in force for the member."
260
+ },
261
+ "expiresAt": {
262
+ "type": "string",
263
+ "format": "date-time",
264
+ "description": "`attached` only: when the membership lapses unless renewed."
265
+ },
266
+ "deliveryActive": {
267
+ "type": "boolean",
268
+ "description": "`attached` only: false while the member DID's own direct connection keeps its live traffic."
269
+ }
270
+ }
271
+ },
272
+ "MuxScope": {
273
+ "title": "MuxScope",
274
+ "type": "array",
275
+ "minItems": 1,
276
+ "maxItems": 16,
277
+ "items": {
278
+ "$ref": "#/$defs/MuxScopeValue"
279
+ },
280
+ "description": "A set of capabilities: a non-empty JSON array of MuxScopeValue, compared as a set — order is not significant and a repeated value collapses into one. Never empty: an empty scope is refused, never read as \"all\". There is no default scope anywhere — every attach and every grant names its scope explicitly. A scope is always bounded by the member DID's own access-control capabilities at the mediator."
281
+ },
282
+ "MuxScopeValue": {
283
+ "title": "MuxScopeValue",
284
+ "type": "string",
285
+ "enum": [
286
+ "receive",
287
+ "pickup",
288
+ "delete",
289
+ "send"
290
+ ],
291
+ "description": "One capability a member DID extends to a principal's connection. `receive`: live delivery of the member's inbound messages on the connection. `pickup`: message-pickup status and delivery requests naming the member as `recipient_did`, and inclusion in a raw-TSP inbox drain. `delete`: deleting the member's stored messages, including delete-on-ack and delete-on-send; a member without `delete` keeps its messages in its inbox until something holding `delete` collects them. `send`: the mediator accepts on this connection frames whose sender is the member DID — the frame is still signed or authcrypted with the member's own keys; the scope only lets the mediator accept it on this socket."
292
+ },
293
+ "GrantId": {
294
+ "title": "GrantId",
295
+ "type": "string",
296
+ "minLength": 1,
297
+ "maxLength": 128,
298
+ "pattern": "^[A-Za-z0-9._:-]+$",
299
+ "description": "A grant's identifier, chosen by the member DID's signer and carried in its grant statement; a UUID is RECOMMENDED. A mediator refuses a grant whose identifier is already on the member DID's record."
300
+ },
301
+ "MemberChangeReason": {
302
+ "title": "MemberChangeReason",
303
+ "type": "string",
304
+ "enum": [
305
+ "connect",
306
+ "grant",
307
+ "attach",
308
+ "reactivated",
309
+ "revokedByMember",
310
+ "revokedByPrincipal",
311
+ "epochBumped",
312
+ "suspendedUnknownKey",
313
+ "keyRotated",
314
+ "expired",
315
+ "accountBlocked",
316
+ "superseded",
317
+ "admin",
318
+ "detachRequested",
319
+ "accountRemoved",
320
+ "resolutionFailed"
321
+ ],
322
+ "description": "The reason carried by one member's change in a messaging/mux/event `attached` or `detached` event: exactly the AttachReason values followed by the DetachReason values, with their meanings. An `attached` event carries only AttachReason values and a `detached` event only DetachReason values. One closed set rather than a union, so every generated binding types it as one enumeration; it MUST be kept equal to the two sets it joins."
323
+ },
324
+ "MuxDid": {
325
+ "title": "MuxDid",
326
+ "type": "string",
327
+ "minLength": 7,
328
+ "maxLength": 2048,
329
+ "pattern": "^did:[a-z0-9]+:\\S+$",
330
+ "description": "A DID, carried verbatim and compared by exact string equality. Unlike the messaging family's `Vid`, never a hash: the mediator resolves it to verify a statement signed by it. For a member DID reached over TSP, the TSP VID is the DID itself."
331
+ },
332
+ "Ext": {
333
+ "title": "Ext",
334
+ "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.",
335
+ "type": "object",
336
+ "minProperties": 1,
337
+ "additionalProperties": true,
338
+ "propertyNames": {
339
+ "pattern": "^[a-z][a-z0-9-]*(\\.[a-z0-9-]+)+$"
340
+ }
341
+ },
342
+ "MuxNonce": {
343
+ "title": "MuxNonce",
344
+ "type": "string",
345
+ "pattern": "^[A-Za-z0-9_-]{43}$",
346
+ "description": "32 random bytes, base64url without padding, that belong to exactly one connection and are never reused. Attach statements sign over it, which is what makes an attach statement unusable on any other connection."
347
+ },
348
+ "SessionId": {
349
+ "title": "SessionId",
350
+ "type": "string",
351
+ "minLength": 1,
352
+ "maxLength": 256,
353
+ "description": "The mediator's identifier for one authenticated connection, as announced in that connection's `ready` event."
354
+ }
355
+ }
356
+ } as const;
357
+
358
+ /**
359
+ * SPEC.md §7.2 policy for the request variant, from this specification's
360
+ * front matter. Pass to `consumeInbound` — items 5b, 7 and 8 are
361
+ * per-specification and cannot be derived from the document alone, and
362
+ * item 2 needs the schema this carries.
363
+ */
364
+ export const SPEC = {
365
+ typeUri: TYPE_URI,
366
+ isBearer: false,
367
+ isProofRequired: false,
368
+ isRecipientRequired: true,
369
+ isIssuedAtRequired: true,
370
+ payloadSchema: PAYLOAD_SCHEMA,
371
+ } as const;