@bsv/dpp-core 0.3.0-beta.1

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 (86) hide show
  1. package/LICENSE +58 -0
  2. package/README.md +95 -0
  3. package/dist/acceptance.d.ts +100 -0
  4. package/dist/acceptance.d.ts.map +1 -0
  5. package/dist/acceptance.js +202 -0
  6. package/dist/acceptance.js.map +1 -0
  7. package/dist/anchor.d.ts +66 -0
  8. package/dist/anchor.d.ts.map +1 -0
  9. package/dist/anchor.js +145 -0
  10. package/dist/anchor.js.map +1 -0
  11. package/dist/attestation.d.ts +40 -0
  12. package/dist/attestation.d.ts.map +1 -0
  13. package/dist/attestation.js +111 -0
  14. package/dist/attestation.js.map +1 -0
  15. package/dist/blob.d.ts +11 -0
  16. package/dist/blob.d.ts.map +1 -0
  17. package/dist/blob.js +16 -0
  18. package/dist/blob.js.map +1 -0
  19. package/dist/canonical.d.ts +32 -0
  20. package/dist/canonical.d.ts.map +1 -0
  21. package/dist/canonical.js +54 -0
  22. package/dist/canonical.js.map +1 -0
  23. package/dist/canonicalJson.d.ts +22 -0
  24. package/dist/canonicalJson.d.ts.map +1 -0
  25. package/dist/canonicalJson.js +60 -0
  26. package/dist/canonicalJson.js.map +1 -0
  27. package/dist/codec.d.ts +45 -0
  28. package/dist/codec.d.ts.map +1 -0
  29. package/dist/codec.js +459 -0
  30. package/dist/codec.js.map +1 -0
  31. package/dist/constants.d.ts +150 -0
  32. package/dist/constants.d.ts.map +1 -0
  33. package/dist/constants.js +179 -0
  34. package/dist/constants.js.map +1 -0
  35. package/dist/did.d.ts +37 -0
  36. package/dist/did.d.ts.map +1 -0
  37. package/dist/did.js +129 -0
  38. package/dist/did.js.map +1 -0
  39. package/dist/evidence.d.ts +224 -0
  40. package/dist/evidence.d.ts.map +1 -0
  41. package/dist/evidence.js +716 -0
  42. package/dist/evidence.js.map +1 -0
  43. package/dist/evidencePackage.d.ts +114 -0
  44. package/dist/evidencePackage.d.ts.map +1 -0
  45. package/dist/evidencePackage.js +164 -0
  46. package/dist/evidencePackage.js.map +1 -0
  47. package/dist/index.d.ts +31 -0
  48. package/dist/index.d.ts.map +1 -0
  49. package/dist/index.js +31 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/owner.d.ts +135 -0
  52. package/dist/owner.d.ts.map +1 -0
  53. package/dist/owner.js +181 -0
  54. package/dist/owner.js.map +1 -0
  55. package/dist/publisherPolicy.d.ts +70 -0
  56. package/dist/publisherPolicy.d.ts.map +1 -0
  57. package/dist/publisherPolicy.js +186 -0
  58. package/dist/publisherPolicy.js.map +1 -0
  59. package/dist/signatures.d.ts +84 -0
  60. package/dist/signatures.d.ts.map +1 -0
  61. package/dist/signatures.js +137 -0
  62. package/dist/signatures.js.map +1 -0
  63. package/dist/transition.d.ts +29 -0
  64. package/dist/transition.d.ts.map +1 -0
  65. package/dist/transition.js +117 -0
  66. package/dist/transition.js.map +1 -0
  67. package/dist/types.d.ts +135 -0
  68. package/dist/types.d.ts.map +1 -0
  69. package/dist/types.js +2 -0
  70. package/dist/types.js.map +1 -0
  71. package/dist/verifyChain.d.ts +152 -0
  72. package/dist/verifyChain.d.ts.map +1 -0
  73. package/dist/verifyChain.js +314 -0
  74. package/dist/verifyChain.js.map +1 -0
  75. package/package.json +46 -0
  76. package/schemas/capabilities.schema.json +129 -0
  77. package/schemas/epcis-import.schema.json +212 -0
  78. package/schemas/evidence-export.schema.json +67 -0
  79. package/schemas/evidence-package.schema.json +307 -0
  80. package/schemas/native-evidence-extension.schema.json +66 -0
  81. package/schemas/paginated-history.schema.json +32 -0
  82. package/schemas/passport-projection.schema.json +151 -0
  83. package/schemas/passport-source.schema.json +370 -0
  84. package/schemas/profile-evidence.schema.json +706 -0
  85. package/schemas/publisher-policy.schema.json +173 -0
  86. package/schemas/verification-report.schema.json +397 -0
@@ -0,0 +1,706 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://bsv-blockchain.github.io/dpp/contracts/profile-evidence.schema.json",
4
+ "title": "DPP profile evidence shapes, version 1",
5
+ "description": "The shared shapes an industry profile field or a passport projection carries when a value is more than a scalar (spec/passport-projections.md section 5): a claim's evidence, a certification, a measurement or assessment, a related document, a language-tagged text, a date with its precision, and warranty terms with a derived expiry. Reused by profile manifests of version 2 through their value types and by passport-projection@1. None of these is a credential format and none makes a value true: a scheme homepage or an issuer signature alone never proves a certification valid, a document URL is not a content commitment, and a date is never made more precise than its source.",
6
+ "type": "object",
7
+ "$defs": {
8
+ "datePrecision": {
9
+ "enum": [
10
+ "day",
11
+ "month",
12
+ "year"
13
+ ],
14
+ "description": "How precise a date is. A month-precision date is written YYYY-MM and never given a day; a year-precision date is written YYYY."
15
+ },
16
+ "hex64": {
17
+ "type": "string",
18
+ "pattern": "^[0-9a-f]{64}$"
19
+ },
20
+ "dayDate": {
21
+ "type": "string",
22
+ "pattern": "^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$"
23
+ },
24
+ "monthDate": {
25
+ "type": "string",
26
+ "pattern": "^\\d{4}-(0[1-9]|1[0-2])$"
27
+ },
28
+ "yearDate": {
29
+ "type": "string",
30
+ "pattern": "^\\d{4}$"
31
+ },
32
+ "dateOrDateTime": {
33
+ "type": "string",
34
+ "pattern": "^\\d{4}(-(0[1-9]|1[0-2])(-(0[1-9]|[12]\\d|3[01])(T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2}))?)?)?$",
35
+ "description": "A year, a month, a day or an instant; the precision the shape declares says which is meant."
36
+ },
37
+ "preciseDate": {
38
+ "type": "object",
39
+ "additionalProperties": false,
40
+ "required": [
41
+ "date",
42
+ "precision"
43
+ ],
44
+ "properties": {
45
+ "date": {
46
+ "type": "string"
47
+ },
48
+ "precision": {
49
+ "$ref": "#/$defs/datePrecision"
50
+ }
51
+ },
52
+ "allOf": [
53
+ {
54
+ "if": {
55
+ "properties": {
56
+ "precision": {
57
+ "const": "day"
58
+ }
59
+ }
60
+ },
61
+ "then": {
62
+ "properties": {
63
+ "date": {
64
+ "$ref": "#/$defs/dayDate"
65
+ }
66
+ }
67
+ }
68
+ },
69
+ {
70
+ "if": {
71
+ "properties": {
72
+ "precision": {
73
+ "const": "month"
74
+ }
75
+ }
76
+ },
77
+ "then": {
78
+ "properties": {
79
+ "date": {
80
+ "$ref": "#/$defs/monthDate"
81
+ }
82
+ }
83
+ }
84
+ },
85
+ {
86
+ "if": {
87
+ "properties": {
88
+ "precision": {
89
+ "const": "year"
90
+ }
91
+ }
92
+ },
93
+ "then": {
94
+ "properties": {
95
+ "date": {
96
+ "$ref": "#/$defs/yearDate"
97
+ }
98
+ }
99
+ }
100
+ }
101
+ ]
102
+ },
103
+ "subjectRef": {
104
+ "type": "object",
105
+ "additionalProperties": false,
106
+ "required": [
107
+ "id",
108
+ "granularity"
109
+ ],
110
+ "properties": {
111
+ "id": {
112
+ "type": "string",
113
+ "minLength": 1,
114
+ "maxLength": 512
115
+ },
116
+ "granularity": {
117
+ "enum": [
118
+ "model",
119
+ "batch",
120
+ "item",
121
+ "component"
122
+ ]
123
+ },
124
+ "componentRef": {
125
+ "type": "string",
126
+ "minLength": 1,
127
+ "maxLength": 512,
128
+ "description": "The component this evidence covers, when the granularity is component; a component need not have a token."
129
+ }
130
+ }
131
+ },
132
+ "sourceRef": {
133
+ "type": "object",
134
+ "additionalProperties": false,
135
+ "required": [
136
+ "kind",
137
+ "id"
138
+ ],
139
+ "properties": {
140
+ "kind": {
141
+ "enum": [
142
+ "source-revision",
143
+ "credential",
144
+ "document"
145
+ ]
146
+ },
147
+ "id": {
148
+ "type": "string",
149
+ "minLength": 1
150
+ },
151
+ "revisionId": {
152
+ "type": "string",
153
+ "minLength": 1
154
+ },
155
+ "digest": {
156
+ "$ref": "#/$defs/hex64"
157
+ }
158
+ }
159
+ },
160
+ "relevantTime": {
161
+ "type": "object",
162
+ "additionalProperties": false,
163
+ "required": [
164
+ "precision"
165
+ ],
166
+ "properties": {
167
+ "at": {
168
+ "$ref": "#/$defs/dateOrDateTime"
169
+ },
170
+ "from": {
171
+ "$ref": "#/$defs/dateOrDateTime"
172
+ },
173
+ "until": {
174
+ "$ref": "#/$defs/dateOrDateTime"
175
+ },
176
+ "precision": {
177
+ "$ref": "#/$defs/datePrecision"
178
+ }
179
+ }
180
+ },
181
+ "claimEvidence": {
182
+ "type": "object",
183
+ "additionalProperties": false,
184
+ "required": [
185
+ "property",
186
+ "subject",
187
+ "source"
188
+ ],
189
+ "properties": {
190
+ "property": {
191
+ "type": "string",
192
+ "pattern": "^/",
193
+ "description": "The JSON pointer of the field the evidence is about."
194
+ },
195
+ "subject": {
196
+ "$ref": "#/$defs/subjectRef"
197
+ },
198
+ "source": {
199
+ "$ref": "#/$defs/sourceRef"
200
+ },
201
+ "reporter": {
202
+ "type": "string",
203
+ "minLength": 1,
204
+ "description": "Who reported the fact, when that is not the issuer of the source."
205
+ },
206
+ "issuer": {
207
+ "type": "string",
208
+ "minLength": 1
209
+ },
210
+ "relevantTime": {
211
+ "$ref": "#/$defs/relevantTime"
212
+ },
213
+ "reportRef": {
214
+ "type": "string",
215
+ "minLength": 1,
216
+ "description": "A verification report the evidence was evaluated in."
217
+ }
218
+ }
219
+ },
220
+ "certification": {
221
+ "type": "object",
222
+ "additionalProperties": false,
223
+ "required": [
224
+ "scheme",
225
+ "certificateId",
226
+ "issuer",
227
+ "subject",
228
+ "verification"
229
+ ],
230
+ "description": "A certificate as evidence. The scheme's homepage and the issuer's signature are inputs to a verification; only verification.status says what was established, and unknown is not a pass.",
231
+ "properties": {
232
+ "scheme": {
233
+ "type": "object",
234
+ "additionalProperties": false,
235
+ "required": [
236
+ "id",
237
+ "name"
238
+ ],
239
+ "properties": {
240
+ "id": {
241
+ "type": "string",
242
+ "minLength": 1
243
+ },
244
+ "name": {
245
+ "type": "string",
246
+ "minLength": 1
247
+ },
248
+ "version": {
249
+ "type": "string"
250
+ }
251
+ }
252
+ },
253
+ "certificateId": {
254
+ "type": "string",
255
+ "minLength": 1
256
+ },
257
+ "issuer": {
258
+ "type": "string",
259
+ "minLength": 1,
260
+ "description": "The certification body or issuer as named on the certificate."
261
+ },
262
+ "subject": {
263
+ "$ref": "#/$defs/subjectRef"
264
+ },
265
+ "validFrom": {
266
+ "$ref": "#/$defs/dateOrDateTime"
267
+ },
268
+ "validUntil": {
269
+ "$ref": "#/$defs/dateOrDateTime"
270
+ },
271
+ "precision": {
272
+ "$ref": "#/$defs/datePrecision"
273
+ },
274
+ "documentRef": {
275
+ "$ref": "#/$defs/relatedDocument"
276
+ },
277
+ "credentialRef": {
278
+ "type": "object",
279
+ "additionalProperties": false,
280
+ "required": [
281
+ "id"
282
+ ],
283
+ "properties": {
284
+ "id": {
285
+ "type": "string",
286
+ "minLength": 1
287
+ },
288
+ "digest": {
289
+ "$ref": "#/$defs/hex64"
290
+ }
291
+ }
292
+ },
293
+ "verification": {
294
+ "type": "object",
295
+ "additionalProperties": false,
296
+ "required": [
297
+ "status"
298
+ ],
299
+ "properties": {
300
+ "status": {
301
+ "enum": [
302
+ "verified",
303
+ "failed",
304
+ "unknown",
305
+ "not-checked"
306
+ ]
307
+ },
308
+ "checkedAt": {
309
+ "$ref": "#/$defs/dateOrDateTime"
310
+ },
311
+ "reportRef": {
312
+ "type": "string",
313
+ "minLength": 1
314
+ }
315
+ }
316
+ }
317
+ }
318
+ },
319
+ "quantity": {
320
+ "type": "object",
321
+ "additionalProperties": false,
322
+ "required": [
323
+ "value",
324
+ "unit"
325
+ ],
326
+ "properties": {
327
+ "value": {
328
+ "type": "number"
329
+ },
330
+ "unit": {
331
+ "type": "string",
332
+ "minLength": 1
333
+ }
334
+ }
335
+ },
336
+ "measurement": {
337
+ "type": "object",
338
+ "additionalProperties": false,
339
+ "required": [
340
+ "property",
341
+ "value",
342
+ "unit",
343
+ "subject"
344
+ ],
345
+ "description": "A measured or assessed value with the scope that makes it comparable: the unit, the basis (a fraction is not a percent), the functional unit or denominator, the method and its version, the boundary and conditions, when it was measured and for which subject. A value that is a string carries a basis, because a bare string cannot be compared.",
346
+ "properties": {
347
+ "property": {
348
+ "type": "string",
349
+ "minLength": 1
350
+ },
351
+ "value": {
352
+ "type": [
353
+ "number",
354
+ "string"
355
+ ]
356
+ },
357
+ "unit": {
358
+ "type": "string",
359
+ "minLength": 1
360
+ },
361
+ "basis": {
362
+ "$ref": "#/$defs/measurementBasis"
363
+ },
364
+ "functionalUnit": {
365
+ "type": "string",
366
+ "minLength": 1
367
+ },
368
+ "denominator": {
369
+ "$ref": "#/$defs/quantity"
370
+ },
371
+ "method": {
372
+ "type": "object",
373
+ "additionalProperties": false,
374
+ "required": [
375
+ "id"
376
+ ],
377
+ "properties": {
378
+ "id": {
379
+ "type": "string",
380
+ "minLength": 1
381
+ },
382
+ "version": {
383
+ "type": "string"
384
+ }
385
+ }
386
+ },
387
+ "boundary": {
388
+ "type": "string",
389
+ "minLength": 1
390
+ },
391
+ "conditions": {
392
+ "type": "string",
393
+ "minLength": 1
394
+ },
395
+ "measuredAt": {
396
+ "$ref": "#/$defs/preciseDate"
397
+ },
398
+ "effective": {
399
+ "type": "object",
400
+ "additionalProperties": false,
401
+ "properties": {
402
+ "from": {
403
+ "$ref": "#/$defs/dateOrDateTime"
404
+ },
405
+ "until": {
406
+ "$ref": "#/$defs/dateOrDateTime"
407
+ }
408
+ }
409
+ },
410
+ "subject": {
411
+ "$ref": "#/$defs/subjectRef"
412
+ },
413
+ "evidence": {
414
+ "type": "array",
415
+ "items": {
416
+ "$ref": "#/$defs/claimEvidence"
417
+ }
418
+ },
419
+ "conversion": {
420
+ "type": "object",
421
+ "additionalProperties": false,
422
+ "required": [
423
+ "fromUnit",
424
+ "toUnit",
425
+ "rule",
426
+ "explicit"
427
+ ],
428
+ "description": "Present only when the value was converted from its source unit under a stated rule; a converted value never loses its source unit.",
429
+ "properties": {
430
+ "fromUnit": {
431
+ "type": "string",
432
+ "minLength": 1
433
+ },
434
+ "toUnit": {
435
+ "type": "string",
436
+ "minLength": 1
437
+ },
438
+ "rule": {
439
+ "type": "string",
440
+ "minLength": 1
441
+ },
442
+ "explicit": {
443
+ "const": true
444
+ }
445
+ }
446
+ }
447
+ },
448
+ "allOf": [
449
+ {
450
+ "if": {
451
+ "properties": {
452
+ "value": {
453
+ "type": "string"
454
+ }
455
+ }
456
+ },
457
+ "then": {
458
+ "properties": {
459
+ "basis": {
460
+ "$ref": "#/$defs/measurementBasis"
461
+ }
462
+ },
463
+ "required": [
464
+ "basis"
465
+ ]
466
+ }
467
+ }
468
+ ]
469
+ },
470
+ "relatedDocument": {
471
+ "type": "object",
472
+ "additionalProperties": false,
473
+ "required": [
474
+ "ref",
475
+ "purpose",
476
+ "retained",
477
+ "access"
478
+ ],
479
+ "description": "A document a value points at. A URL is where the document was seen, not a commitment to its content; only retained bytes carry a digest.",
480
+ "properties": {
481
+ "ref": {
482
+ "type": "string",
483
+ "minLength": 1
484
+ },
485
+ "purpose": {
486
+ "type": "string",
487
+ "minLength": 1
488
+ },
489
+ "url": {
490
+ "type": "string",
491
+ "format": "uri"
492
+ },
493
+ "mediaType": {
494
+ "type": "string",
495
+ "minLength": 1
496
+ },
497
+ "language": {
498
+ "type": "string",
499
+ "pattern": "^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$"
500
+ },
501
+ "revision": {
502
+ "type": "string"
503
+ },
504
+ "date": {
505
+ "$ref": "#/$defs/dateOrDateTime"
506
+ },
507
+ "precision": {
508
+ "$ref": "#/$defs/datePrecision"
509
+ },
510
+ "digest": {
511
+ "$ref": "#/$defs/hex64"
512
+ },
513
+ "byteLength": {
514
+ "type": "integer",
515
+ "minimum": 0
516
+ },
517
+ "retained": {
518
+ "type": "boolean"
519
+ },
520
+ "access": {
521
+ "enum": [
522
+ "public",
523
+ "owner",
524
+ "legitimate",
525
+ "authority"
526
+ ]
527
+ }
528
+ },
529
+ "allOf": [
530
+ {
531
+ "if": {
532
+ "properties": {
533
+ "retained": {
534
+ "const": true
535
+ }
536
+ }
537
+ },
538
+ "then": {
539
+ "properties": {
540
+ "digest": {
541
+ "$ref": "#/$defs/hex64"
542
+ },
543
+ "byteLength": {
544
+ "type": "integer",
545
+ "minimum": 0
546
+ }
547
+ },
548
+ "required": [
549
+ "digest",
550
+ "byteLength"
551
+ ]
552
+ }
553
+ }
554
+ ]
555
+ },
556
+ "localisedText": {
557
+ "type": "object",
558
+ "additionalProperties": false,
559
+ "required": [
560
+ "values"
561
+ ],
562
+ "description": "Text in one or more languages as the source supplied it. A reader selects the exact tag, then the base language, then the declared default, and records which; it never rewrites a value as another language.",
563
+ "properties": {
564
+ "values": {
565
+ "type": "array",
566
+ "minItems": 1,
567
+ "items": {
568
+ "type": "object",
569
+ "additionalProperties": false,
570
+ "required": [
571
+ "language",
572
+ "text"
573
+ ],
574
+ "properties": {
575
+ "language": {
576
+ "type": "string",
577
+ "pattern": "^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$"
578
+ },
579
+ "text": {
580
+ "type": "string"
581
+ }
582
+ }
583
+ }
584
+ },
585
+ "returnedLanguage": {
586
+ "type": "string",
587
+ "pattern": "^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$"
588
+ },
589
+ "selection": {
590
+ "enum": [
591
+ "exact",
592
+ "base",
593
+ "default"
594
+ ]
595
+ }
596
+ }
597
+ },
598
+ "warrantyTerms": {
599
+ "type": "object",
600
+ "additionalProperties": false,
601
+ "required": [
602
+ "duration",
603
+ "calendarRule"
604
+ ],
605
+ "description": "A model's warranty terms: a duration and the calendar rule that says what the duration counts from. Terms alone give no expiry.",
606
+ "properties": {
607
+ "duration": {
608
+ "type": "object",
609
+ "additionalProperties": false,
610
+ "required": [
611
+ "value",
612
+ "unit"
613
+ ],
614
+ "properties": {
615
+ "value": {
616
+ "type": "integer",
617
+ "minimum": 1
618
+ },
619
+ "unit": {
620
+ "enum": [
621
+ "months",
622
+ "years"
623
+ ]
624
+ }
625
+ }
626
+ },
627
+ "calendarRule": {
628
+ "enum": [
629
+ "purchase-date",
630
+ "manufacture-date",
631
+ "first-use"
632
+ ]
633
+ },
634
+ "conditions": {
635
+ "type": "string"
636
+ }
637
+ }
638
+ },
639
+ "warrantyExpiry": {
640
+ "type": "object",
641
+ "additionalProperties": false,
642
+ "required": [
643
+ "start",
644
+ "terms",
645
+ "derived"
646
+ ],
647
+ "description": "An item's derived warranty expiry: the evidenced start, the terms applied and the derived date at the precision the start permits. A month-precision start yields a month, never an invented day.",
648
+ "properties": {
649
+ "start": {
650
+ "type": "object",
651
+ "additionalProperties": false,
652
+ "required": [
653
+ "date",
654
+ "precision",
655
+ "evidenceRef"
656
+ ],
657
+ "properties": {
658
+ "date": {
659
+ "type": "string"
660
+ },
661
+ "precision": {
662
+ "$ref": "#/$defs/datePrecision"
663
+ },
664
+ "evidenceRef": {
665
+ "type": "string",
666
+ "minLength": 1
667
+ }
668
+ }
669
+ },
670
+ "terms": {
671
+ "$ref": "#/$defs/warrantyTerms"
672
+ },
673
+ "derived": {
674
+ "type": "object",
675
+ "additionalProperties": false,
676
+ "required": [
677
+ "date",
678
+ "precision",
679
+ "rule"
680
+ ],
681
+ "properties": {
682
+ "date": {
683
+ "type": "string"
684
+ },
685
+ "precision": {
686
+ "$ref": "#/$defs/datePrecision"
687
+ },
688
+ "rule": {
689
+ "type": "string",
690
+ "minLength": 1
691
+ }
692
+ }
693
+ }
694
+ }
695
+ },
696
+ "measurementBasis": {
697
+ "enum": [
698
+ "fraction",
699
+ "percent",
700
+ "mass",
701
+ "count",
702
+ "per-functional-unit"
703
+ ]
704
+ }
705
+ }
706
+ }