@bsv/vsc 0.2.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 (64) hide show
  1. package/LICENSE +58 -0
  2. package/README.md +107 -0
  3. package/artifacts/context-0.1.0.jsonld +127 -0
  4. package/artifacts/disclosure-0.1.0.schema.json +526 -0
  5. package/artifacts/epcis/NOTICE.md +11 -0
  6. package/artifacts/epcis/epcis-context-2.0.1.jsonld +593 -0
  7. package/artifacts/epcis/epcis-json-schema-2.0.1.json +2352 -0
  8. package/artifacts/epcis/query-schema-2.0.1.json +968 -0
  9. package/artifacts/external/NOTICE.md +3 -0
  10. package/artifacts/external/dpp-external-passport-1.context.jsonld +8 -0
  11. package/artifacts/external/dpp-external-passport-1.schema.json +158 -0
  12. package/artifacts/profile-0.1.0.json +100 -0
  13. package/artifacts/seal-0.1.0.schema.json +535 -0
  14. package/artifacts/w3c/NOTICE.md +3 -0
  15. package/artifacts/w3c/credentials-v2.jsonld +340 -0
  16. package/dist/context.d.ts +9 -0
  17. package/dist/context.d.ts.map +1 -0
  18. package/dist/context.js +50 -0
  19. package/dist/context.js.map +1 -0
  20. package/dist/crypto.d.ts +50 -0
  21. package/dist/crypto.d.ts.map +1 -0
  22. package/dist/crypto.js +141 -0
  23. package/dist/crypto.js.map +1 -0
  24. package/dist/did-web.d.ts +9 -0
  25. package/dist/did-web.d.ts.map +1 -0
  26. package/dist/did-web.js +66 -0
  27. package/dist/did-web.js.map +1 -0
  28. package/dist/epcis-source.d.ts +251 -0
  29. package/dist/epcis-source.d.ts.map +1 -0
  30. package/dist/epcis-source.js +573 -0
  31. package/dist/epcis-source.js.map +1 -0
  32. package/dist/epcis.d.ts +51 -0
  33. package/dist/epcis.d.ts.map +1 -0
  34. package/dist/epcis.js +171 -0
  35. package/dist/epcis.js.map +1 -0
  36. package/dist/exchange.d.ts +175 -0
  37. package/dist/exchange.d.ts.map +1 -0
  38. package/dist/exchange.js +491 -0
  39. package/dist/exchange.js.map +1 -0
  40. package/dist/index.d.ts +10 -0
  41. package/dist/index.d.ts.map +1 -0
  42. package/dist/index.js +10 -0
  43. package/dist/index.js.map +1 -0
  44. package/dist/jcs.d.ts +25 -0
  45. package/dist/jcs.d.ts.map +1 -0
  46. package/dist/jcs.js +67 -0
  47. package/dist/jcs.js.map +1 -0
  48. package/dist/schema.d.ts +414 -0
  49. package/dist/schema.d.ts.map +1 -0
  50. package/dist/schema.js +537 -0
  51. package/dist/schema.js.map +1 -0
  52. package/dist/types.d.ts +159 -0
  53. package/dist/types.d.ts.map +1 -0
  54. package/dist/types.js +2 -0
  55. package/dist/types.js.map +1 -0
  56. package/dist/validation.d.ts +22 -0
  57. package/dist/validation.d.ts.map +1 -0
  58. package/dist/validation.js +147 -0
  59. package/dist/validation.js.map +1 -0
  60. package/dist/verification.d.ts +10 -0
  61. package/dist/verification.d.ts.map +1 -0
  62. package/dist/verification.js +350 -0
  63. package/dist/verification.js.map +1 -0
  64. package/package.json +68 -0
@@ -0,0 +1,340 @@
1
+ {
2
+ "@context": {
3
+ "@protected": true,
4
+
5
+ "id": "@id",
6
+ "type": "@type",
7
+
8
+ "description": "https://schema.org/description",
9
+ "digestMultibase": {
10
+ "@id": "https://w3id.org/security#digestMultibase",
11
+ "@type": "https://w3id.org/security#multibase"
12
+ },
13
+ "digestSRI": {
14
+ "@id": "https://www.w3.org/2018/credentials#digestSRI",
15
+ "@type": "https://www.w3.org/2018/credentials#sriString"
16
+ },
17
+ "mediaType": {
18
+ "@id": "https://schema.org/encodingFormat"
19
+ },
20
+ "name": "https://schema.org/name",
21
+
22
+ "VerifiableCredential": {
23
+ "@id": "https://www.w3.org/2018/credentials#VerifiableCredential",
24
+ "@context": {
25
+ "@protected": true,
26
+
27
+ "id": "@id",
28
+ "type": "@type",
29
+
30
+ "confidenceMethod": {
31
+ "@id": "https://www.w3.org/2018/credentials#confidenceMethod",
32
+ "@type": "@id"
33
+ },
34
+ "credentialSchema": {
35
+ "@id": "https://www.w3.org/2018/credentials#credentialSchema",
36
+ "@type": "@id"
37
+ },
38
+ "credentialStatus": {
39
+ "@id": "https://www.w3.org/2018/credentials#credentialStatus",
40
+ "@type": "@id"
41
+ },
42
+ "credentialSubject": {
43
+ "@id": "https://www.w3.org/2018/credentials#credentialSubject",
44
+ "@type": "@id"
45
+ },
46
+ "description": "https://schema.org/description",
47
+ "evidence": {
48
+ "@id": "https://www.w3.org/2018/credentials#evidence",
49
+ "@type": "@id"
50
+ },
51
+ "issuer": {
52
+ "@id": "https://www.w3.org/2018/credentials#issuer",
53
+ "@type": "@id"
54
+ },
55
+ "name": "https://schema.org/name",
56
+ "proof": {
57
+ "@id": "https://w3id.org/security#proof",
58
+ "@type": "@id",
59
+ "@container": "@graph"
60
+ },
61
+ "refreshService": {
62
+ "@id": "https://www.w3.org/2018/credentials#refreshService",
63
+ "@type": "@id"
64
+ },
65
+ "relatedResource": {
66
+ "@id": "https://www.w3.org/2018/credentials#relatedResource",
67
+ "@type": "@id"
68
+ },
69
+ "renderMethod": {
70
+ "@id": "https://www.w3.org/2018/credentials#renderMethod",
71
+ "@type": "@id"
72
+ },
73
+ "termsOfUse": {
74
+ "@id": "https://www.w3.org/2018/credentials#termsOfUse",
75
+ "@type": "@id"
76
+ },
77
+ "validFrom": {
78
+ "@id": "https://www.w3.org/2018/credentials#validFrom",
79
+ "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
80
+ },
81
+ "validUntil": {
82
+ "@id": "https://www.w3.org/2018/credentials#validUntil",
83
+ "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
84
+ }
85
+ }
86
+ },
87
+
88
+ "EnvelopedVerifiableCredential":
89
+ "https://www.w3.org/2018/credentials#EnvelopedVerifiableCredential",
90
+
91
+ "VerifiablePresentation": {
92
+ "@id": "https://www.w3.org/2018/credentials#VerifiablePresentation",
93
+ "@context": {
94
+ "@protected": true,
95
+
96
+ "id": "@id",
97
+ "type": "@type",
98
+
99
+ "holder": {
100
+ "@id": "https://www.w3.org/2018/credentials#holder",
101
+ "@type": "@id"
102
+ },
103
+ "proof": {
104
+ "@id": "https://w3id.org/security#proof",
105
+ "@type": "@id",
106
+ "@container": "@graph"
107
+ },
108
+ "termsOfUse": {
109
+ "@id": "https://www.w3.org/2018/credentials#termsOfUse",
110
+ "@type": "@id"
111
+ },
112
+ "verifiableCredential": {
113
+ "@id": "https://www.w3.org/2018/credentials#verifiableCredential",
114
+ "@type": "@id",
115
+ "@container": "@graph",
116
+ "@context": null
117
+ }
118
+ }
119
+ },
120
+
121
+ "EnvelopedVerifiablePresentation":
122
+ "https://www.w3.org/2018/credentials#EnvelopedVerifiablePresentation",
123
+
124
+ "JsonSchemaCredential":
125
+ "https://www.w3.org/2018/credentials#JsonSchemaCredential",
126
+
127
+ "JsonSchema": {
128
+ "@id": "https://www.w3.org/2018/credentials#JsonSchema",
129
+ "@context": {
130
+ "@protected": true,
131
+
132
+ "id": "@id",
133
+ "type": "@type",
134
+
135
+ "jsonSchema": {
136
+ "@id": "https://www.w3.org/2018/credentials#jsonSchema",
137
+ "@type": "@json"
138
+ }
139
+ }
140
+ },
141
+
142
+ "BitstringStatusListCredential":
143
+ "https://www.w3.org/ns/credentials/status#BitstringStatusListCredential",
144
+
145
+ "BitstringStatusList": {
146
+ "@id": "https://www.w3.org/ns/credentials/status#BitstringStatusList",
147
+ "@context": {
148
+ "@protected": true,
149
+
150
+ "id": "@id",
151
+ "type": "@type",
152
+
153
+ "encodedList": {
154
+ "@id": "https://www.w3.org/ns/credentials/status#encodedList",
155
+ "@type": "https://w3id.org/security#multibase"
156
+ },
157
+ "statusPurpose":
158
+ "https://www.w3.org/ns/credentials/status#statusPurpose",
159
+ "ttl": "https://www.w3.org/ns/credentials/status#ttl"
160
+ }
161
+ },
162
+
163
+ "BitstringStatusListEntry": {
164
+ "@id":
165
+ "https://www.w3.org/ns/credentials/status#BitstringStatusListEntry",
166
+ "@context": {
167
+ "@protected": true,
168
+
169
+ "id": "@id",
170
+ "type": "@type",
171
+
172
+ "statusListCredential": {
173
+ "@id":
174
+ "https://www.w3.org/ns/credentials/status#statusListCredential",
175
+ "@type": "@id"
176
+ },
177
+ "statusListIndex":
178
+ "https://www.w3.org/ns/credentials/status#statusListIndex",
179
+ "statusPurpose":
180
+ "https://www.w3.org/ns/credentials/status#statusPurpose",
181
+ "statusMessage": {
182
+ "@id": "https://www.w3.org/ns/credentials/status#statusMessage",
183
+ "@context": {
184
+ "@protected": true,
185
+
186
+ "id": "@id",
187
+ "type": "@type",
188
+
189
+ "message": "https://www.w3.org/ns/credentials/status#message",
190
+ "status": "https://www.w3.org/ns/credentials/status#status"
191
+ }
192
+ },
193
+ "statusReference": {
194
+ "@id": "https://www.w3.org/ns/credentials/status#statusReference",
195
+ "@type": "@id"
196
+ },
197
+ "statusSize": {
198
+ "@id": "https://www.w3.org/ns/credentials/status#statusSize",
199
+ "@type": "https://www.w3.org/2001/XMLSchema#integer"
200
+ }
201
+ }
202
+ },
203
+
204
+ "DataIntegrityProof": {
205
+ "@id": "https://w3id.org/security#DataIntegrityProof",
206
+ "@context": {
207
+ "@protected": true,
208
+
209
+ "id": "@id",
210
+ "type": "@type",
211
+
212
+ "challenge": "https://w3id.org/security#challenge",
213
+ "created": {
214
+ "@id": "http://purl.org/dc/terms/created",
215
+ "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
216
+ },
217
+ "cryptosuite": {
218
+ "@id": "https://w3id.org/security#cryptosuite",
219
+ "@type": "https://w3id.org/security#cryptosuiteString"
220
+ },
221
+ "domain": "https://w3id.org/security#domain",
222
+ "expires": {
223
+ "@id": "https://w3id.org/security#expiration",
224
+ "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
225
+ },
226
+ "nonce": "https://w3id.org/security#nonce",
227
+ "previousProof": {
228
+ "@id": "https://w3id.org/security#previousProof",
229
+ "@type": "@id"
230
+ },
231
+ "proofPurpose": {
232
+ "@id": "https://w3id.org/security#proofPurpose",
233
+ "@type": "@vocab",
234
+ "@context": {
235
+ "@protected": true,
236
+
237
+ "id": "@id",
238
+ "type": "@type",
239
+
240
+ "assertionMethod": {
241
+ "@id": "https://w3id.org/security#assertionMethod",
242
+ "@type": "@id",
243
+ "@container": "@set"
244
+ },
245
+ "authentication": {
246
+ "@id": "https://w3id.org/security#authenticationMethod",
247
+ "@type": "@id",
248
+ "@container": "@set"
249
+ },
250
+ "capabilityDelegation": {
251
+ "@id": "https://w3id.org/security#capabilityDelegationMethod",
252
+ "@type": "@id",
253
+ "@container": "@set"
254
+ },
255
+ "capabilityInvocation": {
256
+ "@id": "https://w3id.org/security#capabilityInvocationMethod",
257
+ "@type": "@id",
258
+ "@container": "@set"
259
+ },
260
+ "keyAgreement": {
261
+ "@id": "https://w3id.org/security#keyAgreementMethod",
262
+ "@type": "@id",
263
+ "@container": "@set"
264
+ }
265
+ }
266
+ },
267
+ "proofValue": {
268
+ "@id": "https://w3id.org/security#proofValue",
269
+ "@type": "https://w3id.org/security#multibase"
270
+ },
271
+ "verificationMethod": {
272
+ "@id": "https://w3id.org/security#verificationMethod",
273
+ "@type": "@id"
274
+ }
275
+ }
276
+ },
277
+
278
+ "...": {
279
+ "@id": "https://www.iana.org/assignments/jwt#..."
280
+ },
281
+ "_sd": {
282
+ "@id": "https://www.iana.org/assignments/jwt#_sd",
283
+ "@type": "@json"
284
+ },
285
+ "_sd_alg": {
286
+ "@id": "https://www.iana.org/assignments/jwt#_sd_alg"
287
+ },
288
+ "aud": {
289
+ "@id": "https://www.iana.org/assignments/jwt#aud",
290
+ "@type": "@id"
291
+ },
292
+ "cnf": {
293
+ "@id": "https://www.iana.org/assignments/jwt#cnf",
294
+ "@context": {
295
+ "@protected": true,
296
+
297
+ "kid": {
298
+ "@id": "https://www.iana.org/assignments/jwt#kid",
299
+ "@type": "@id"
300
+ },
301
+ "jwk": {
302
+ "@id": "https://www.iana.org/assignments/jwt#jwk",
303
+ "@type": "@json"
304
+ }
305
+ }
306
+ },
307
+ "exp": {
308
+ "@id": "https://www.iana.org/assignments/jwt#exp",
309
+ "@type": "https://www.w3.org/2001/XMLSchema#nonNegativeInteger"
310
+ },
311
+ "iat": {
312
+ "@id": "https://www.iana.org/assignments/jwt#iat",
313
+ "@type": "https://www.w3.org/2001/XMLSchema#nonNegativeInteger"
314
+ },
315
+ "iss": {
316
+ "@id": "https://www.iana.org/assignments/jose#iss",
317
+ "@type": "@id"
318
+ },
319
+ "jku": {
320
+ "@id": "https://www.iana.org/assignments/jose#jku",
321
+ "@type": "@id"
322
+ },
323
+ "kid": {
324
+ "@id": "https://www.iana.org/assignments/jose#kid",
325
+ "@type": "@id"
326
+ },
327
+ "nbf": {
328
+ "@id": "https://www.iana.org/assignments/jwt#nbf",
329
+ "@type": "https://www.w3.org/2001/XMLSchema#nonNegativeInteger"
330
+ },
331
+ "sub": {
332
+ "@id": "https://www.iana.org/assignments/jose#sub",
333
+ "@type": "@id"
334
+ },
335
+ "x5u": {
336
+ "@id": "https://www.iana.org/assignments/jose#x5u",
337
+ "@type": "@id"
338
+ }
339
+ }
340
+ }
@@ -0,0 +1,9 @@
1
+ import type { DocumentLoader, JsonObject } from './types.js';
2
+ export declare const PROFILE_ID = "vsc-draft-compat/0.1.0";
3
+ export declare const UPSTREAM_REVISION = "c279de3debcd6eab94a77034584d1750f5d65e6a";
4
+ export declare const CONTEXT_URL = "urn:bsv:vsc:context:0.1.0";
5
+ export declare const PROFILE_CONTEXT: JsonObject;
6
+ export declare const SEAL_CONTEXTS: string[];
7
+ /** Contexts are pinned package resources. External DID/credential retrieval is an explicit dependency. */
8
+ export declare function createDocumentLoader(documents?: ReadonlyMap<string, JsonObject>, fallback?: DocumentLoader): DocumentLoader;
9
+ //# sourceMappingURL=context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../src/context.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7D,eAAO,MAAM,UAAU,2BAA2B,CAAC;AACnD,eAAO,MAAM,iBAAiB,6CAA6C,CAAC;AAE5E,eAAO,MAAM,WAAW,8BAA8B,CAAC;AAYvD,eAAO,MAAM,eAAe,EAAE,UAAkC,CAAC;AACjE,eAAO,MAAM,aAAa,UAIzB,CAAC;AAEF,0GAA0G;AAC1G,wBAAgB,oBAAoB,CAAC,SAAS,GAAE,WAAW,CAAC,MAAM,EAAE,UAAU,CAAa,EAAE,QAAQ,CAAC,EAAE,cAAc,GAAG,cAAc,CAatI"}
@@ -0,0 +1,50 @@
1
+ import { contexts as vcContexts } from '@digitalbazaar/credentials-context';
2
+ import { contexts as diContexts } from '@digitalbazaar/data-integrity-context';
3
+ import { contexts as multikeyContexts } from '@digitalbazaar/multikey-context';
4
+ import { contexts as didContexts } from 'did-context';
5
+ import { suiteContext } from '@digitalbazaar/ed25519-signature-2020';
6
+ export const PROFILE_ID = 'vsc-draft-compat/0.1.0';
7
+ export const UPSTREAM_REVISION = 'c279de3debcd6eab94a77034584d1750f5d65e6a';
8
+ // Owned profile identifier. No invented context is served under a W3C URL.
9
+ export const CONTEXT_URL = 'urn:bsv:vsc:context:0.1.0';
10
+ const ns = 'urn:bsv:vsc:term:';
11
+ const terms = {
12
+ '@version': 1.1, '@protected': true,
13
+ 'VSC-SEAL': `${ns}SEAL`, VscEventAuthorisation: `${ns}EventAuthorisation`, VscCorrectionAuthorisation: `${ns}CorrectionAuthorisation`,
14
+ issuanceDate: { '@id': 'https://www.w3.org/2018/credentials#issuanceDate', '@type': 'http://www.w3.org/2001/XMLSchema#dateTime' },
15
+ };
16
+ for (const term of ['sealVersion', 'sealTimestamp', 'eventVector', 'what', 'when', 'where', 'who', 'how', 'scheme', 'value', 'schemeAuthority', 'serialNumber', 'batchOrLot', 'expiryDate', 'quantity', 'quantityUnit', 'eventTime', 'recordedAt', 'timezone', 'timePrecision', 'jurisdiction', 'actorRole', 'eventType', 'eventTypeVocab', 'businessStep', 'disposition', 'action', 'chainOfCustody', 'sequenceNumber', 'topology', 'topologyNote'])
17
+ terms[term] = `${ns}${term}`;
18
+ for (const term of ['actorDid', 'assertionMethod', 'chainId', 'correctionOf', 'originalIssuer'])
19
+ terms[term] = { '@id': `${ns}${term}`, '@type': '@id' };
20
+ for (const term of ['productIdentifiers'])
21
+ terms[term] = { '@id': `${ns}${term}`, '@container': '@set' };
22
+ for (const term of ['parentSeals', 'childSeals', 'predecessorCredentials'])
23
+ terms[term] = { '@id': `${ns}${term}`, '@type': '@id', '@container': '@set' };
24
+ for (const term of ['extensions', 'classifications', 'readPoint', 'businessLocation', 'geoCoordinates', 'actorLicense', 'permittedEventTypes', 'permittedProductSchemes', 'permittedJurisdictions', 'permittedRecordIds', 'permittedActions'])
25
+ terms[term] = { '@id': `${ns}${term}`, '@type': '@json' };
26
+ export const PROFILE_CONTEXT = { '@context': terms };
27
+ export const SEAL_CONTEXTS = [
28
+ 'https://www.w3.org/ns/credentials/v2', CONTEXT_URL,
29
+ 'https://w3id.org/security/suites/ed25519-2020/v1',
30
+ 'https://w3id.org/security/data-integrity/v2',
31
+ ];
32
+ /** Contexts are pinned package resources. External DID/credential retrieval is an explicit dependency. */
33
+ export function createDocumentLoader(documents = new Map(), fallback) {
34
+ const builtins = new Map([
35
+ ...vcContexts, ...diContexts, ...multikeyContexts, ...didContexts,
36
+ ...suiteContext.contexts, [CONTEXT_URL, PROFILE_CONTEXT],
37
+ ]);
38
+ return async (url) => {
39
+ const document = builtins.get(url) ?? documents.get(url);
40
+ if (document)
41
+ return { document: structuredClone(document), documentUrl: url, contextUrl: null };
42
+ // Context substitution is never delegated to network loaders.
43
+ if (url.includes('/contexts/') || url.startsWith('urn:bsv:vsc:'))
44
+ throw new Error(`Unsupported context: ${url}`);
45
+ if (!fallback)
46
+ throw new Error(`No document available: ${url}`);
47
+ return fallback(url);
48
+ };
49
+ }
50
+ //# sourceMappingURL=context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context.js","sourceRoot":"","sources":["../src/context.ts"],"names":[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GAAG,EAAE,EAAE,QAAyB;IACpH,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAqB;QAC3C,GAAG,UAAU,EAAE,GAAG,UAAU,EAAE,GAAG,gBAAgB,EAAE,GAAG,WAAW;QACjE,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE,eAAe,CAAC;KACzD,CAAC,CAAC;IACH,OAAO,KAAK,EAAC,GAAG,EAAC,EAAE;QACjB,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACzD,IAAI,QAAQ;YAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,CAAC;QACjG,8DAA8D;QAC9D,IAAI,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,UAAU,CAAC,cAAc,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,wBAAwB,GAAG,EAAE,CAAC,CAAC;QACjH,IAAI,CAAC,QAAQ;YAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,GAAG,EAAE,CAAC,CAAC;QAChE,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,50 @@
1
+ import type { Credential, DocumentLoader, Seal, Check } from './types.js';
2
+ export interface SigningKey {
3
+ id: string;
4
+ controller: string;
5
+ signer(): unknown;
6
+ }
7
+ export declare const ALWAYS_DISCLOSED: readonly ["/id", "/type", "/issuer", "/validFrom", "/sealVersion", "/sealTimestamp", "/correctionOf", "/credentialSubject", "/credentialStatus", "/eventVector/what/productIdentifiers", "/eventVector/when/eventTime", "/eventVector/when/timezone", "/eventVector/where/jurisdiction", "/eventVector/who/actorDid", "/eventVector/who/actorRole", "/eventVector/who/assertionMethod", "/eventVector/how/eventType", "/eventVector/how/eventTypeVocab", "/eventVector/how/disposition", "/chainOfCustody/chainId"];
8
+ export declare function signCredentialEd25519({ credential, key, documentLoader, date }: {
9
+ credential: Credential;
10
+ key: SigningKey;
11
+ documentLoader: DocumentLoader;
12
+ date?: string;
13
+ }): Promise<Credential>;
14
+ export declare function issueSealEd25519(options: {
15
+ credential: Seal;
16
+ key: SigningKey;
17
+ documentLoader: DocumentLoader;
18
+ }): Promise<Seal>;
19
+ export declare function issueSealBbs({ credential, key, documentLoader }: {
20
+ credential: Seal;
21
+ key: SigningKey;
22
+ documentLoader: DocumentLoader;
23
+ }): Promise<Seal>;
24
+ export declare function verifyCredentialProof({ credential, documentLoader, presentationHeader }: {
25
+ credential: Credential;
26
+ documentLoader: DocumentLoader;
27
+ presentationHeader?: Uint8Array;
28
+ }): Promise<Check>;
29
+ export interface PresentationBinding {
30
+ requestId: string;
31
+ challenge: string;
32
+ verifierDid: string;
33
+ holderDid: string;
34
+ expiresAt: string;
35
+ }
36
+ export declare function presentationHeader(binding: PresentationBinding): Uint8Array;
37
+ /** Cryptographic disclosure primitive. Callers must separately authorise every optional pointer. */
38
+ export declare function deriveSealPresentation({ credential, documentLoader, selectivePointers, binding }: {
39
+ credential: Seal;
40
+ documentLoader: DocumentLoader;
41
+ selectivePointers?: string[];
42
+ binding: PresentationBinding;
43
+ }): Promise<Credential>;
44
+ export declare function verifySealPresentation({ credential, documentLoader, binding, evaluationTime }: {
45
+ credential: Credential;
46
+ documentLoader: DocumentLoader;
47
+ binding: PresentationBinding;
48
+ evaluationTime?: string;
49
+ }): Promise<Check>;
50
+ //# sourceMappingURL=crypto.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAqB,IAAI,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAI7F,MAAM,WAAW,UAAU;IAAG,EAAE,EAAE,M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,oGAAoG;AACpG,wBAAsB,sBAAsB,CAAC,EAAE,UAAU,EAAE,cAAc,EAAE,iBAAsB,EAAE,OAAO,EAAE,EAAE;IAAE,UAAU,EAAE,IAAI,CAAC;IAAC,cAAc,EAAE,cAAc,CAAC;IAAC,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,mBAAmB,CAAA;CAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAYnP;AACD,wBAAsB,sBAAsB,CAAC,EAAE,UAAU,EAAE,cAAc,EAAE,OAAO,EAAE,cAAyC,EAAE,EAAE;IAAE,UAAU,EAAE,UAAU,CAAC;IAAC,cAAc,EAAE,cAAc,CAAC;IAAC,OAAO,EAAE,mBAAmB,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,KAAK,CAAC,CAWlQ"}
package/dist/crypto.js ADDED
@@ -0,0 +1,141 @@
1
+ import jsigs from 'jsonld-signatures';
2
+ import { Ed25519Signature2020 } from '@digitalbazaar/ed25519-signature-2020';
3
+ import { DataIntegrityProof } from '@digitalbazaar/data-integrity';
4
+ import { createSignCryptosuite, createDiscloseCryptosuite, createVerifyCryptosuite } from '@digitalbazaar/bbs-2023-cryptosuite';
5
+ import { validateSealStructure, validateSealPresentationStructure } from './validation.js';
6
+ import { SEAL_CONTEXTS } from './context.js';
7
+ export const ALWAYS_DISCLOSED = [
8
+ '/id', '/type', '/issuer', '/validFrom', '/sealVersion', '/sealTimestamp', '/correctionOf',
9
+ '/credentialSubject', '/credentialStatus',
10
+ '/eventVector/what/productIdentifiers', '/eventVector/when/eventTime',
11
+ '/eventVector/when/timezone', '/eventVector/where/jurisdiction',
12
+ '/eventVector/who/actorDid', '/eventVector/who/actorRole', '/eventVector/who/assertionMethod',
13
+ '/eventVector/how/eventType', '/eventVector/how/eventTypeVocab', '/eventVector/how/disposition',
14
+ '/chainOfCustody/chainId',
15
+ ];
16
+ function assertUnsigned(seal, key) {
17
+ const validation = validateSealStructure(seal, { requireProof: false });
18
+ if (!validation.valid)
19
+ throw new Error(validation.errors.map(e => `${e.path}: ${e.message}`).join('; '));
20
+ if (seal.proof)
21
+ throw new Error('Issue a new immutable credential instead of replacing a proof');
22
+ if (seal.issuer !== key.controller || seal.eventVector.who.assertionMethod !== key.id)
23
+ throw new Error('Signing key must match the declared issuer and assertion method');
24
+ }
25
+ export async function signCredentialEd25519({ credential, key, documentLoader, date }) {
26
+ if (credential.issuer !== key.controller)
27
+ throw new Error('Signing key controller must match issuer');
28
+ const suite = new Ed25519Signature2020({ key, date: date ?? credential.validFrom });
29
+ return jsigs.sign(structuredClone(credential), { suite, purpose: new jsigs.purposes.AssertionProofPurpose(), documentLoader });
30
+ }
31
+ export async function issueSealEd25519(options) {
32
+ assertUnsigned(options.credential, options.key);
33
+ return await signCredentialEd25519(options);
34
+ }
35
+ export async function issueSealBbs({ credential, key, documentLoader }) {
36
+ assertUnsigned(credential, key);
37
+ const mandatoryPointers = ALWAYS_DISCLOSED.filter(p => p !== '/correctionOf' || credential.correctionOf !== null);
38
+ if (credential.validUntil)
39
+ mandatoryPointers.push('/validUntil');
40
+ const suite = new DataIntegrityProof({ signer: key.signer(), cryptosuite: createSignCryptosuite({ mandatoryPointers }) });
41
+ return jsigs.sign(structuredClone(credential), { suite, purpose: new jsigs.purposes.AssertionProofPurpose(), documentLoader });
42
+ }
43
+ async function issuerPurpose(credential, proof, documentLoader) {
44
+ if (typeof credential.issuer !== 'string' || !credential.issuer.startsWith('did:'))
45
+ throw new Error('Issuer must be a DID');
46
+ if (proof.proofPurpose !== 'assertionMethod')
47
+ throw new Error('Proof does not authorise an assertion');
48
+ const { document } = await documentLoader(credential.issuer);
49
+ if (document.id !== credential.issuer)
50
+ throw new Error('Resolved DID document does not identify the issuer');
51
+ const relationships = document.assertionMethod;
52
+ if (!Array.isArray(relationships) || !relationships.some(value => value === proof.verificationMethod || (typeof value === 'object' && value !== null && value.id === proof.verificationMethod)))
53
+ throw new Error('Issuer has not authorised this assertion method');
54
+ return new jsigs.purposes.AssertionProofPurpose({ controller: document });
55
+ }
56
+ function proofArray(credential) { return Array.isArray(credential.proof) ? credential.proof : credential.proof ? [credential.proof] : []; }
57
+ function bbsDerived(proof) {
58
+ // The maintained suite parses and verifies the encoded proof. This prefix only selects its operation.
59
+ return proof.proofValue.startsWith('u2V0D');
60
+ }
61
+ async function verifyOne(credential, proof, documentLoader, presentationHeader) {
62
+ const purpose = await issuerPurpose(credential, proof, documentLoader);
63
+ let document = { ...structuredClone(credential), proof };
64
+ let suite;
65
+ if (proof.type === 'Ed25519Signature2020') {
66
+ if (presentationHeader)
67
+ throw new Error('An ordinary Ed25519 proof is not a request-bound selective presentation');
68
+ suite = new Ed25519Signature2020();
69
+ }
70
+ else if (proof.type === 'DataIntegrityProof' && proof.cryptosuite === 'bbs-2023') {
71
+ if (!bbsDerived(proof)) {
72
+ if (presentationHeader)
73
+ throw new Error('A presentation must contain a derived proof');
74
+ const selectivePointers = Object.keys(document).filter(k => k !== '@context' && k !== 'proof' && document[k] !== null).map(k => `/${k.replace(/~/g, '~0').replace(/\//g, '~1')}`);
75
+ document = await jsigs.derive(document, {
76
+ suite: new DataIntegrityProof({ cryptosuite: createDiscloseCryptosuite({ selectivePointers }) }), purpose, documentLoader,
77
+ });
78
+ }
79
+ suite = new DataIntegrityProof({ cryptosuite: createVerifyCryptosuite({ expectedPresentationHeader: presentationHeader }) });
80
+ }
81
+ else
82
+ throw new Error(`Unsupported proof suite: ${proof.type}/${proof.cryptosuite ?? ''}`);
83
+ const result = await jsigs.verify(document, { suite, purpose, documentLoader });
84
+ if (!result.verified)
85
+ throw new Error(result.error?.message ?? result.results?.[0]?.error?.message ?? 'Cryptographic proof failed');
86
+ }
87
+ export async function verifyCredentialProof({ credential, documentLoader, presentationHeader }) {
88
+ if (!Array.isArray(credential['@context']) || credential['@context'][0] !== SEAL_CONTEXTS[0] || credential['@context'].some(c => typeof c !== 'string' || !SEAL_CONTEXTS.includes(c)))
89
+ return { outcome: 'unsupported', issues: [{ code: 'context_unsupported', path: '/@context', message: 'Only pinned profile and standard contexts are accepted' }] };
90
+ const proofs = proofArray(credential);
91
+ if (!proofs.length)
92
+ return { outcome: 'invalid', issues: [{ code: 'proof_missing', path: '/proof', message: 'A secured credential is required' }] };
93
+ try {
94
+ for (const proof of proofs)
95
+ await verifyOne(credential, proof, documentLoader, presentationHeader);
96
+ return { outcome: 'verified', issues: [], evidence: proofs.map(p => p.verificationMethod) };
97
+ }
98
+ catch (error) {
99
+ const message = error instanceof Error ? error.message : String(error);
100
+ return { outcome: message.startsWith('Unsupported') ? 'unsupported' : message.startsWith('No document available') ? 'indeterminate' : 'invalid', issues: [{ code: 'proof_failed', path: '/proof', message }] };
101
+ }
102
+ }
103
+ export function presentationHeader(binding) {
104
+ if (!binding.challenge || !binding.requestId || !binding.verifierDid.startsWith('did:') || !binding.holderDid.startsWith('did:') || !Number.isFinite(Date.parse(binding.expiresAt)))
105
+ throw new Error('Invalid presentation binding');
106
+ return new TextEncoder().encode(JSON.stringify([binding.requestId, binding.challenge, binding.verifierDid, binding.holderDid, binding.expiresAt]));
107
+ }
108
+ /** Cryptographic disclosure primitive. Callers must separately authorise every optional pointer. */
109
+ export async function deriveSealPresentation({ credential, documentLoader, selectivePointers = [], binding }) {
110
+ const checked = await verifyCredentialProof({ credential, documentLoader });
111
+ if (checked.outcome !== 'verified')
112
+ throw new Error('Cannot derive from an unverified base credential');
113
+ const bbs = proofArray(credential).find(p => p.type === 'DataIntegrityProof' && p.cryptosuite === 'bbs-2023');
114
+ if (!bbs)
115
+ throw new Error('Credential has no BBS base proof');
116
+ const derived = await jsigs.derive({ ...structuredClone(credential), proof: bbs }, {
117
+ suite: new DataIntegrityProof({ cryptosuite: createDiscloseCryptosuite({ selectivePointers, presentationHeader: presentationHeader(binding) }) }),
118
+ purpose: await issuerPurpose(credential, bbs, documentLoader), documentLoader,
119
+ });
120
+ // RDF omits null; restore the profile's explicit original-record marker.
121
+ if (credential.correctionOf === null)
122
+ derived.correctionOf = null;
123
+ return derived;
124
+ }
125
+ export async function verifySealPresentation({ credential, documentLoader, binding, evaluationTime = new Date().toISOString() }) {
126
+ if (!Number.isFinite(Date.parse(evaluationTime)) || !Number.isFinite(Date.parse(binding.expiresAt)) || Date.parse(binding.expiresAt) <= Date.parse(evaluationTime))
127
+ return { outcome: 'invalid', issues: [{ code: 'presentation_expired', path: '', message: 'Presentation request has expired' }] };
128
+ const structure = validateSealPresentationStructure(credential);
129
+ if (!structure.valid)
130
+ return { outcome: 'invalid', issues: structure.errors };
131
+ const missing = ALWAYS_DISCLOSED.filter(pointer => {
132
+ let value = credential;
133
+ for (const part of pointer.slice(1).split('/'))
134
+ value = value && typeof value === 'object' ? value[part] : undefined;
135
+ return value === undefined;
136
+ });
137
+ if (missing.length)
138
+ return { outcome: 'invalid', issues: missing.map(path => ({ code: 'required_disclosure', path, message: 'Required presentation field is absent' })) };
139
+ return verifyCredentialProof({ credential, documentLoader, presentationHeader: presentationHeader(binding) });
140
+ }
141
+ //# sourceMappingURL=crypto.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto.js","sourceRoot":"","sources":["../src/crypto.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,mBAAmB,CAAC;AACtC,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAEhI,OAAO,EAAE,qBAAqB,EAAE,iCAAiC,EAAE,MAAM,iBAAiB,CAAC;AAC3F,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,KAAK,EAAC,OAAO,EAAC,SAAS,EAAC,YAAY,EAAC,cAAc,EAAC,gBAAgB,EAAC,eAAe;IAC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B,CAAC,CAAC,CAAC;IACH,IAAI,OAAO,CAAC,MAAM;QAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,qBAAqB,EAAE,IAAI,EAAE,OAAO,EAAE,uCAAuC,EAAE,CAAC,CAAC,EAAE,CAAC;IAC1K,OAAO,qBAAqB,CAAC,EAAE,UAAU,EAAE,cAAc,EAAE,kBAAkB,EAAE,kBAAkB,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;AAChH,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { DocumentLoader } from './types.js';
2
+ /** Resolve did:web using explicit operator-approved origins, with bounded reads and no redirects. */
3
+ export declare function createDidWebResolver({ allowedOrigins, fetcher, timeoutMs, maxBytes }: {
4
+ allowedOrigins: readonly string[];
5
+ fetcher?: typeof globalThis.fetch;
6
+ timeoutMs?: number;
7
+ maxBytes?: number;
8
+ }): DocumentLoader;
9
+ //# sourceMappingURL=did-web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"did-web.d.ts","sourceRoot":"","sources":["../src/did-web.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAc,MAAM,YAAY,CAAC;AAG7D,qGAAqG;AACrG,wBAAgB,oBAAoB,CAAC,EAAE,cAAc,EAAE,OAA0B,EAAE,SAAgB,EAAE,QAAiB,EAAE,EAAE;IACxH,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC7G,GAAG,cAAc,CAiCjB"}