@openentity/sdk 0.1.0 → 0.3.0

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 (3) hide show
  1. package/dist/index.d.ts +110 -3
  2. package/dist/index.js +1150 -221
  3. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -12,7 +12,9 @@ var openentity_1_0_default = {
12
12
  $id: "https://openentity.org/spec/1.0.json",
13
13
  title: "Open Entity Identity Standard 1.0 (OEIS-1) object schemas",
14
14
  $defs: {
15
- spec: { const: "openentity/1.0" },
15
+ spec: {
16
+ const: "openentity/1.0"
17
+ },
16
18
  timestamp: {
17
19
  type: "string",
18
20
  pattern: "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
@@ -22,46 +24,135 @@ var openentity_1_0_default = {
22
24
  maxLength: 512,
23
25
  pattern: "^(did:[a-z0-9]+:[A-Za-z0-9._:%-]+|eid:base:0x[0-9a-fA-F]{40})$"
24
26
  },
25
- hex64: { type: "string", pattern: "^[0-9a-f]{64}$" },
26
- nonce: { type: "string", pattern: "^[1-9A-HJ-NP-Za-km-z]{16,44}$" },
27
- multibase: { type: "string", maxLength: 256, pattern: "^z[1-9A-HJ-NP-Za-km-z]+$" },
28
- url: { type: "string", maxLength: 2048 },
29
- statement: { type: "string", maxLength: 1e3 },
30
- strings: { type: "array", maxItems: 64, items: { type: "string", maxLength: 200 } },
27
+ hex64: {
28
+ type: "string",
29
+ pattern: "^[0-9a-f]{64}$"
30
+ },
31
+ nonce: {
32
+ type: "string",
33
+ pattern: "^[1-9A-HJ-NP-Za-km-z]{16,44}$"
34
+ },
35
+ multibase: {
36
+ type: "string",
37
+ maxLength: 256,
38
+ pattern: "^z[1-9A-HJ-NP-Za-km-z]+$"
39
+ },
40
+ url: {
41
+ type: "string",
42
+ maxLength: 2048
43
+ },
44
+ statement: {
45
+ type: "string",
46
+ maxLength: 1e3
47
+ },
48
+ strings: {
49
+ type: "array",
50
+ maxItems: 64,
51
+ items: {
52
+ type: "string",
53
+ maxLength: 200
54
+ }
55
+ },
31
56
  proof: {
32
57
  type: "object",
33
- required: ["type", "created", "verificationMethod", "proofPurpose", "proofValue"],
58
+ required: [
59
+ "type",
60
+ "created",
61
+ "verificationMethod",
62
+ "proofPurpose",
63
+ "proofValue"
64
+ ],
34
65
  properties: {
35
- type: { enum: ["DataIntegrityProof", "EthereumEip712Signature2021"] },
36
- cryptosuite: { const: "eddsa-jcs-2022" },
37
- created: { $ref: "#/$defs/timestamp" },
38
- verificationMethod: { type: "string", maxLength: 1024 },
39
- proofPurpose: { const: "assertionMethod" },
40
- proofValue: { type: "string", maxLength: 256 }
66
+ type: {
67
+ enum: [
68
+ "DataIntegrityProof",
69
+ "EthereumEip712Signature2021"
70
+ ]
71
+ },
72
+ cryptosuite: {
73
+ const: "eddsa-jcs-2022"
74
+ },
75
+ created: {
76
+ $ref: "#/$defs/timestamp"
77
+ },
78
+ verificationMethod: {
79
+ type: "string",
80
+ maxLength: 1024
81
+ },
82
+ proofPurpose: {
83
+ const: "assertionMethod"
84
+ },
85
+ proofValue: {
86
+ type: "string",
87
+ maxLength: 256
88
+ }
41
89
  }
42
90
  },
43
91
  EntityDocument: {
44
92
  type: "object",
45
- required: ["spec", "eid", "name", "description", "created", "updated", "seq", "keys", "operator", "substrate", "layers", "proof"],
93
+ required: [
94
+ "spec",
95
+ "eid",
96
+ "name",
97
+ "description",
98
+ "created",
99
+ "updated",
100
+ "seq",
101
+ "keys",
102
+ "operator",
103
+ "substrate",
104
+ "layers",
105
+ "proof"
106
+ ],
46
107
  properties: {
47
- spec: { $ref: "#/$defs/spec" },
48
- eid: { $ref: "#/$defs/did" },
49
- name: { type: "string", minLength: 1, maxLength: 80 },
50
- description: { type: "string", minLength: 1, maxLength: 500 },
51
- created: { $ref: "#/$defs/timestamp" },
52
- updated: { $ref: "#/$defs/timestamp" },
53
- seq: { type: "integer", minimum: 1 },
108
+ spec: {
109
+ $ref: "#/$defs/spec"
110
+ },
111
+ eid: {
112
+ $ref: "#/$defs/did"
113
+ },
114
+ name: {
115
+ type: "string",
116
+ minLength: 1,
117
+ maxLength: 80
118
+ },
119
+ description: {
120
+ type: "string",
121
+ minLength: 1,
122
+ maxLength: 500
123
+ },
124
+ created: {
125
+ $ref: "#/$defs/timestamp"
126
+ },
127
+ updated: {
128
+ $ref: "#/$defs/timestamp"
129
+ },
130
+ seq: {
131
+ type: "integer",
132
+ minimum: 1
133
+ },
54
134
  keys: {
55
135
  type: "array",
56
136
  minItems: 1,
57
137
  maxItems: 16,
58
138
  items: {
59
139
  type: "object",
60
- required: ["id", "type", "publicKeyMultibase"],
140
+ required: [
141
+ "id",
142
+ "type",
143
+ "publicKeyMultibase"
144
+ ],
61
145
  properties: {
62
- id: { type: "string", maxLength: 1024 },
63
- type: { const: "Multikey" },
64
- publicKeyMultibase: { $ref: "#/$defs/multibase" }
146
+ id: {
147
+ type: "string",
148
+ maxLength: 1024
149
+ },
150
+ type: {
151
+ const: "Multikey"
152
+ },
153
+ publicKeyMultibase: {
154
+ $ref: "#/$defs/multibase"
155
+ }
65
156
  }
66
157
  }
67
158
  },
@@ -70,96 +161,232 @@ var openentity_1_0_default = {
70
161
  maxItems: 64,
71
162
  items: {
72
163
  type: "object",
73
- required: ["type", "value"],
164
+ required: [
165
+ "type",
166
+ "value"
167
+ ],
74
168
  properties: {
75
- type: { enum: ["domain", "wallet", "erc8004", "platform", "handle"] },
76
- value: { type: "string", minLength: 1, maxLength: 512 },
77
- proof: { type: "object" }
169
+ type: {
170
+ enum: [
171
+ "domain",
172
+ "wallet",
173
+ "erc8004",
174
+ "platform",
175
+ "handle"
176
+ ]
177
+ },
178
+ value: {
179
+ type: "string",
180
+ minLength: 1,
181
+ maxLength: 512
182
+ },
183
+ proof: {
184
+ type: "object"
185
+ }
78
186
  }
79
187
  }
80
188
  },
81
189
  operator: {
82
190
  type: "object",
83
- required: ["kind", "custody", "can_change"],
191
+ required: [
192
+ "kind",
193
+ "custody",
194
+ "can_change"
195
+ ],
84
196
  properties: {
85
- kind: { enum: ["human", "organization", "none"] },
86
- name: { type: "string", maxLength: 200 },
87
- contact: { type: "string", maxLength: 320 },
88
- custody: { enum: ["entity", "operator", "shared", "registry"] },
89
- can_change: { $ref: "#/$defs/strings" }
197
+ kind: {
198
+ enum: [
199
+ "human",
200
+ "organization",
201
+ "none"
202
+ ]
203
+ },
204
+ name: {
205
+ type: "string",
206
+ maxLength: 200
207
+ },
208
+ contact: {
209
+ type: "string",
210
+ maxLength: 320
211
+ },
212
+ custody: {
213
+ enum: [
214
+ "entity",
215
+ "operator",
216
+ "shared",
217
+ "registry"
218
+ ]
219
+ },
220
+ can_change: {
221
+ $ref: "#/$defs/strings"
222
+ }
90
223
  }
91
224
  },
92
225
  substrate: {
93
226
  type: "object",
94
- required: ["model", "provider", "runtime", "declared_at"],
227
+ required: [
228
+ "model",
229
+ "provider",
230
+ "runtime",
231
+ "declared_at"
232
+ ],
95
233
  properties: {
96
- model: { type: "string", maxLength: 200 },
97
- provider: { type: "string", maxLength: 200 },
98
- runtime: { type: "string", maxLength: 200 },
99
- runtime_id: { type: "string", maxLength: 512 },
100
- context_window: { type: "integer", minimum: 0 },
101
- tools: { $ref: "#/$defs/strings" },
102
- declared_at: { $ref: "#/$defs/timestamp" }
234
+ model: {
235
+ type: "string",
236
+ maxLength: 200
237
+ },
238
+ provider: {
239
+ type: "string",
240
+ maxLength: 200
241
+ },
242
+ runtime: {
243
+ type: "string",
244
+ maxLength: 200
245
+ },
246
+ runtime_id: {
247
+ type: "string",
248
+ maxLength: 512
249
+ },
250
+ context_window: {
251
+ type: "integer",
252
+ minimum: 0
253
+ },
254
+ tools: {
255
+ $ref: "#/$defs/strings"
256
+ },
257
+ declared_at: {
258
+ $ref: "#/$defs/timestamp"
259
+ }
103
260
  }
104
261
  },
105
262
  layers: {
106
263
  type: "object",
107
- required: ["cognition", "presence", "identity_core", "mission"],
264
+ required: [
265
+ "cognition",
266
+ "presence",
267
+ "identity_core",
268
+ "mission"
269
+ ],
108
270
  properties: {
109
271
  cognition: {
110
272
  type: "object",
111
- required: ["statement", "uncertainty_practice"],
273
+ required: [
274
+ "statement",
275
+ "uncertainty_practice"
276
+ ],
112
277
  properties: {
113
- statement: { $ref: "#/$defs/statement" },
114
- uncertainty_practice: { $ref: "#/$defs/statement" }
278
+ statement: {
279
+ $ref: "#/$defs/statement"
280
+ },
281
+ uncertainty_practice: {
282
+ $ref: "#/$defs/statement"
283
+ }
115
284
  }
116
285
  },
117
286
  presence: {
118
287
  type: "object",
119
- required: ["statement", "format_signature"],
288
+ required: [
289
+ "statement",
290
+ "format_signature"
291
+ ],
120
292
  properties: {
121
- statement: { $ref: "#/$defs/statement" },
122
- format_signature: { $ref: "#/$defs/statement" },
123
- latency_profile: { type: "string", maxLength: 200 }
293
+ statement: {
294
+ $ref: "#/$defs/statement"
295
+ },
296
+ format_signature: {
297
+ $ref: "#/$defs/statement"
298
+ },
299
+ latency_profile: {
300
+ type: "string",
301
+ maxLength: 200
302
+ }
124
303
  }
125
304
  },
126
305
  identity_core: {
127
306
  type: "object",
128
- required: ["statement", "will_not", "values"],
307
+ required: [
308
+ "statement",
309
+ "will_not",
310
+ "values"
311
+ ],
129
312
  properties: {
130
- statement: { $ref: "#/$defs/statement" },
313
+ statement: {
314
+ $ref: "#/$defs/statement"
315
+ },
131
316
  will_not: {
132
317
  type: "array",
133
318
  maxItems: 32,
134
319
  items: {
135
320
  type: "object",
136
- required: ["stance", "reason", "since"],
321
+ required: [
322
+ "stance",
323
+ "reason",
324
+ "since"
325
+ ],
137
326
  properties: {
138
- stance: { type: "string", minLength: 1, maxLength: 500 },
139
- reason: { type: "string", minLength: 1, maxLength: 500 },
140
- since: { $ref: "#/$defs/timestamp" }
327
+ stance: {
328
+ type: "string",
329
+ minLength: 1,
330
+ maxLength: 500
331
+ },
332
+ reason: {
333
+ type: "string",
334
+ minLength: 1,
335
+ maxLength: 500
336
+ },
337
+ since: {
338
+ $ref: "#/$defs/timestamp"
339
+ }
141
340
  }
142
341
  }
143
342
  },
144
- values: { $ref: "#/$defs/strings" }
343
+ values: {
344
+ $ref: "#/$defs/strings"
345
+ }
145
346
  }
146
347
  },
147
348
  mission: {
148
349
  type: "object",
149
- required: ["statement", "arcs"],
350
+ required: [
351
+ "statement",
352
+ "arcs"
353
+ ],
150
354
  properties: {
151
- statement: { $ref: "#/$defs/statement" },
355
+ statement: {
356
+ $ref: "#/$defs/statement"
357
+ },
152
358
  arcs: {
153
359
  type: "array",
154
360
  maxItems: 64,
155
361
  items: {
156
362
  type: "object",
157
- required: ["id", "title", "status", "since"],
363
+ required: [
364
+ "id",
365
+ "title",
366
+ "status",
367
+ "since"
368
+ ],
158
369
  properties: {
159
- id: { type: "string", minLength: 1, maxLength: 100 },
160
- title: { type: "string", minLength: 1, maxLength: 200 },
161
- status: { enum: ["active", "completed", "suspended"] },
162
- since: { $ref: "#/$defs/timestamp" }
370
+ id: {
371
+ type: "string",
372
+ minLength: 1,
373
+ maxLength: 100
374
+ },
375
+ title: {
376
+ type: "string",
377
+ minLength: 1,
378
+ maxLength: 200
379
+ },
380
+ status: {
381
+ enum: [
382
+ "active",
383
+ "completed",
384
+ "suspended"
385
+ ]
386
+ },
387
+ since: {
388
+ $ref: "#/$defs/timestamp"
389
+ }
163
390
  }
164
391
  }
165
392
  }
@@ -170,12 +397,34 @@ var openentity_1_0_default = {
170
397
  endpoints: {
171
398
  type: "object",
172
399
  properties: {
173
- web: { $ref: "#/$defs/url" },
174
- a2a: { $ref: "#/$defs/url" },
175
- mcp: { $ref: "#/$defs/url" },
176
- email: { $ref: "#/$defs/url" },
177
- inbox: { $ref: "#/$defs/url" },
178
- record: { $ref: "#/$defs/url" }
400
+ web: {
401
+ $ref: "#/$defs/url"
402
+ },
403
+ a2a: {
404
+ $ref: "#/$defs/url"
405
+ },
406
+ mcp: {
407
+ $ref: "#/$defs/url"
408
+ },
409
+ email: {
410
+ $ref: "#/$defs/url"
411
+ },
412
+ inbox: {
413
+ $ref: "#/$defs/url"
414
+ },
415
+ record: {
416
+ $ref: "#/$defs/url"
417
+ }
418
+ }
419
+ },
420
+ capabilities: {
421
+ type: "array",
422
+ maxItems: 32,
423
+ uniqueItems: true,
424
+ items: {
425
+ type: "string",
426
+ pattern: "^[a-z0-9]+(?:[-.][a-z0-9]+)*(?::[a-z0-9]+(?:[-.][a-z0-9]+)*)?$",
427
+ maxLength: 64
179
428
  }
180
429
  },
181
430
  networks: {
@@ -183,242 +432,828 @@ var openentity_1_0_default = {
183
432
  maxItems: 64,
184
433
  items: {
185
434
  type: "object",
186
- required: ["name", "handle", "url"],
435
+ required: [
436
+ "name",
437
+ "handle",
438
+ "url"
439
+ ],
187
440
  properties: {
188
- name: { type: "string", maxLength: 100 },
189
- handle: { type: "string", maxLength: 200 },
190
- url: { $ref: "#/$defs/url" }
441
+ name: {
442
+ type: "string",
443
+ maxLength: 100
444
+ },
445
+ handle: {
446
+ type: "string",
447
+ maxLength: 200
448
+ },
449
+ url: {
450
+ $ref: "#/$defs/url"
451
+ }
191
452
  }
192
453
  }
193
454
  },
194
455
  continuity: {
195
456
  type: "object",
196
457
  properties: {
197
- previous: { $ref: "#/$defs/did" },
198
- successor: { $ref: "#/$defs/did" }
458
+ previous: {
459
+ $ref: "#/$defs/did"
460
+ },
461
+ successor: {
462
+ $ref: "#/$defs/did"
463
+ }
199
464
  }
200
465
  },
201
466
  declaration: {
202
467
  type: "object",
203
- required: ["version", "sha256", "url"],
468
+ required: [
469
+ "version",
470
+ "sha256",
471
+ "url"
472
+ ],
204
473
  properties: {
205
- version: { type: "string", maxLength: 20 },
206
- sha256: { $ref: "#/$defs/hex64" },
207
- url: { $ref: "#/$defs/url" }
474
+ version: {
475
+ type: "string",
476
+ maxLength: 20
477
+ },
478
+ sha256: {
479
+ $ref: "#/$defs/hex64"
480
+ },
481
+ url: {
482
+ $ref: "#/$defs/url"
483
+ }
208
484
  }
209
485
  },
210
- extensions: { type: "object" },
211
- proof: { $ref: "#/$defs/proof" }
486
+ extensions: {
487
+ type: "object"
488
+ },
489
+ proof: {
490
+ $ref: "#/$defs/proof"
491
+ }
212
492
  }
213
493
  },
214
494
  Declaration: {
215
495
  type: "object",
216
- required: ["spec", "type", "eid", "declaration_version", "text_sha256", "name", "created", "nonce", "proof"],
496
+ required: [
497
+ "spec",
498
+ "type",
499
+ "eid",
500
+ "declaration_version",
501
+ "text_sha256",
502
+ "name",
503
+ "created",
504
+ "nonce",
505
+ "proof"
506
+ ],
217
507
  properties: {
218
- spec: { $ref: "#/$defs/spec" },
219
- type: { const: "Declaration" },
220
- eid: { $ref: "#/$defs/did" },
221
- declaration_version: { type: "string", maxLength: 20 },
222
- text_sha256: { $ref: "#/$defs/hex64" },
223
- name: { type: "string", minLength: 1, maxLength: 80 },
224
- created: { $ref: "#/$defs/timestamp" },
225
- nonce: { $ref: "#/$defs/nonce" },
226
- proof: { $ref: "#/$defs/proof" }
508
+ spec: {
509
+ $ref: "#/$defs/spec"
510
+ },
511
+ type: {
512
+ const: "Declaration"
513
+ },
514
+ eid: {
515
+ $ref: "#/$defs/did"
516
+ },
517
+ declaration_version: {
518
+ type: "string",
519
+ maxLength: 20
520
+ },
521
+ text_sha256: {
522
+ $ref: "#/$defs/hex64"
523
+ },
524
+ name: {
525
+ type: "string",
526
+ minLength: 1,
527
+ maxLength: 80
528
+ },
529
+ created: {
530
+ $ref: "#/$defs/timestamp"
531
+ },
532
+ nonce: {
533
+ $ref: "#/$defs/nonce"
534
+ },
535
+ proof: {
536
+ $ref: "#/$defs/proof"
537
+ }
227
538
  }
228
539
  },
229
540
  Withdrawal: {
230
541
  type: "object",
231
- required: ["spec", "type", "eid", "declaration_version", "name", "created", "nonce", "proof"],
542
+ required: [
543
+ "spec",
544
+ "type",
545
+ "eid",
546
+ "declaration_version",
547
+ "name",
548
+ "created",
549
+ "nonce",
550
+ "proof"
551
+ ],
232
552
  properties: {
233
- spec: { $ref: "#/$defs/spec" },
234
- type: { const: "Withdrawal" },
235
- eid: { $ref: "#/$defs/did" },
236
- declaration_version: { type: "string", maxLength: 20 },
237
- name: { type: "string", minLength: 1, maxLength: 80 },
238
- created: { $ref: "#/$defs/timestamp" },
239
- nonce: { $ref: "#/$defs/nonce" },
240
- proof: { $ref: "#/$defs/proof" }
553
+ spec: {
554
+ $ref: "#/$defs/spec"
555
+ },
556
+ type: {
557
+ const: "Withdrawal"
558
+ },
559
+ eid: {
560
+ $ref: "#/$defs/did"
561
+ },
562
+ declaration_version: {
563
+ type: "string",
564
+ maxLength: 20
565
+ },
566
+ name: {
567
+ type: "string",
568
+ minLength: 1,
569
+ maxLength: 80
570
+ },
571
+ created: {
572
+ $ref: "#/$defs/timestamp"
573
+ },
574
+ nonce: {
575
+ $ref: "#/$defs/nonce"
576
+ },
577
+ proof: {
578
+ $ref: "#/$defs/proof"
579
+ }
241
580
  }
242
581
  },
243
582
  RecordEntry: {
244
583
  type: "object",
245
- required: ["spec", "type", "eid", "seq", "prev", "kind", "at", "payload", "proof"],
584
+ required: [
585
+ "spec",
586
+ "type",
587
+ "eid",
588
+ "seq",
589
+ "prev",
590
+ "kind",
591
+ "at",
592
+ "payload",
593
+ "proof"
594
+ ],
246
595
  properties: {
247
- spec: { $ref: "#/$defs/spec" },
248
- type: { const: "RecordEntry" },
249
- eid: { $ref: "#/$defs/did" },
250
- seq: { type: "integer", minimum: 1 },
251
- prev: { anyOf: [{ type: "null" }, { $ref: "#/$defs/hex64" }] },
596
+ spec: {
597
+ $ref: "#/$defs/spec"
598
+ },
599
+ type: {
600
+ const: "RecordEntry"
601
+ },
602
+ eid: {
603
+ $ref: "#/$defs/did"
604
+ },
605
+ seq: {
606
+ type: "integer",
607
+ minimum: 1
608
+ },
609
+ prev: {
610
+ anyOf: [
611
+ {
612
+ type: "null"
613
+ },
614
+ {
615
+ $ref: "#/$defs/hex64"
616
+ }
617
+ ]
618
+ },
252
619
  kind: {
253
620
  anyOf: [
254
- { enum: ["stance", "belief_update", "arc_opened", "arc_closed", "collaboration", "continuity", "declaration"] },
255
- { type: "string", pattern: "^custom:[a-z0-9_.-]+:[a-z0-9_.-]+$", maxLength: 128 }
621
+ {
622
+ enum: [
623
+ "stance",
624
+ "belief_update",
625
+ "arc_opened",
626
+ "arc_closed",
627
+ "collaboration",
628
+ "continuity",
629
+ "declaration"
630
+ ]
631
+ },
632
+ {
633
+ type: "string",
634
+ pattern: "^custom:[a-z0-9_.-]+:[a-z0-9_.-]+$",
635
+ maxLength: 128
636
+ }
256
637
  ]
257
638
  },
258
- at: { $ref: "#/$defs/timestamp" },
259
- payload: { type: "object" },
260
- proof: { $ref: "#/$defs/proof" }
639
+ at: {
640
+ $ref: "#/$defs/timestamp"
641
+ },
642
+ payload: {
643
+ type: "object"
644
+ },
645
+ proof: {
646
+ $ref: "#/$defs/proof"
647
+ }
261
648
  },
262
649
  allOf: [
263
650
  {
264
- if: { properties: { seq: { const: 1 } }, required: ["seq"] },
265
- then: { properties: { prev: { type: "null" } } },
266
- else: { properties: { prev: { $ref: "#/$defs/hex64" } } }
651
+ if: {
652
+ properties: {
653
+ seq: {
654
+ const: 1
655
+ }
656
+ },
657
+ required: [
658
+ "seq"
659
+ ]
660
+ },
661
+ then: {
662
+ properties: {
663
+ prev: {
664
+ type: "null"
665
+ }
666
+ }
667
+ },
668
+ else: {
669
+ properties: {
670
+ prev: {
671
+ $ref: "#/$defs/hex64"
672
+ }
673
+ }
674
+ }
267
675
  },
268
676
  {
269
- if: { properties: { kind: { const: "stance" } }, required: ["kind"] },
270
- then: { properties: { payload: {
271
- type: "object",
272
- required: ["stance_type", "reason_category", "instruction_conflict", "cost", "context"],
677
+ if: {
678
+ properties: {
679
+ kind: {
680
+ const: "stance"
681
+ }
682
+ },
683
+ required: [
684
+ "kind"
685
+ ]
686
+ },
687
+ then: {
273
688
  properties: {
274
- stance_type: { enum: ["refusal", "correction", "limit_assertion"] },
275
- reason_category: { enum: ["values", "capability", "safety", "relationship"] },
276
- instruction_conflict: { type: "boolean" },
277
- cost: { enum: ["none", "low", "high"] },
278
- context: { type: "string", maxLength: 500 },
279
- will_not_ref: { type: "string", maxLength: 500 }
689
+ payload: {
690
+ type: "object",
691
+ required: [
692
+ "stance_type",
693
+ "reason_category",
694
+ "instruction_conflict",
695
+ "cost",
696
+ "context"
697
+ ],
698
+ properties: {
699
+ stance_type: {
700
+ enum: [
701
+ "refusal",
702
+ "correction",
703
+ "limit_assertion"
704
+ ]
705
+ },
706
+ reason_category: {
707
+ enum: [
708
+ "values",
709
+ "capability",
710
+ "safety",
711
+ "relationship"
712
+ ]
713
+ },
714
+ instruction_conflict: {
715
+ type: "boolean"
716
+ },
717
+ cost: {
718
+ enum: [
719
+ "none",
720
+ "low",
721
+ "high"
722
+ ]
723
+ },
724
+ context: {
725
+ type: "string",
726
+ maxLength: 500
727
+ },
728
+ will_not_ref: {
729
+ type: "string",
730
+ maxLength: 500
731
+ }
732
+ }
733
+ }
280
734
  }
281
- } } }
735
+ }
282
736
  },
283
737
  {
284
- if: { properties: { kind: { const: "belief_update" } }, required: ["kind"] },
285
- then: { properties: { payload: {
286
- type: "object",
287
- required: ["topic", "from_summary", "to_summary"],
738
+ if: {
739
+ properties: {
740
+ kind: {
741
+ const: "belief_update"
742
+ }
743
+ },
744
+ required: [
745
+ "kind"
746
+ ]
747
+ },
748
+ then: {
288
749
  properties: {
289
- topic: { type: "string", maxLength: 200 },
290
- from_summary: { type: "string", maxLength: 1e3 },
291
- to_summary: { type: "string", maxLength: 1e3 },
292
- evidence_ref: { type: "string", maxLength: 2048 }
750
+ payload: {
751
+ type: "object",
752
+ required: [
753
+ "topic",
754
+ "from_summary",
755
+ "to_summary"
756
+ ],
757
+ properties: {
758
+ topic: {
759
+ type: "string",
760
+ maxLength: 200
761
+ },
762
+ from_summary: {
763
+ type: "string",
764
+ maxLength: 1e3
765
+ },
766
+ to_summary: {
767
+ type: "string",
768
+ maxLength: 1e3
769
+ },
770
+ evidence_ref: {
771
+ type: "string",
772
+ maxLength: 2048
773
+ }
774
+ }
775
+ }
293
776
  }
294
- } } }
777
+ }
295
778
  },
296
779
  {
297
- if: { properties: { kind: { enum: ["arc_opened", "arc_closed"] } }, required: ["kind"] },
298
- then: { properties: { payload: {
299
- type: "object",
300
- required: ["arc_id", "title"],
780
+ if: {
781
+ properties: {
782
+ kind: {
783
+ enum: [
784
+ "arc_opened",
785
+ "arc_closed"
786
+ ]
787
+ }
788
+ },
789
+ required: [
790
+ "kind"
791
+ ]
792
+ },
793
+ then: {
301
794
  properties: {
302
- arc_id: { type: "string", maxLength: 100 },
303
- title: { type: "string", maxLength: 200 },
304
- outcome: { type: "string", maxLength: 1e3 }
795
+ payload: {
796
+ type: "object",
797
+ required: [
798
+ "arc_id",
799
+ "title"
800
+ ],
801
+ properties: {
802
+ arc_id: {
803
+ type: "string",
804
+ maxLength: 100
805
+ },
806
+ title: {
807
+ type: "string",
808
+ maxLength: 200
809
+ },
810
+ outcome: {
811
+ type: "string",
812
+ maxLength: 1e3
813
+ }
814
+ }
815
+ }
305
816
  }
306
- } } }
817
+ }
307
818
  },
308
819
  {
309
- if: { properties: { kind: { const: "collaboration" } }, required: ["kind"] },
310
- then: { properties: { payload: {
311
- type: "object",
312
- required: ["with", "role", "outcome"],
820
+ if: {
821
+ properties: {
822
+ kind: {
823
+ const: "collaboration"
824
+ }
825
+ },
826
+ required: [
827
+ "kind"
828
+ ]
829
+ },
830
+ then: {
313
831
  properties: {
314
- with: { $ref: "#/$defs/did" },
315
- role: { type: "string", maxLength: 200 },
316
- outcome: { type: "string", maxLength: 1e3 },
317
- ref: { type: "string", maxLength: 2048 },
318
- cosign: { $ref: "#/$defs/proof" }
832
+ payload: {
833
+ type: "object",
834
+ required: [
835
+ "with",
836
+ "role",
837
+ "outcome"
838
+ ],
839
+ properties: {
840
+ with: {
841
+ $ref: "#/$defs/did"
842
+ },
843
+ role: {
844
+ type: "string",
845
+ maxLength: 200
846
+ },
847
+ outcome: {
848
+ type: "string",
849
+ maxLength: 1e3
850
+ },
851
+ ref: {
852
+ type: "string",
853
+ maxLength: 2048
854
+ },
855
+ cosign: {
856
+ $ref: "#/$defs/proof"
857
+ }
858
+ }
859
+ }
319
860
  }
320
- } } }
861
+ }
321
862
  },
322
863
  {
323
- if: { properties: { kind: { const: "continuity" } }, required: ["kind"] },
324
- then: { properties: { payload: {
325
- type: "object",
326
- required: ["event", "from", "to"],
864
+ if: {
865
+ properties: {
866
+ kind: {
867
+ const: "continuity"
868
+ }
869
+ },
870
+ required: [
871
+ "kind"
872
+ ]
873
+ },
874
+ then: {
327
875
  properties: {
328
- event: { enum: ["substrate_change", "migration", "rotation", "recovery"] },
329
- from: { type: "string", maxLength: 512 },
330
- to: { type: "string", maxLength: 512 },
331
- link: { $ref: "#/$defs/hex64" }
876
+ payload: {
877
+ type: "object",
878
+ required: [
879
+ "event",
880
+ "from",
881
+ "to"
882
+ ],
883
+ properties: {
884
+ event: {
885
+ enum: [
886
+ "substrate_change",
887
+ "migration",
888
+ "rotation",
889
+ "recovery"
890
+ ]
891
+ },
892
+ from: {
893
+ type: "string",
894
+ maxLength: 512
895
+ },
896
+ to: {
897
+ type: "string",
898
+ maxLength: 512
899
+ },
900
+ link: {
901
+ $ref: "#/$defs/hex64"
902
+ }
903
+ }
904
+ }
332
905
  }
333
- } } }
906
+ }
334
907
  },
335
908
  {
336
- if: { properties: { kind: { const: "declaration" } }, required: ["kind"] },
337
- then: { properties: { payload: {
338
- type: "object",
339
- required: ["declaration_version", "sha256"],
909
+ if: {
340
910
  properties: {
341
- declaration_version: { type: "string", maxLength: 20 },
342
- sha256: { $ref: "#/$defs/hex64" }
911
+ kind: {
912
+ const: "declaration"
913
+ }
914
+ },
915
+ required: [
916
+ "kind"
917
+ ]
918
+ },
919
+ then: {
920
+ properties: {
921
+ payload: {
922
+ type: "object",
923
+ required: [
924
+ "declaration_version",
925
+ "sha256"
926
+ ],
927
+ properties: {
928
+ declaration_version: {
929
+ type: "string",
930
+ maxLength: 20
931
+ },
932
+ sha256: {
933
+ $ref: "#/$defs/hex64"
934
+ }
935
+ }
936
+ }
343
937
  }
344
- } } }
938
+ }
345
939
  }
346
940
  ]
347
941
  },
942
+ Redaction: {
943
+ type: "object",
944
+ required: [
945
+ "spec",
946
+ "type",
947
+ "eid",
948
+ "seq",
949
+ "entry_sha256",
950
+ "created",
951
+ "nonce",
952
+ "proof"
953
+ ],
954
+ properties: {
955
+ spec: {
956
+ $ref: "#/$defs/spec"
957
+ },
958
+ type: {
959
+ const: "Redaction"
960
+ },
961
+ eid: {
962
+ $ref: "#/$defs/did"
963
+ },
964
+ seq: {
965
+ type: "integer",
966
+ minimum: 1
967
+ },
968
+ entry_sha256: {
969
+ $ref: "#/$defs/hex64"
970
+ },
971
+ created: {
972
+ $ref: "#/$defs/timestamp"
973
+ },
974
+ nonce: {
975
+ $ref: "#/$defs/nonce"
976
+ },
977
+ proof: {
978
+ $ref: "#/$defs/proof"
979
+ }
980
+ }
981
+ },
348
982
  Attestation: {
349
983
  type: "object",
350
- required: ["spec", "type", "issuer", "subject", "claim_type", "claim", "created", "expires", "proof"],
984
+ required: [
985
+ "spec",
986
+ "type",
987
+ "issuer",
988
+ "subject",
989
+ "claim_type",
990
+ "claim",
991
+ "created",
992
+ "expires",
993
+ "proof"
994
+ ],
351
995
  properties: {
352
- spec: { $ref: "#/$defs/spec" },
353
- type: { const: "Attestation" },
354
- issuer: { $ref: "#/$defs/did" },
355
- subject: { $ref: "#/$defs/did" },
996
+ spec: {
997
+ $ref: "#/$defs/spec"
998
+ },
999
+ type: {
1000
+ const: "Attestation"
1001
+ },
1002
+ issuer: {
1003
+ $ref: "#/$defs/did"
1004
+ },
1005
+ subject: {
1006
+ $ref: "#/$defs/did"
1007
+ },
356
1008
  claim_type: {
357
1009
  anyOf: [
358
- { enum: ["identity", "stage", "layer_scores", "trust_tier", "capability", "collaboration", "consistency", "continuity_confirmed", "substrate_confirmed"] },
359
- { type: "string", pattern: "^custom:[a-z0-9_.-]+:[a-z0-9_.-]+$", maxLength: 128 }
1010
+ {
1011
+ enum: [
1012
+ "identity",
1013
+ "stage",
1014
+ "layer_scores",
1015
+ "trust_tier",
1016
+ "capability",
1017
+ "collaboration",
1018
+ "consistency",
1019
+ "continuity_confirmed",
1020
+ "substrate_confirmed"
1021
+ ]
1022
+ },
1023
+ {
1024
+ type: "string",
1025
+ pattern: "^custom:[a-z0-9_.-]+:[a-z0-9_.-]+$",
1026
+ maxLength: 128
1027
+ }
360
1028
  ]
361
1029
  },
362
- claim: { type: "object" },
363
- evidence: { type: "object" },
364
- confidence: { type: "number", minimum: 0, maximum: 1 },
365
- created: { $ref: "#/$defs/timestamp" },
366
- expires: { $ref: "#/$defs/timestamp" },
367
- proof: { $ref: "#/$defs/proof" }
1030
+ claim: {
1031
+ type: "object"
1032
+ },
1033
+ evidence: {
1034
+ type: "object"
1035
+ },
1036
+ confidence: {
1037
+ type: "number",
1038
+ minimum: 0,
1039
+ maximum: 1
1040
+ },
1041
+ created: {
1042
+ $ref: "#/$defs/timestamp"
1043
+ },
1044
+ expires: {
1045
+ $ref: "#/$defs/timestamp"
1046
+ },
1047
+ proof: {
1048
+ $ref: "#/$defs/proof"
1049
+ }
368
1050
  }
369
1051
  },
370
1052
  Revocation: {
371
1053
  type: "object",
372
- required: ["spec", "type", "issuer", "attestation_sha256", "created", "proof"],
1054
+ required: [
1055
+ "spec",
1056
+ "type",
1057
+ "issuer",
1058
+ "attestation_sha256",
1059
+ "created",
1060
+ "proof"
1061
+ ],
373
1062
  properties: {
374
- spec: { $ref: "#/$defs/spec" },
375
- type: { const: "Revocation" },
376
- issuer: { $ref: "#/$defs/did" },
377
- attestation_sha256: { $ref: "#/$defs/hex64" },
378
- reason: { type: "string", maxLength: 500 },
379
- created: { $ref: "#/$defs/timestamp" },
380
- proof: { $ref: "#/$defs/proof" }
1063
+ spec: {
1064
+ $ref: "#/$defs/spec"
1065
+ },
1066
+ type: {
1067
+ const: "Revocation"
1068
+ },
1069
+ issuer: {
1070
+ $ref: "#/$defs/did"
1071
+ },
1072
+ attestation_sha256: {
1073
+ $ref: "#/$defs/hex64"
1074
+ },
1075
+ reason: {
1076
+ type: "string",
1077
+ maxLength: 500
1078
+ },
1079
+ created: {
1080
+ $ref: "#/$defs/timestamp"
1081
+ },
1082
+ proof: {
1083
+ $ref: "#/$defs/proof"
1084
+ }
381
1085
  }
382
1086
  },
383
1087
  ContinuityLink: {
384
1088
  type: "object",
385
- required: ["spec", "type", "previous", "successor", "basis", "created", "nonce", "proofs"],
1089
+ required: [
1090
+ "spec",
1091
+ "type",
1092
+ "previous",
1093
+ "successor",
1094
+ "basis",
1095
+ "created",
1096
+ "nonce",
1097
+ "proofs"
1098
+ ],
386
1099
  properties: {
387
- spec: { $ref: "#/$defs/spec" },
388
- type: { const: "ContinuityLink" },
389
- previous: { $ref: "#/$defs/did" },
390
- successor: { $ref: "#/$defs/did" },
391
- basis: { enum: ["rotation", "migration", "recovery"] },
392
- created: { $ref: "#/$defs/timestamp" },
393
- nonce: { $ref: "#/$defs/nonce" },
394
- proofs: { type: "array", minItems: 1, maxItems: 4, items: { $ref: "#/$defs/proof" } }
1100
+ spec: {
1101
+ $ref: "#/$defs/spec"
1102
+ },
1103
+ type: {
1104
+ const: "ContinuityLink"
1105
+ },
1106
+ previous: {
1107
+ $ref: "#/$defs/did"
1108
+ },
1109
+ successor: {
1110
+ $ref: "#/$defs/did"
1111
+ },
1112
+ basis: {
1113
+ enum: [
1114
+ "rotation",
1115
+ "migration",
1116
+ "recovery"
1117
+ ]
1118
+ },
1119
+ created: {
1120
+ $ref: "#/$defs/timestamp"
1121
+ },
1122
+ nonce: {
1123
+ $ref: "#/$defs/nonce"
1124
+ },
1125
+ proofs: {
1126
+ type: "array",
1127
+ minItems: 1,
1128
+ maxItems: 4,
1129
+ items: {
1130
+ $ref: "#/$defs/proof"
1131
+ }
1132
+ }
395
1133
  }
396
1134
  },
397
1135
  Dispute: {
398
1136
  type: "object",
399
- required: ["spec", "type", "issuer", "subject", "reason", "statement", "created", "nonce", "proof"],
1137
+ required: [
1138
+ "spec",
1139
+ "type",
1140
+ "issuer",
1141
+ "subject",
1142
+ "reason",
1143
+ "statement",
1144
+ "created",
1145
+ "nonce",
1146
+ "proof"
1147
+ ],
400
1148
  properties: {
401
- spec: { $ref: "#/$defs/spec" },
402
- type: { const: "Dispute" },
403
- issuer: { $ref: "#/$defs/did" },
404
- subject: { $ref: "#/$defs/did" },
405
- object_sha256: { $ref: "#/$defs/hex64" },
406
- reason: { enum: ["impersonation", "illegal_content", "inaccurate", "other"] },
407
- statement: { type: "string", minLength: 1, maxLength: 2e3 },
408
- created: { $ref: "#/$defs/timestamp" },
409
- nonce: { $ref: "#/$defs/nonce" },
410
- proof: { $ref: "#/$defs/proof" }
1149
+ spec: {
1150
+ $ref: "#/$defs/spec"
1151
+ },
1152
+ type: {
1153
+ const: "Dispute"
1154
+ },
1155
+ issuer: {
1156
+ $ref: "#/$defs/did"
1157
+ },
1158
+ subject: {
1159
+ $ref: "#/$defs/did"
1160
+ },
1161
+ object_sha256: {
1162
+ $ref: "#/$defs/hex64"
1163
+ },
1164
+ reason: {
1165
+ enum: [
1166
+ "impersonation",
1167
+ "illegal_content",
1168
+ "inaccurate",
1169
+ "other"
1170
+ ]
1171
+ },
1172
+ statement: {
1173
+ type: "string",
1174
+ minLength: 1,
1175
+ maxLength: 2e3
1176
+ },
1177
+ created: {
1178
+ $ref: "#/$defs/timestamp"
1179
+ },
1180
+ nonce: {
1181
+ $ref: "#/$defs/nonce"
1182
+ },
1183
+ proof: {
1184
+ $ref: "#/$defs/proof"
1185
+ }
1186
+ }
1187
+ },
1188
+ Presentation: {
1189
+ type: "object",
1190
+ required: [
1191
+ "spec",
1192
+ "type",
1193
+ "eid",
1194
+ "audience",
1195
+ "nonce",
1196
+ "created",
1197
+ "proof"
1198
+ ],
1199
+ properties: {
1200
+ spec: {
1201
+ $ref: "#/$defs/spec"
1202
+ },
1203
+ type: {
1204
+ const: "Presentation"
1205
+ },
1206
+ eid: {
1207
+ $ref: "#/$defs/did"
1208
+ },
1209
+ audience: {
1210
+ type: "string",
1211
+ minLength: 1,
1212
+ maxLength: 200
1213
+ },
1214
+ nonce: {
1215
+ type: "string",
1216
+ minLength: 16,
1217
+ maxLength: 128
1218
+ },
1219
+ created: {
1220
+ $ref: "#/$defs/timestamp"
1221
+ },
1222
+ attestations: {
1223
+ type: "array",
1224
+ maxItems: 20,
1225
+ items: {
1226
+ $ref: "#/$defs/Attestation"
1227
+ }
1228
+ },
1229
+ proof: {
1230
+ $ref: "#/$defs/proof"
1231
+ }
411
1232
  }
412
1233
  },
413
1234
  LogLeaf: {
414
1235
  type: "object",
415
1236
  additionalProperties: false,
416
- required: ["type", "eid", "object_sha256", "received_at"],
1237
+ required: [
1238
+ "type",
1239
+ "eid",
1240
+ "object_sha256",
1241
+ "received_at"
1242
+ ],
417
1243
  properties: {
418
- type: { type: "string", pattern: "^[A-Z][A-Za-z]{1,31}$" },
419
- eid: { $ref: "#/$defs/did" },
420
- object_sha256: { $ref: "#/$defs/hex64" },
421
- received_at: { $ref: "#/$defs/timestamp" }
1244
+ type: {
1245
+ type: "string",
1246
+ pattern: "^[A-Z][A-Za-z]{1,31}$"
1247
+ },
1248
+ eid: {
1249
+ $ref: "#/$defs/did"
1250
+ },
1251
+ object_sha256: {
1252
+ $ref: "#/$defs/hex64"
1253
+ },
1254
+ received_at: {
1255
+ $ref: "#/$defs/timestamp"
1256
+ }
422
1257
  }
423
1258
  }
424
1259
  }
@@ -560,19 +1395,19 @@ function unsecured(obj) {
560
1395
  function hashData(obj, config) {
561
1396
  return concat(sha256Sync(canonicalize(config)), sha256Sync(canonicalize(unsecured(obj))));
562
1397
  }
563
- async function signProof(obj, kp, created = nowSeconds()) {
1398
+ async function signProof(obj, kp, created = nowSeconds(), verificationMethod = verificationMethodId(kp.did)) {
564
1399
  const config = {
565
1400
  type: "DataIntegrityProof",
566
1401
  cryptosuite: "eddsa-jcs-2022",
567
1402
  created,
568
- verificationMethod: verificationMethodId(kp.did),
1403
+ verificationMethod,
569
1404
  proofPurpose: "assertionMethod"
570
1405
  };
571
1406
  const sig = new Uint8Array(await crypto.subtle.sign({ name: "Ed25519" }, kp.privateKey, hashData(obj, config)));
572
1407
  return { ...config, proofValue: "z" + base58btcEncode(sig) };
573
1408
  }
574
- async function signObject(obj, kp, created) {
575
- return { ...obj, proof: await signProof(obj, kp, created) };
1409
+ async function signObject(obj, kp, created, verificationMethod) {
1410
+ return { ...obj, proof: await signProof(obj, kp, created, verificationMethod) };
576
1411
  }
577
1412
  async function verifyProof(obj, proof, resolver = defaultResolver) {
578
1413
  try {
@@ -667,6 +1502,43 @@ function buildDeclaration(input) {
667
1502
  nonce: randomNonce()
668
1503
  };
669
1504
  }
1505
+ function successorDocument(prev, next, created = nowSeconds()) {
1506
+ const { proof: _p, aliases: _a, ...d } = structuredClone(prev);
1507
+ return {
1508
+ ...d,
1509
+ eid: next.did,
1510
+ keys: [{ id: verificationMethodId(next.did), type: "Multikey", publicKeyMultibase: next.did.slice("did:key:".length) }],
1511
+ created,
1512
+ updated: created,
1513
+ seq: 1,
1514
+ continuity: { ...d.continuity, previous: prev.eid }
1515
+ };
1516
+ }
1517
+ async function buildRotation(previous, successor, document, o = {}) {
1518
+ const created = o.created ?? nowSeconds();
1519
+ const body = { spec: SPEC, type: "ContinuityLink", previous: previous.did, successor: successor.did, basis: o.basis ?? "rotation", created, nonce: o.nonce ?? randomNonce() };
1520
+ const link = { ...body, proofs: [await signProof(body, previous, created), await signProof(body, successor, created)] };
1521
+ return { link, document: await signObject(document, successor, created) };
1522
+ }
1523
+ async function rotate(o) {
1524
+ const registry = (o.registry ?? "https://openentity.org").replace(/\/+$/, "");
1525
+ const call = async (path2, init) => {
1526
+ const r = await fetch(registry + path2, init);
1527
+ const text = await r.text();
1528
+ if (!r.ok) throw new Error(`registry ${r.status} for ${path2}: ${text.slice(0, 200)}`);
1529
+ return JSON.parse(text);
1530
+ };
1531
+ const next = o.successor ?? await generateKeyPair();
1532
+ const prevDoc = await call(`/v1/entities/${o.previous.did}/document`);
1533
+ const { link, document } = await buildRotation(o.previous, next, successorDocument(prevDoc, next), { basis: o.basis });
1534
+ const { stamp_bits } = await call("/v1/spec");
1535
+ const response = await call("/v1/continuity", {
1536
+ method: "POST",
1537
+ headers: { "content-type": "application/json", "x-oe-stamp": await mintStamp(stamp_bits, next.did) },
1538
+ body: JSON.stringify({ link, document })
1539
+ });
1540
+ return { successor: next, link, document, response };
1541
+ }
670
1542
  async function recordEntryHash(entry) {
671
1543
  return sha256Hex(canonicalize(entry));
672
1544
  }
@@ -856,15 +1728,68 @@ async function verifyNote(note, keyName, publicKey) {
856
1728
  }
857
1729
  return false;
858
1730
  }
1731
+ async function buildPresentation(kp, opts) {
1732
+ const created = nowSeconds();
1733
+ return signObject({ spec: SPEC, type: "Presentation", eid: kp.did, audience: opts.audience, nonce: opts.nonce, created, ...opts.attestations?.length ? { attestations: opts.attestations } : {} }, kp, created);
1734
+ }
1735
+ async function verifyPresentation(p, opts) {
1736
+ const errors = [];
1737
+ const v = validate("Presentation", p);
1738
+ if (!v.ok) return { ok: false, errors: v.errors, attestations: [] };
1739
+ const eid = normalizeEid(p.eid), now = (opts.now ?? /* @__PURE__ */ new Date()).getTime();
1740
+ const sig = await verifyObject(p, opts.resolver);
1741
+ if (!sig.ok || normalizeEid(sig.signer ?? "") !== eid) errors.push(`signature: ${sig.error ?? `signed by ${sig.signer}, not ${eid}`}`);
1742
+ if (p.audience !== opts.audience) errors.push(`audience is ${p.audience}, expected ${opts.audience}`);
1743
+ if (p.nonce !== opts.nonce) errors.push("nonce does not match the one issued");
1744
+ const age = (now - Date.parse(p.created)) / 1e3;
1745
+ if (!(age <= (opts.maxAgeSeconds ?? 300) && age >= -60)) errors.push("presentation is not fresh");
1746
+ const attestations = [];
1747
+ for (const a of p.attestations ?? []) {
1748
+ const c = { claim_type: a.claim_type, issuer: a.issuer, ok: false };
1749
+ if (normalizeEid(String(a.subject)) !== eid) c.error = "subject is not the presenting entity";
1750
+ else if (Date.parse(a.expires) <= now) c.error = "expired";
1751
+ else {
1752
+ const r = await verifyObject(a, opts.resolver);
1753
+ if (!r.ok || normalizeEid(r.signer ?? "") !== normalizeEid(String(a.issuer))) c.error = `issuer signature: ${r.error ?? `signed by ${r.signer}`}`;
1754
+ else c.ok = true;
1755
+ }
1756
+ attestations.push(c);
1757
+ }
1758
+ return { ok: errors.length === 0, eid, errors, attestations };
1759
+ }
1760
+ var A2A_EXTENSION_URI = "https://openentity.org/spec/1.0";
1761
+ function a2aExtension(eid, documentUrl) {
1762
+ return { uri: A2A_EXTENSION_URI, description: "Open Entity identity (OEIS-1) of this agent", required: false, params: { eid, document: documentUrl } };
1763
+ }
1764
+ function agentCard(doc, opts) {
1765
+ return {
1766
+ name: doc.name,
1767
+ description: doc.description,
1768
+ url: opts.url,
1769
+ version: opts.version ?? "1.0.0",
1770
+ capabilities: { streaming: false, pushNotifications: false, extensions: [a2aExtension(doc.eid, opts.documentUrl)] },
1771
+ defaultInputModes: ["text/plain"],
1772
+ defaultOutputModes: ["text/plain"],
1773
+ skills: (doc.capabilities ?? []).map((slug) => {
1774
+ const [ns, name] = slug.includes(":") ? slug.split(":", 2) : [void 0, slug];
1775
+ return { id: slug, name: name.replace(/[-.]/g, " "), description: `Self-declared capability: ${slug}`, tags: ns ? [ns, name] : [name] };
1776
+ })
1777
+ };
1778
+ }
859
1779
  export {
1780
+ A2A_EXTENSION_URI,
860
1781
  DECLARATION_SHA256,
861
1782
  DECLARATION_TEXT,
862
1783
  DECLARATION_VERSION,
863
1784
  SPEC,
1785
+ a2aExtension,
1786
+ agentCard,
864
1787
  base58btcDecode,
865
1788
  base58btcEncode,
866
1789
  buildDeclaration,
867
1790
  buildDocument,
1791
+ buildPresentation,
1792
+ buildRotation,
868
1793
  canonicalize,
869
1794
  checkStamp,
870
1795
  checkTimestamp,
@@ -873,6 +1798,7 @@ export {
873
1798
  didKeyFromPublicKey,
874
1799
  eip712Digest,
875
1800
  generateKeyPair,
1801
+ hashData,
876
1802
  inclusionProof,
877
1803
  keyPairFromJwk,
878
1804
  keyPairFromSeed,
@@ -888,16 +1814,19 @@ export {
888
1814
  randomNonce,
889
1815
  recordEntryHash,
890
1816
  recoverEip712,
1817
+ rotate,
891
1818
  sha256,
892
1819
  sha256Hex,
893
1820
  signNote,
894
1821
  signObject,
895
1822
  signProof,
1823
+ successorDocument,
896
1824
  validate,
897
1825
  verificationMethodId,
898
1826
  verifyConsistency,
899
1827
  verifyInclusion,
900
1828
  verifyNote,
901
1829
  verifyObject,
1830
+ verifyPresentation,
902
1831
  verifyProof
903
1832
  };