@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,173 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://bsv-blockchain.github.io/dpp/contracts/publisher-policy.schema.json",
4
+ "title": "DPP publisher key policy, version 1",
5
+ "description": "The bounded set of keys authorised to countersign admitted states and anchors for an operator or a federation (spec/services.md section 1). Each policy version is a complete statement; a new version names the digest of the one it supersedes and is authorised by a signature that the previous version's rules accept. A retired key keeps authenticating the states it signed while active, and a state is checked against the key active at the state's time, never against the newest list. Canonical JSON for this document: object keys sorted recursively by code point, no whitespace, arrays in order, undefined members omitted, and only strings, booleans and safe integers as values.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "policyFormat",
10
+ "policyVersion",
11
+ "scope",
12
+ "issuedAt",
13
+ "publishers",
14
+ "authorisation"
15
+ ],
16
+ "properties": {
17
+ "policyFormat": {
18
+ "const": "dpp-publisher-policy@1"
19
+ },
20
+ "policyVersion": {
21
+ "type": "integer",
22
+ "minimum": 1,
23
+ "description": "Strictly increasing within one scope."
24
+ },
25
+ "scope": {
26
+ "type": "object",
27
+ "additionalProperties": false,
28
+ "required": [
29
+ "operatorProfile",
30
+ "operators"
31
+ ],
32
+ "properties": {
33
+ "operatorProfile": {
34
+ "enum": [
35
+ "single-operator@1",
36
+ "federated-operators@1"
37
+ ]
38
+ },
39
+ "operators": {
40
+ "type": "array",
41
+ "minItems": 1,
42
+ "maxItems": 64,
43
+ "uniqueItems": true,
44
+ "items": {
45
+ "type": "string",
46
+ "minLength": 1,
47
+ "description": "Operator identifiers: a DID or a named deployment. Operator identity is distinct from every publisher key below."
48
+ }
49
+ },
50
+ "topics": {
51
+ "type": "array",
52
+ "items": {
53
+ "type": "string"
54
+ },
55
+ "description": "The topics the policy covers; absent means every topic the operators serve."
56
+ }
57
+ }
58
+ },
59
+ "issuedAt": {
60
+ "$ref": "#/$defs/dateTime"
61
+ },
62
+ "supersedes": {
63
+ "type": "object",
64
+ "additionalProperties": false,
65
+ "required": [
66
+ "policyVersion",
67
+ "sha256"
68
+ ],
69
+ "properties": {
70
+ "policyVersion": {
71
+ "type": "integer",
72
+ "minimum": 1
73
+ },
74
+ "sha256": {
75
+ "type": "string",
76
+ "pattern": "^[0-9a-f]{64}$",
77
+ "description": "SHA-256 of the superseded policy's canonical JSON, signatures included, so history is a chain and no version is silently rewritten."
78
+ }
79
+ }
80
+ },
81
+ "publishers": {
82
+ "type": "array",
83
+ "minItems": 1,
84
+ "maxItems": 256,
85
+ "items": {
86
+ "type": "object",
87
+ "additionalProperties": false,
88
+ "required": [
89
+ "key",
90
+ "role",
91
+ "activeFrom"
92
+ ],
93
+ "properties": {
94
+ "key": {
95
+ "type": "string",
96
+ "pattern": "^0[23][0-9a-f]{64}$",
97
+ "description": "Compressed public key. For tm_dpp this is the identity key the service's BRC-42 countersignature derives from; for anchors it is the service identity the anchor's field-8 key derives from."
98
+ },
99
+ "role": {
100
+ "enum": [
101
+ "state-publisher",
102
+ "anchor-publisher"
103
+ ]
104
+ },
105
+ "operator": {
106
+ "type": "string",
107
+ "description": "Which operator holds the key; absent in a single-operator scope."
108
+ },
109
+ "activeFrom": {
110
+ "$ref": "#/$defs/dateTime"
111
+ },
112
+ "retiredAt": {
113
+ "$ref": "#/$defs/dateTime",
114
+ "description": "After this instant the key authorises nothing new; states it signed while active remain authentic."
115
+ },
116
+ "custody": {
117
+ "type": "string",
118
+ "description": "Where the key lives, in the vocabulary of spec/custody.md section 5; informative."
119
+ }
120
+ }
121
+ }
122
+ },
123
+ "authorisation": {
124
+ "type": "object",
125
+ "additionalProperties": false,
126
+ "required": [
127
+ "kind",
128
+ "signer",
129
+ "suite",
130
+ "value"
131
+ ],
132
+ "properties": {
133
+ "kind": {
134
+ "enum": [
135
+ "genesis",
136
+ "rotation",
137
+ "handover"
138
+ ],
139
+ "description": "genesis: the first version of a scope, authorised by the identity key of an operator named in scope.operators; rotation: the same operators replace keys, authorised by a key active under the superseded version and, in a federation, countersigned by another operator's identity key; handover: the operator set changes, authorised by a key active under the superseded version and countersigned by an incoming operator's identity key."
140
+ },
141
+ "signer": {
142
+ "type": "string",
143
+ "pattern": "^0[23][0-9a-f]{64}$"
144
+ },
145
+ "suite": {
146
+ "const": "bsv-ecdsa-der",
147
+ "description": "ECDSA over SHA-256 of the canonical JSON of this document without authorisation.value and authorisation.countersignature, DER encoded; the countersignature, when present, is over the same bytes."
148
+ },
149
+ "value": {
150
+ "type": "string",
151
+ "pattern": "^[0-9a-f]+$"
152
+ },
153
+ "countersigner": {
154
+ "type": "string",
155
+ "pattern": "^0[23][0-9a-f]{64}$"
156
+ },
157
+ "countersignature": {
158
+ "type": "string",
159
+ "pattern": "^[0-9a-f]+$"
160
+ }
161
+ }
162
+ },
163
+ "notes": {
164
+ "type": "string"
165
+ }
166
+ },
167
+ "$defs": {
168
+ "dateTime": {
169
+ "type": "string",
170
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$"
171
+ }
172
+ }
173
+ }
@@ -0,0 +1,397 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://bsv-blockchain.github.io/dpp/contracts/verification-report.schema.json",
4
+ "title": "DPP verification report, version 1",
5
+ "description": "The report a verifier produces for one passport's evidence, as spec/verification.md defines. Sixteen named checks, four answers each, an independently expected subject, and an observation of the latest state that is never a proof.",
6
+ "type": "object",
7
+ "additionalProperties": false,
8
+ "required": [
9
+ "reportVersion",
10
+ "checkedAt",
11
+ "expectedSubject",
12
+ "suppliedTip",
13
+ "policyId",
14
+ "checks",
15
+ "observations",
16
+ "limits"
17
+ ],
18
+ "properties": {
19
+ "reportVersion": {
20
+ "const": "1"
21
+ },
22
+ "checkedAt": {
23
+ "$ref": "#/$defs/dateTime"
24
+ },
25
+ "expectedSubject": {
26
+ "$ref": "#/$defs/expectedSubject"
27
+ },
28
+ "suppliedTip": {
29
+ "oneOf": [
30
+ {
31
+ "$ref": "#/$defs/outpoint"
32
+ },
33
+ {
34
+ "type": "null"
35
+ }
36
+ ]
37
+ },
38
+ "policyId": {
39
+ "type": "string",
40
+ "minLength": 1,
41
+ "maxLength": 256
42
+ },
43
+ "checks": {
44
+ "type": "array",
45
+ "minItems": 16,
46
+ "maxItems": 16,
47
+ "items": {
48
+ "$ref": "#/$defs/check"
49
+ },
50
+ "description": "Exactly one entry per check name, in the order the $defs/checkName enumeration lists them."
51
+ },
52
+ "observations": {
53
+ "$ref": "#/$defs/observations"
54
+ },
55
+ "limits": {
56
+ "type": "array",
57
+ "items": {
58
+ "type": "string",
59
+ "minLength": 1
60
+ }
61
+ }
62
+ },
63
+ "$defs": {
64
+ "dateTime": {
65
+ "type": "string",
66
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$"
67
+ },
68
+ "txid": {
69
+ "type": "string",
70
+ "pattern": "^[0-9a-f]{64}$"
71
+ },
72
+ "outpoint": {
73
+ "type": "object",
74
+ "additionalProperties": false,
75
+ "required": [
76
+ "txid",
77
+ "outputIndex"
78
+ ],
79
+ "properties": {
80
+ "txid": {
81
+ "$ref": "#/$defs/txid"
82
+ },
83
+ "outputIndex": {
84
+ "type": "integer",
85
+ "minimum": 0
86
+ }
87
+ }
88
+ },
89
+ "expectedSubject": {
90
+ "type": "object",
91
+ "additionalProperties": false,
92
+ "required": [
93
+ "passportId",
94
+ "source"
95
+ ],
96
+ "properties": {
97
+ "passportId": {
98
+ "type": "string",
99
+ "minLength": 1,
100
+ "maxLength": 512
101
+ },
102
+ "source": {
103
+ "enum": [
104
+ "request-context",
105
+ "established-binding",
106
+ "none"
107
+ ]
108
+ },
109
+ "productIdentifier": {
110
+ "type": "string",
111
+ "minLength": 1,
112
+ "maxLength": 512
113
+ },
114
+ "expectedIssuer": {
115
+ "type": "string",
116
+ "minLength": 1,
117
+ "maxLength": 512
118
+ },
119
+ "expectedGenesisOutpoint": {
120
+ "$ref": "#/$defs/outpoint"
121
+ },
122
+ "expectedStateOutpoint": {
123
+ "$ref": "#/$defs/outpoint"
124
+ }
125
+ }
126
+ },
127
+ "checkName": {
128
+ "enum": [
129
+ "recordEncoding",
130
+ "actorSignatures",
131
+ "publisherSignatures",
132
+ "linkage",
133
+ "inclusion",
134
+ "nativeAttestationSignature",
135
+ "anchorSignature",
136
+ "anchorKeyDerivation",
137
+ "anchorDigestAndMetadataBinding",
138
+ "externalCredentialProof",
139
+ "subjectBinding",
140
+ "issuerAuthority",
141
+ "schema",
142
+ "credentialTime",
143
+ "credentialStatus",
144
+ "evidenceAvailability"
145
+ ]
146
+ },
147
+ "checkStatus": {
148
+ "enum": [
149
+ "pass",
150
+ "fail",
151
+ "unknown",
152
+ "not-applicable"
153
+ ]
154
+ },
155
+ "reasonCode": {
156
+ "type": "string",
157
+ "description": "A shared code from the sharedReasonCode list, or an implementation code beginning with x-.",
158
+ "anyOf": [
159
+ {
160
+ "$ref": "#/$defs/sharedReasonCode"
161
+ },
162
+ {
163
+ "pattern": "^x-[a-z0-9]+(-[a-z0-9]+)*$"
164
+ }
165
+ ]
166
+ },
167
+ "sharedReasonCode": {
168
+ "enum": [
169
+ "no-evidence",
170
+ "not-selected",
171
+ "publisher-not-selected",
172
+ "publisher-not-authorised",
173
+ "publisher-policy-invalid",
174
+ "decode-failed",
175
+ "signature-invalid",
176
+ "key-derivation-mismatch",
177
+ "link-broken",
178
+ "consent-not-proven",
179
+ "acceptance-commitment-absent",
180
+ "version-transition-invalid",
181
+ "control-not-proven",
182
+ "lineage-retired",
183
+ "proof-absent",
184
+ "proof-refuted",
185
+ "header-source-unavailable",
186
+ "digest-mismatch",
187
+ "metadata-mismatch",
188
+ "secured-bytes-absent",
189
+ "representation-unsupported",
190
+ "suite-unsupported",
191
+ "no-external-credential",
192
+ "subject-mismatch",
193
+ "subject-not-independent",
194
+ "genesis-ambiguous",
195
+ "genesis-mismatch",
196
+ "state-mismatch",
197
+ "issuer-mismatch",
198
+ "policy-missing",
199
+ "authority-not-required",
200
+ "authority-unconfirmed",
201
+ "authority-unavailable",
202
+ "schema-invalid",
203
+ "schema-unavailable",
204
+ "not-yet-valid",
205
+ "expired",
206
+ "time-invalid",
207
+ "status-unset",
208
+ "status-revoked",
209
+ "status-suspended",
210
+ "status-unknown",
211
+ "status-unauthenticated",
212
+ "status-stale",
213
+ "status-purpose-unsupported",
214
+ "format-defines-no-status",
215
+ "referenced-artefact-unavailable",
216
+ "referenced-artefact-mismatch",
217
+ "verifier-not-supplied",
218
+ "not-inspected",
219
+ "resource-limit"
220
+ ]
221
+ },
222
+ "check": {
223
+ "type": "object",
224
+ "additionalProperties": false,
225
+ "required": [
226
+ "name",
227
+ "status",
228
+ "evidenceRefs"
229
+ ],
230
+ "properties": {
231
+ "name": {
232
+ "$ref": "#/$defs/checkName"
233
+ },
234
+ "status": {
235
+ "$ref": "#/$defs/checkStatus"
236
+ },
237
+ "reasonCode": {
238
+ "$ref": "#/$defs/reasonCode"
239
+ },
240
+ "evidenceRefs": {
241
+ "type": "array",
242
+ "items": {
243
+ "type": "string",
244
+ "minLength": 1
245
+ }
246
+ },
247
+ "scope": {
248
+ "type": "object",
249
+ "additionalProperties": false,
250
+ "properties": {
251
+ "artefact": {
252
+ "type": "string"
253
+ },
254
+ "digest": {
255
+ "type": "string",
256
+ "pattern": "^[0-9a-f]{64}$"
257
+ },
258
+ "outpoint": {
259
+ "$ref": "#/$defs/outpoint"
260
+ },
261
+ "stateIndex": {
262
+ "type": "integer",
263
+ "minimum": 0
264
+ }
265
+ }
266
+ },
267
+ "detail": {}
268
+ },
269
+ "allOf": [
270
+ {
271
+ "if": {
272
+ "properties": {
273
+ "status": {
274
+ "enum": [
275
+ "fail",
276
+ "unknown",
277
+ "not-applicable"
278
+ ]
279
+ }
280
+ }
281
+ },
282
+ "then": {
283
+ "required": [
284
+ "reasonCode"
285
+ ]
286
+ }
287
+ },
288
+ {
289
+ "if": {
290
+ "properties": {
291
+ "status": {
292
+ "const": "pass"
293
+ }
294
+ }
295
+ },
296
+ "then": {
297
+ "properties": {
298
+ "evidenceRefs": {
299
+ "minItems": 1
300
+ }
301
+ }
302
+ }
303
+ }
304
+ ]
305
+ },
306
+ "observationSource": {
307
+ "type": "object",
308
+ "additionalProperties": false,
309
+ "required": [
310
+ "id",
311
+ "kind",
312
+ "observedAt",
313
+ "result"
314
+ ],
315
+ "properties": {
316
+ "id": {
317
+ "type": "string",
318
+ "minLength": 1
319
+ },
320
+ "kind": {
321
+ "enum": [
322
+ "overlay-lookup",
323
+ "spend-status",
324
+ "header-source",
325
+ "registry",
326
+ "other"
327
+ ]
328
+ },
329
+ "observedAt": {
330
+ "$ref": "#/$defs/dateTime"
331
+ },
332
+ "result": {
333
+ "enum": [
334
+ "unspent",
335
+ "spent",
336
+ "not-found",
337
+ "unavailable",
338
+ "conflicting"
339
+ ]
340
+ },
341
+ "height": {
342
+ "type": "integer",
343
+ "minimum": 0
344
+ },
345
+ "blockHash": {
346
+ "type": "string",
347
+ "pattern": "^[0-9a-f]{64}$"
348
+ },
349
+ "spendingTxid": {
350
+ "$ref": "#/$defs/txid"
351
+ },
352
+ "detail": {
353
+ "type": "string"
354
+ }
355
+ }
356
+ },
357
+ "observations": {
358
+ "type": "object",
359
+ "additionalProperties": false,
360
+ "required": [
361
+ "latestState",
362
+ "sources",
363
+ "queryScope",
364
+ "observedAt",
365
+ "candidateOutpoints"
366
+ ],
367
+ "properties": {
368
+ "latestState": {
369
+ "enum": [
370
+ "observed",
371
+ "superseded",
372
+ "conflicting",
373
+ "unknown"
374
+ ]
375
+ },
376
+ "sources": {
377
+ "type": "array",
378
+ "items": {
379
+ "$ref": "#/$defs/observationSource"
380
+ }
381
+ },
382
+ "queryScope": {
383
+ "type": "string"
384
+ },
385
+ "observedAt": {
386
+ "$ref": "#/$defs/dateTime"
387
+ },
388
+ "candidateOutpoints": {
389
+ "type": "array",
390
+ "items": {
391
+ "$ref": "#/$defs/outpoint"
392
+ }
393
+ }
394
+ }
395
+ }
396
+ }
397
+ }