@nuggetslife/vc 0.0.10 → 0.0.15

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 (31) hide show
  1. package/Cargo.toml +5 -2
  2. package/index.d.ts +303 -3
  3. package/index.js +15 -1
  4. package/package.json +11 -11
  5. package/src/bls_signatures/bbs_bls_holder_bound_signature_2022/mod.rs +268 -0
  6. package/src/bls_signatures/bbs_bls_holder_bound_signature_2022/types.rs +26 -0
  7. package/src/bls_signatures/bbs_bls_holder_bound_signature_proof_2022/mod.rs +100 -0
  8. package/src/bls_signatures/bbs_bls_holder_bound_signature_proof_2022/types.rs +17 -0
  9. package/src/bls_signatures/bbs_bls_signature_2020/mod.rs +329 -0
  10. package/src/bls_signatures/bbs_bls_signature_2020/types.rs +37 -0
  11. package/src/bls_signatures/bbs_bls_signature_proof_2020/mod.rs +92 -0
  12. package/src/bls_signatures/bbs_bls_signature_proof_2020/types.rs +13 -0
  13. package/src/bls_signatures/bls_12381_g2_keypair/mod.rs +470 -0
  14. package/src/{types.rs → bls_signatures/bls_12381_g2_keypair/types.rs} +0 -11
  15. package/src/{validators.rs → bls_signatures/bls_12381_g2_keypair/validators.rs} +1 -1
  16. package/src/bls_signatures/bound_bls_12381_g2_keypair/mod.rs +70 -0
  17. package/src/bls_signatures/bound_bls_12381_g2_keypair/types.rs +11 -0
  18. package/src/bls_signatures/mod.rs +6 -0
  19. package/src/jsonld.rs +200 -0
  20. package/src/ld_signatures.rs +311 -0
  21. package/src/lib.rs +3 -463
  22. package/test-data/bbs.json +92 -0
  23. package/test-data/citizenVocab.json +57 -0
  24. package/test-data/controllerDocument.json +5 -0
  25. package/test-data/credentialsContext.json +315 -0
  26. package/test-data/deriveProofFrame.json +15 -0
  27. package/test-data/inputDocument.json +29 -0
  28. package/test-data/keyPair.json +6 -0
  29. package/test-data/suiteContext.json +82 -0
  30. package/test.mjs +1088 -22
  31. package/test_jsonld_crossverify.mjs +256 -0
@@ -0,0 +1,315 @@
1
+ {
2
+ "@context": {
3
+ "@version": 1.1,
4
+ "@protected": true,
5
+ "id": "@id",
6
+ "type": "@type",
7
+ "VerifiableCredential": {
8
+ "@id": "https://www.w3.org/2018/credentials#VerifiableCredential",
9
+ "@context": {
10
+ "@version": 1.1,
11
+ "@protected": true,
12
+ "id": "@id",
13
+ "type": "@type",
14
+ "cred": "https://www.w3.org/2018/credentials#",
15
+ "sec": "https://w3id.org/security#",
16
+ "xsd": "http://www.w3.org/2001/XMLSchema#",
17
+ "credentialSchema": {
18
+ "@id": "cred:credentialSchema",
19
+ "@type": "@id",
20
+ "@context": {
21
+ "@version": 1.1,
22
+ "@protected": true,
23
+ "id": "@id",
24
+ "type": "@type",
25
+ "cred": "https://www.w3.org/2018/credentials#",
26
+ "JsonSchemaValidator2018": "cred:JsonSchemaValidator2018"
27
+ }
28
+ },
29
+ "credentialStatus": {
30
+ "@id": "cred:credentialStatus",
31
+ "@type": "@id"
32
+ },
33
+ "credentialSubject": {
34
+ "@id": "cred:credentialSubject",
35
+ "@type": "@id"
36
+ },
37
+ "evidence": {
38
+ "@id": "cred:evidence",
39
+ "@type": "@id"
40
+ },
41
+ "expirationDate": {
42
+ "@id": "cred:expirationDate",
43
+ "@type": "xsd:dateTime"
44
+ },
45
+ "holder": {
46
+ "@id": "cred:holder",
47
+ "@type": "@id"
48
+ },
49
+ "issued": {
50
+ "@id": "cred:issued",
51
+ "@type": "xsd:dateTime"
52
+ },
53
+ "issuer": {
54
+ "@id": "cred:issuer",
55
+ "@type": "@id"
56
+ },
57
+ "issuanceDate": {
58
+ "@id": "cred:issuanceDate",
59
+ "@type": "xsd:dateTime"
60
+ },
61
+ "proof": {
62
+ "@id": "sec:proof",
63
+ "@type": "@id",
64
+ "@container": "@graph"
65
+ },
66
+ "refreshService": {
67
+ "@id": "cred:refreshService",
68
+ "@type": "@id",
69
+ "@context": {
70
+ "@version": 1.1,
71
+ "@protected": true,
72
+ "id": "@id",
73
+ "type": "@type",
74
+ "cred": "https://www.w3.org/2018/credentials#",
75
+ "ManualRefreshService2018": "cred:ManualRefreshService2018"
76
+ }
77
+ },
78
+ "termsOfUse": {
79
+ "@id": "cred:termsOfUse",
80
+ "@type": "@id"
81
+ },
82
+ "validFrom": {
83
+ "@id": "cred:validFrom",
84
+ "@type": "xsd:dateTime"
85
+ },
86
+ "validUntil": {
87
+ "@id": "cred:validUntil",
88
+ "@type": "xsd:dateTime"
89
+ }
90
+ }
91
+ },
92
+ "VerifiablePresentation": {
93
+ "@id": "https://www.w3.org/2018/credentials#VerifiablePresentation",
94
+ "@context": {
95
+ "@version": 1.1,
96
+ "@protected": true,
97
+ "id": "@id",
98
+ "type": "@type",
99
+ "cred": "https://www.w3.org/2018/credentials#",
100
+ "sec": "https://w3id.org/security#",
101
+ "holder": {
102
+ "@id": "cred:holder",
103
+ "@type": "@id"
104
+ },
105
+ "proof": {
106
+ "@id": "sec:proof",
107
+ "@type": "@id",
108
+ "@container": "@graph"
109
+ },
110
+ "verifiableCredential": {
111
+ "@id": "cred:verifiableCredential",
112
+ "@type": "@id",
113
+ "@container": "@graph"
114
+ }
115
+ }
116
+ },
117
+ "EcdsaSecp256k1Signature2019": {
118
+ "@id": "https://w3id.org/security#EcdsaSecp256k1Signature2019",
119
+ "@context": {
120
+ "@version": 1.1,
121
+ "@protected": true,
122
+ "id": "@id",
123
+ "type": "@type",
124
+ "sec": "https://w3id.org/security#",
125
+ "xsd": "http://www.w3.org/2001/XMLSchema#",
126
+ "challenge": "sec:challenge",
127
+ "created": {
128
+ "@id": "http://purl.org/dc/terms/created",
129
+ "@type": "xsd:dateTime"
130
+ },
131
+ "domain": "sec:domain",
132
+ "expires": {
133
+ "@id": "sec:expiration",
134
+ "@type": "xsd:dateTime"
135
+ },
136
+ "jws": "sec:jws",
137
+ "nonce": "sec:nonce",
138
+ "proofPurpose": {
139
+ "@id": "sec:proofPurpose",
140
+ "@type": "@vocab",
141
+ "@context": {
142
+ "@version": 1.1,
143
+ "@protected": true,
144
+ "id": "@id",
145
+ "type": "@type",
146
+ "sec": "https://w3id.org/security#",
147
+ "assertionMethod": {
148
+ "@id": "sec:assertionMethod",
149
+ "@type": "@id",
150
+ "@container": "@set"
151
+ },
152
+ "authentication": {
153
+ "@id": "sec:authenticationMethod",
154
+ "@type": "@id",
155
+ "@container": "@set"
156
+ }
157
+ }
158
+ },
159
+ "proofValue": "sec:proofValue",
160
+ "verificationMethod": {
161
+ "@id": "sec:verificationMethod",
162
+ "@type": "@id"
163
+ }
164
+ }
165
+ },
166
+ "EcdsaSecp256r1Signature2019": {
167
+ "@id": "https://w3id.org/security#EcdsaSecp256r1Signature2019",
168
+ "@context": {
169
+ "@version": 1.1,
170
+ "@protected": true,
171
+ "id": "@id",
172
+ "type": "@type",
173
+ "sec": "https://w3id.org/security#",
174
+ "xsd": "http://www.w3.org/2001/XMLSchema#",
175
+ "challenge": "sec:challenge",
176
+ "created": {
177
+ "@id": "http://purl.org/dc/terms/created",
178
+ "@type": "xsd:dateTime"
179
+ },
180
+ "domain": "sec:domain",
181
+ "expires": {
182
+ "@id": "sec:expiration",
183
+ "@type": "xsd:dateTime"
184
+ },
185
+ "jws": "sec:jws",
186
+ "nonce": "sec:nonce",
187
+ "proofPurpose": {
188
+ "@id": "sec:proofPurpose",
189
+ "@type": "@vocab",
190
+ "@context": {
191
+ "@version": 1.1,
192
+ "@protected": true,
193
+ "id": "@id",
194
+ "type": "@type",
195
+ "sec": "https://w3id.org/security#",
196
+ "assertionMethod": {
197
+ "@id": "sec:assertionMethod",
198
+ "@type": "@id",
199
+ "@container": "@set"
200
+ },
201
+ "authentication": {
202
+ "@id": "sec:authenticationMethod",
203
+ "@type": "@id",
204
+ "@container": "@set"
205
+ }
206
+ }
207
+ },
208
+ "proofValue": "sec:proofValue",
209
+ "verificationMethod": {
210
+ "@id": "sec:verificationMethod",
211
+ "@type": "@id"
212
+ }
213
+ }
214
+ },
215
+ "Ed25519Signature2018": {
216
+ "@id": "https://w3id.org/security#Ed25519Signature2018",
217
+ "@context": {
218
+ "@version": 1.1,
219
+ "@protected": true,
220
+ "id": "@id",
221
+ "type": "@type",
222
+ "sec": "https://w3id.org/security#",
223
+ "xsd": "http://www.w3.org/2001/XMLSchema#",
224
+ "challenge": "sec:challenge",
225
+ "created": {
226
+ "@id": "http://purl.org/dc/terms/created",
227
+ "@type": "xsd:dateTime"
228
+ },
229
+ "domain": "sec:domain",
230
+ "expires": {
231
+ "@id": "sec:expiration",
232
+ "@type": "xsd:dateTime"
233
+ },
234
+ "jws": "sec:jws",
235
+ "nonce": "sec:nonce",
236
+ "proofPurpose": {
237
+ "@id": "sec:proofPurpose",
238
+ "@type": "@vocab",
239
+ "@context": {
240
+ "@version": 1.1,
241
+ "@protected": true,
242
+ "id": "@id",
243
+ "type": "@type",
244
+ "sec": "https://w3id.org/security#",
245
+ "assertionMethod": {
246
+ "@id": "sec:assertionMethod",
247
+ "@type": "@id",
248
+ "@container": "@set"
249
+ },
250
+ "authentication": {
251
+ "@id": "sec:authenticationMethod",
252
+ "@type": "@id",
253
+ "@container": "@set"
254
+ }
255
+ }
256
+ },
257
+ "proofValue": "sec:proofValue",
258
+ "verificationMethod": {
259
+ "@id": "sec:verificationMethod",
260
+ "@type": "@id"
261
+ }
262
+ }
263
+ },
264
+ "RsaSignature2018": {
265
+ "@id": "https://w3id.org/security#RsaSignature2018",
266
+ "@context": {
267
+ "@version": 1.1,
268
+ "@protected": true,
269
+ "challenge": "sec:challenge",
270
+ "created": {
271
+ "@id": "http://purl.org/dc/terms/created",
272
+ "@type": "xsd:dateTime"
273
+ },
274
+ "domain": "sec:domain",
275
+ "expires": {
276
+ "@id": "sec:expiration",
277
+ "@type": "xsd:dateTime"
278
+ },
279
+ "jws": "sec:jws",
280
+ "nonce": "sec:nonce",
281
+ "proofPurpose": {
282
+ "@id": "sec:proofPurpose",
283
+ "@type": "@vocab",
284
+ "@context": {
285
+ "@version": 1.1,
286
+ "@protected": true,
287
+ "id": "@id",
288
+ "type": "@type",
289
+ "sec": "https://w3id.org/security#",
290
+ "assertionMethod": {
291
+ "@id": "sec:assertionMethod",
292
+ "@type": "@id",
293
+ "@container": "@set"
294
+ },
295
+ "authentication": {
296
+ "@id": "sec:authenticationMethod",
297
+ "@type": "@id",
298
+ "@container": "@set"
299
+ }
300
+ }
301
+ },
302
+ "proofValue": "sec:proofValue",
303
+ "verificationMethod": {
304
+ "@id": "sec:verificationMethod",
305
+ "@type": "@id"
306
+ }
307
+ }
308
+ },
309
+ "proof": {
310
+ "@id": "https://w3id.org/security#proof",
311
+ "@type": "@id",
312
+ "@container": "@graph"
313
+ }
314
+ }
315
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "@context": [
3
+ "https://www.w3.org/2018/credentials/v1",
4
+ "https://w3id.org/citizenship/v1",
5
+ "https://w3id.org/security/bbs/v1"
6
+ ],
7
+ "type": ["VerifiableCredential", "PermanentResidentCard"],
8
+ "credentialSubject": {
9
+ "@explicit": true,
10
+ "type": ["PermanentResident", "Person"],
11
+ "givenName": {},
12
+ "familyName": {},
13
+ "gender": {}
14
+ }
15
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "@context": [
3
+ "https://www.w3.org/2018/credentials/v1",
4
+ "https://w3id.org/citizenship/v1",
5
+ "https://w3id.org/security/bbs/v1"
6
+ ],
7
+ "id": "https://issuer.oidp.uscis.gov/credentials/83627465",
8
+ "type": ["VerifiableCredential", "PermanentResidentCard"],
9
+ "issuer": "did:example:489398593",
10
+ "identifier": "83627465",
11
+ "name": "Permanent Resident Card",
12
+ "description": "Government of Example Permanent Resident Card.",
13
+ "issuanceDate": "2019-12-03T12:19:52Z",
14
+ "expirationDate": "2029-12-03T12:19:52Z",
15
+ "credentialSubject": {
16
+ "id": "did:example:b34ca6cd37bbf23",
17
+ "type": ["PermanentResident", "Person"],
18
+ "givenName": "JOHN",
19
+ "familyName": "SMITH",
20
+ "gender": "Male",
21
+ "image": "data:image/png;base64,iVBORw0KGgokJggg==",
22
+ "residentSince": "2015-01-01",
23
+ "lprCategory": "C09",
24
+ "lprNumber": "999-999-999",
25
+ "commuterClassification": "C1",
26
+ "birthCountry": "Bahamas",
27
+ "birthDate": "1958-07-17"
28
+ }
29
+ }
@@ -0,0 +1,6 @@
1
+ {
2
+ "id": "did:example:489398593#test",
3
+ "controller": "did:example:489398593",
4
+ "privateKeyBase58": "5D6Pa8dSwApdnfg7EZR8WnGfvLDCZPZGsZ5Y1ELL9VDj",
5
+ "publicKeyBase58": "oqpWYKaZD9M1Kbe94BVXpr8WTdFBNZyKv48cziTiQUeuhm7sBhCABMyYG4kcMrseC68YTFFgyhiNeBKjzdKk9MiRWuLv5H4FFujQsQK2KTAtzU8qTBiZqBHMmnLF4PL7Ytu"
6
+ }
@@ -0,0 +1,82 @@
1
+ {
2
+ "@context": {
3
+ "privateKeyJwk": {
4
+ "@id": "https://w3id.org/security#privateKeyJwk",
5
+ "@type": "@json"
6
+ },
7
+ "JsonWebKey2020": {
8
+ "@id": "https://w3id.org/security#JsonWebKey2020",
9
+ "@context": {
10
+ "@protected": true,
11
+ "id": "@id",
12
+ "type": "@type",
13
+ "publicKeyJwk": {
14
+ "@id": "https://w3id.org/security#publicKeyJwk",
15
+ "@type": "@json"
16
+ }
17
+ }
18
+ },
19
+ "JsonWebSignature2020": {
20
+ "@id": "https://w3id.org/security#JsonWebSignature2020",
21
+ "@context": {
22
+ "@protected": true,
23
+
24
+ "id": "@id",
25
+ "type": "@type",
26
+
27
+ "challenge": "https://w3id.org/security#challenge",
28
+ "created": {
29
+ "@id": "http://purl.org/dc/terms/created",
30
+ "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
31
+ },
32
+ "domain": "https://w3id.org/security#domain",
33
+ "expires": {
34
+ "@id": "https://w3id.org/security#expiration",
35
+ "@type": "http://www.w3.org/2001/XMLSchema#dateTime"
36
+ },
37
+ "jws": "https://w3id.org/security#jws",
38
+ "nonce": "https://w3id.org/security#nonce",
39
+ "proofPurpose": {
40
+ "@id": "https://w3id.org/security#proofPurpose",
41
+ "@type": "@vocab",
42
+ "@context": {
43
+ "@protected": true,
44
+
45
+ "id": "@id",
46
+ "type": "@type",
47
+
48
+ "assertionMethod": {
49
+ "@id": "https://w3id.org/security#assertionMethod",
50
+ "@type": "@id",
51
+ "@container": "@set"
52
+ },
53
+ "authentication": {
54
+ "@id": "https://w3id.org/security#authenticationMethod",
55
+ "@type": "@id",
56
+ "@container": "@set"
57
+ },
58
+ "capabilityInvocation": {
59
+ "@id": "https://w3id.org/security#capabilityInvocationMethod",
60
+ "@type": "@id",
61
+ "@container": "@set"
62
+ },
63
+ "capabilityDelegation": {
64
+ "@id": "https://w3id.org/security#capabilityDelegationMethod",
65
+ "@type": "@id",
66
+ "@container": "@set"
67
+ },
68
+ "keyAgreement": {
69
+ "@id": "https://w3id.org/security#keyAgreementMethod",
70
+ "@type": "@id",
71
+ "@container": "@set"
72
+ }
73
+ }
74
+ },
75
+ "verificationMethod": {
76
+ "@id": "https://w3id.org/security#verificationMethod",
77
+ "@type": "@id"
78
+ }
79
+ }
80
+ }
81
+ }
82
+ }