@trustvc/trustvc 0.0.0 → 1.0.0-alpha.2

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 +201 -0
  2. package/dist/__tests__/fixtures/fixtures.d.mts +436 -0
  3. package/dist/__tests__/fixtures/fixtures.d.ts +436 -0
  4. package/dist/__tests__/fixtures/fixtures.js +715 -0
  5. package/dist/core/decrypt.d.mts +3 -0
  6. package/dist/core/decrypt.d.ts +3 -0
  7. package/dist/core/decrypt.js +23 -0
  8. package/dist/core/encrypt.d.mts +3 -0
  9. package/dist/core/encrypt.d.ts +3 -0
  10. package/dist/core/encrypt.js +23 -0
  11. package/dist/core/fragments/document-integrity/w3cSignatureIntegrity.d.mts +5 -0
  12. package/dist/core/fragments/document-integrity/w3cSignatureIntegrity.d.ts +5 -0
  13. package/dist/core/fragments/document-integrity/w3cSignatureIntegrity.js +48 -0
  14. package/dist/core/fragments/document-status/w3cCredentialStatus.d.mts +5 -0
  15. package/dist/core/fragments/document-status/w3cCredentialStatus.d.ts +5 -0
  16. package/dist/core/fragments/document-status/w3cCredentialStatus.js +54 -0
  17. package/dist/core/fragments/issuer-identity/w3cIssuerIdentity.d.mts +5 -0
  18. package/dist/core/fragments/issuer-identity/w3cIssuerIdentity.d.ts +5 -0
  19. package/dist/core/fragments/issuer-identity/w3cIssuerIdentity.js +74 -0
  20. package/dist/core/index.d.mts +5 -0
  21. package/dist/core/index.d.ts +5 -0
  22. package/dist/core/index.js +26 -0
  23. package/dist/core/verify.d.mts +6 -0
  24. package/dist/core/verify.d.ts +6 -0
  25. package/dist/core/verify.js +34 -0
  26. package/dist/esm/__tests__/fixtures/fixtures.js +701 -0
  27. package/dist/esm/core/decrypt.js +21 -0
  28. package/dist/esm/core/encrypt.js +21 -0
  29. package/dist/esm/core/fragments/document-integrity/w3cSignatureIntegrity.js +46 -0
  30. package/dist/esm/core/fragments/document-status/w3cCredentialStatus.js +52 -0
  31. package/dist/esm/core/fragments/issuer-identity/w3cIssuerIdentity.js +72 -0
  32. package/dist/esm/core/index.js +3 -0
  33. package/dist/esm/core/verify.js +32 -0
  34. package/dist/esm/index.js +3 -1
  35. package/dist/esm/open-attestation/index.js +4 -0
  36. package/dist/esm/open-attestation/sign.js +10 -0
  37. package/dist/esm/open-attestation/types.js +1 -0
  38. package/dist/esm/open-attestation/verify.js +13 -0
  39. package/dist/esm/open-attestation/wrap.js +10 -0
  40. package/dist/esm/utils/stringUtils.js +21 -0
  41. package/dist/esm/w3c/index.js +3 -0
  42. package/dist/esm/w3c/sign.js +9 -0
  43. package/dist/esm/w3c/types.js +2 -0
  44. package/dist/esm/w3c/verify.js +9 -0
  45. package/dist/index.d.mts +14 -2
  46. package/dist/index.d.ts +14 -2
  47. package/dist/index.js +24 -0
  48. package/dist/open-attestation/index.d.mts +6 -0
  49. package/dist/open-attestation/index.d.ts +6 -0
  50. package/dist/open-attestation/index.js +33 -0
  51. package/dist/open-attestation/sign.d.mts +7 -0
  52. package/dist/open-attestation/sign.d.ts +7 -0
  53. package/dist/open-attestation/sign.js +12 -0
  54. package/dist/open-attestation/types.d.mts +8 -0
  55. package/dist/open-attestation/types.d.ts +8 -0
  56. package/dist/open-attestation/types.js +18 -0
  57. package/dist/open-attestation/verify.d.mts +5 -0
  58. package/dist/open-attestation/verify.d.ts +5 -0
  59. package/dist/open-attestation/verify.js +15 -0
  60. package/dist/open-attestation/wrap.d.mts +5 -0
  61. package/dist/open-attestation/wrap.d.ts +5 -0
  62. package/dist/open-attestation/wrap.js +12 -0
  63. package/dist/utils/stringUtils.d.mts +5 -0
  64. package/dist/utils/stringUtils.d.ts +5 -0
  65. package/dist/utils/stringUtils.js +25 -0
  66. package/dist/w3c/index.d.mts +4 -0
  67. package/dist/w3c/index.d.ts +4 -0
  68. package/dist/w3c/index.js +26 -0
  69. package/dist/w3c/sign.d.mts +6 -0
  70. package/dist/w3c/sign.d.ts +6 -0
  71. package/dist/w3c/sign.js +11 -0
  72. package/dist/w3c/types.d.mts +2 -0
  73. package/dist/w3c/types.d.ts +2 -0
  74. package/dist/w3c/types.js +27 -0
  75. package/dist/w3c/verify.d.mts +5 -0
  76. package/dist/w3c/verify.d.ts +5 -0
  77. package/dist/w3c/verify.js +11 -0
  78. package/package.json +16 -2
  79. package/dist/.coverage/.tmp/coverage-0.json +0 -1
  80. package/dist/esm/.coverage/.tmp/coverage-0.json +0 -1
  81. package/dist/esm/node_modules/.vitest/vitest/results.json +0 -1
  82. package/dist/esm/types.js +0 -1
  83. package/dist/node_modules/.vitest/vitest/results.json +0 -1
  84. package/dist/types.d.mts +0 -2
  85. package/dist/types.d.ts +0 -2
  86. package/dist/types.js +0 -2
@@ -0,0 +1,436 @@
1
+ import { v2 } from '@govtechsg/open-attestation';
2
+
3
+ declare const SAMPLE_SIGNING_KEYS: {
4
+ readonly public: "did:ethr:0xB26B4941941C51a4885E5B7D3A1B861E54405f90#controller";
5
+ readonly private: "0xcd27dc84c82c5814e7edac518edd5f263e7db7f25adb7a1afe13996a95583cf2";
6
+ };
7
+ declare const RAW_DOCUMENT_DID: {
8
+ '@context': ["https://www.w3.org/ns/credentials/v2", "https://schemata.openattestation.com/com/openattestation/4.0/context.json"];
9
+ type: ["VerifiableCredential", "OpenAttestationCredential"];
10
+ validFrom: string;
11
+ name: string;
12
+ issuer: {
13
+ id: "did:ethr:0xB26B4941941C51a4885E5B7D3A1B861E54405f90";
14
+ type: "OpenAttestationIssuer";
15
+ name: string;
16
+ identityProof: {
17
+ identityProofType: "DNS-DID";
18
+ identifier: string;
19
+ };
20
+ };
21
+ renderMethod: {
22
+ id: string;
23
+ type: "OpenAttestationEmbeddedRenderer";
24
+ templateName: string;
25
+ }[];
26
+ credentialSubject: {
27
+ id: string;
28
+ type: string[];
29
+ name: string;
30
+ licenses: {
31
+ class: string;
32
+ description: string;
33
+ effectiveDate: string;
34
+ }[];
35
+ };
36
+ };
37
+ declare const RAW_DOCUMENT_DID_OSCP: {
38
+ '@context': ["https://www.w3.org/ns/credentials/v2", "https://schemata.openattestation.com/com/openattestation/4.0/context.json"];
39
+ type: ["VerifiableCredential", "OpenAttestationCredential"];
40
+ validFrom: string;
41
+ name: string;
42
+ issuer: {
43
+ id: "did:ethr:0xB26B4941941C51a4885E5B7D3A1B861E54405f90";
44
+ type: "OpenAttestationIssuer";
45
+ name: string;
46
+ identityProof: {
47
+ identityProofType: "DNS-DID";
48
+ identifier: string;
49
+ };
50
+ };
51
+ credentialStatus: {
52
+ id: string;
53
+ type: "OpenAttestationOcspResponder";
54
+ };
55
+ renderMethod: {
56
+ id: string;
57
+ type: "OpenAttestationEmbeddedRenderer";
58
+ templateName: string;
59
+ }[];
60
+ credentialSubject: {
61
+ id: string;
62
+ type: string[];
63
+ name: string;
64
+ licenses: {
65
+ class: string;
66
+ description: string;
67
+ effectiveDate: string;
68
+ }[];
69
+ };
70
+ };
71
+ declare const BATCHED_RAW_DOCUMENTS_DID: {
72
+ '@context': ["https://www.w3.org/ns/credentials/v2", "https://schemata.openattestation.com/com/openattestation/4.0/context.json"];
73
+ name: string;
74
+ type: ["VerifiableCredential", "OpenAttestationCredential"];
75
+ issuer: {
76
+ id: "did:ethr:0xB26B4941941C51a4885E5B7D3A1B861E54405f90";
77
+ type: "OpenAttestationIssuer";
78
+ name: string;
79
+ identityProof: {
80
+ identityProofType: "DNS-DID";
81
+ identifier: string;
82
+ };
83
+ };
84
+ validFrom: string;
85
+ credentialSubject: {
86
+ id: string;
87
+ type: string[];
88
+ name: string;
89
+ licenses: {
90
+ class: string;
91
+ description: string;
92
+ effectiveDate: string;
93
+ }[];
94
+ };
95
+ renderMethod: {
96
+ id: string;
97
+ type: "OpenAttestationEmbeddedRenderer";
98
+ templateName: string;
99
+ }[];
100
+ }[];
101
+ declare const WRAPPED_DOCUMENT_DID: {
102
+ '@context': ["https://www.w3.org/ns/credentials/v2", "https://schemata.openattestation.com/com/openattestation/4.0/context.json"];
103
+ name: string;
104
+ type: ["VerifiableCredential", "OpenAttestationCredential"];
105
+ issuer: {
106
+ id: string;
107
+ type: "OpenAttestationIssuer";
108
+ name: string;
109
+ identityProof: {
110
+ identityProofType: "DNS-DID";
111
+ identifier: string;
112
+ };
113
+ };
114
+ validFrom: string;
115
+ credentialSubject: {
116
+ id: string;
117
+ type: string[];
118
+ name: string;
119
+ licenses: {
120
+ class: string;
121
+ description: string;
122
+ effectiveDate: string;
123
+ }[];
124
+ };
125
+ renderMethod: {
126
+ id: string;
127
+ type: "OpenAttestationEmbeddedRenderer";
128
+ templateName: string;
129
+ }[];
130
+ proof: {
131
+ type: "OpenAttestationMerkleProofSignature2018";
132
+ proofPurpose: "assertionMethod";
133
+ targetHash: string;
134
+ proofs: any[];
135
+ merkleRoot: string;
136
+ salts: string;
137
+ privacy: {
138
+ obfuscated: any[];
139
+ };
140
+ };
141
+ };
142
+ declare const WRAPPED_DOCUMENT_DID_OSCP: {
143
+ '@context': ["https://www.w3.org/ns/credentials/v2", "https://schemata.openattestation.com/com/openattestation/4.0/context.json"];
144
+ name: string;
145
+ type: ["VerifiableCredential", "OpenAttestationCredential"];
146
+ issuer: {
147
+ id: string;
148
+ type: "OpenAttestationIssuer";
149
+ name: string;
150
+ identityProof: {
151
+ identityProofType: "DNS-DID";
152
+ identifier: string;
153
+ };
154
+ };
155
+ validFrom: string;
156
+ credentialSubject: {
157
+ id: string;
158
+ type: string[];
159
+ name: string;
160
+ licenses: {
161
+ class: string;
162
+ description: string;
163
+ effectiveDate: string;
164
+ }[];
165
+ };
166
+ credentialStatus: {
167
+ id: string;
168
+ type: "OpenAttestationOcspResponder";
169
+ };
170
+ renderMethod: {
171
+ id: string;
172
+ type: "OpenAttestationEmbeddedRenderer";
173
+ templateName: string;
174
+ }[];
175
+ proof: {
176
+ type: "OpenAttestationMerkleProofSignature2018";
177
+ proofPurpose: "assertionMethod";
178
+ targetHash: string;
179
+ proofs: any[];
180
+ merkleRoot: string;
181
+ salts: string;
182
+ privacy: {
183
+ obfuscated: any[];
184
+ };
185
+ };
186
+ };
187
+ declare const BATCHED_WRAPPED_DOCUMENTS_DID: {
188
+ '@context': ["https://www.w3.org/ns/credentials/v2", "https://schemata.openattestation.com/com/openattestation/4.0/context.json"];
189
+ name: string;
190
+ type: ["VerifiableCredential", "OpenAttestationCredential"];
191
+ issuer: {
192
+ id: string;
193
+ type: "OpenAttestationIssuer";
194
+ name: string;
195
+ identityProof: {
196
+ identityProofType: "DNS-DID";
197
+ identifier: string;
198
+ };
199
+ };
200
+ validFrom: string;
201
+ credentialSubject: {
202
+ id: string;
203
+ type: string[];
204
+ name: string;
205
+ licenses: {
206
+ class: string;
207
+ description: string;
208
+ effectiveDate: string;
209
+ }[];
210
+ };
211
+ renderMethod: {
212
+ id: string;
213
+ type: "OpenAttestationEmbeddedRenderer";
214
+ templateName: string;
215
+ }[];
216
+ proof: {
217
+ type: "OpenAttestationMerkleProofSignature2018";
218
+ proofPurpose: "assertionMethod";
219
+ targetHash: string;
220
+ proofs: string[];
221
+ merkleRoot: string;
222
+ salts: string;
223
+ privacy: {
224
+ obfuscated: any[];
225
+ };
226
+ };
227
+ }[];
228
+ declare const SIGNED_WRAPPED_DOCUMENT_DID: {
229
+ '@context': ["https://www.w3.org/ns/credentials/v2", "https://schemata.openattestation.com/com/openattestation/4.0/context.json"];
230
+ name: string;
231
+ type: ["VerifiableCredential", "OpenAttestationCredential"];
232
+ issuer: {
233
+ id: string;
234
+ type: "OpenAttestationIssuer";
235
+ name: string;
236
+ identityProof: {
237
+ identityProofType: "DNS-DID";
238
+ identifier: string;
239
+ };
240
+ };
241
+ validFrom: string;
242
+ credentialSubject: {
243
+ id: string;
244
+ type: string[];
245
+ name: string;
246
+ licenses: {
247
+ class: string;
248
+ description: string;
249
+ effectiveDate: string;
250
+ }[];
251
+ };
252
+ renderMethod: {
253
+ id: string;
254
+ type: "OpenAttestationEmbeddedRenderer";
255
+ templateName: string;
256
+ }[];
257
+ proof: {
258
+ type: "OpenAttestationMerkleProofSignature2018";
259
+ proofPurpose: "assertionMethod";
260
+ targetHash: string;
261
+ proofs: any[];
262
+ merkleRoot: string;
263
+ salts: string;
264
+ privacy: {
265
+ obfuscated: any[];
266
+ };
267
+ key: string;
268
+ signature: string;
269
+ };
270
+ };
271
+ declare const SIGNED_WRAPPED_DOCUMENT_DID_OSCP: {
272
+ '@context': ["https://www.w3.org/ns/credentials/v2", "https://schemata.openattestation.com/com/openattestation/4.0/context.json"];
273
+ name: string;
274
+ type: ["VerifiableCredential", "OpenAttestationCredential"];
275
+ issuer: {
276
+ id: string;
277
+ type: "OpenAttestationIssuer";
278
+ name: string;
279
+ identityProof: {
280
+ identityProofType: "DNS-DID";
281
+ identifier: string;
282
+ };
283
+ };
284
+ validFrom: string;
285
+ credentialSubject: {
286
+ id: string;
287
+ type: string[];
288
+ name: string;
289
+ licenses: {
290
+ class: string;
291
+ description: string;
292
+ effectiveDate: string;
293
+ }[];
294
+ };
295
+ credentialStatus: {
296
+ id: string;
297
+ type: "OpenAttestationOcspResponder";
298
+ };
299
+ renderMethod: {
300
+ id: string;
301
+ type: "OpenAttestationEmbeddedRenderer";
302
+ templateName: string;
303
+ }[];
304
+ proof: {
305
+ type: "OpenAttestationMerkleProofSignature2018";
306
+ proofPurpose: "assertionMethod";
307
+ targetHash: string;
308
+ proofs: any[];
309
+ merkleRoot: string;
310
+ salts: string;
311
+ privacy: {
312
+ obfuscated: any[];
313
+ };
314
+ key: string;
315
+ signature: string;
316
+ };
317
+ };
318
+ declare const SIGNED_WRAPPED_DOCUMENT_DID_OBFUSCATED: {
319
+ '@context': ["https://www.w3.org/ns/credentials/v2", "https://schemata.openattestation.com/com/openattestation/4.0/context.json"];
320
+ name: string;
321
+ type: ["VerifiableCredential", "OpenAttestationCredential"];
322
+ issuer: {
323
+ id: string;
324
+ type: "OpenAttestationIssuer";
325
+ name: string;
326
+ identityProof: {
327
+ identityProofType: "DNS-DID";
328
+ identifier: string;
329
+ };
330
+ };
331
+ validFrom: string;
332
+ credentialSubject: {
333
+ id: string;
334
+ type: string[];
335
+ name: string;
336
+ licenses: ({
337
+ class: string;
338
+ effectiveDate: string;
339
+ description?: undefined;
340
+ } | {
341
+ class: string;
342
+ description: string;
343
+ effectiveDate: string;
344
+ })[];
345
+ };
346
+ proof: {
347
+ type: "OpenAttestationMerkleProofSignature2018";
348
+ proofPurpose: "assertionMethod";
349
+ targetHash: string;
350
+ proofs: any[];
351
+ merkleRoot: string;
352
+ salts: string;
353
+ privacy: {
354
+ obfuscated: string[];
355
+ };
356
+ key: string;
357
+ signature: string;
358
+ };
359
+ renderMethod: {
360
+ id: string;
361
+ type: "OpenAttestationEmbeddedRenderer";
362
+ templateName: string;
363
+ }[];
364
+ };
365
+ declare const BATCHED_SIGNED_WRAPPED_DOCUMENTS_DID: {
366
+ '@context': ["https://www.w3.org/ns/credentials/v2", "https://schemata.openattestation.com/com/openattestation/4.0/context.json"];
367
+ name: string;
368
+ type: ["VerifiableCredential", "OpenAttestationCredential"];
369
+ issuer: {
370
+ id: string;
371
+ type: "OpenAttestationIssuer";
372
+ name: string;
373
+ identityProof: {
374
+ identityProofType: "DNS-DID";
375
+ identifier: string;
376
+ };
377
+ };
378
+ validFrom: string;
379
+ credentialSubject: {
380
+ id: string;
381
+ type: string[];
382
+ name: string;
383
+ licenses: {
384
+ class: string;
385
+ description: string;
386
+ effectiveDate: string;
387
+ }[];
388
+ };
389
+ renderMethod: {
390
+ id: string;
391
+ type: "OpenAttestationEmbeddedRenderer";
392
+ templateName: string;
393
+ }[];
394
+ proof: {
395
+ type: "OpenAttestationMerkleProofSignature2018";
396
+ proofPurpose: "assertionMethod";
397
+ targetHash: string;
398
+ proofs: string[];
399
+ merkleRoot: string;
400
+ salts: string;
401
+ privacy: {
402
+ obfuscated: any[];
403
+ };
404
+ key: string;
405
+ signature: string;
406
+ };
407
+ }[];
408
+ declare const WRAPPED_DOCUMENT_DNS_TXT_V2: v2.WrappedDocument<v2.OpenAttestationDocument>;
409
+ declare const W3C_VERIFIABLE_DOCUMENT: {
410
+ '@context': string[];
411
+ credentialStatus: {
412
+ id: string;
413
+ type: string;
414
+ statusPurpose: string;
415
+ statusListIndex: string;
416
+ statusListCredential: string;
417
+ };
418
+ credentialSubject: {
419
+ name: string;
420
+ birthDate: string;
421
+ type: string[];
422
+ };
423
+ expirationDate: string;
424
+ issuer: string;
425
+ type: string[];
426
+ issuanceDate: string;
427
+ proof: {
428
+ type: string;
429
+ created: string;
430
+ proofPurpose: string;
431
+ proofValue: string;
432
+ verificationMethod: string;
433
+ };
434
+ };
435
+
436
+ export { BATCHED_RAW_DOCUMENTS_DID, BATCHED_SIGNED_WRAPPED_DOCUMENTS_DID, BATCHED_WRAPPED_DOCUMENTS_DID, RAW_DOCUMENT_DID, RAW_DOCUMENT_DID_OSCP, SAMPLE_SIGNING_KEYS, SIGNED_WRAPPED_DOCUMENT_DID, SIGNED_WRAPPED_DOCUMENT_DID_OBFUSCATED, SIGNED_WRAPPED_DOCUMENT_DID_OSCP, W3C_VERIFIABLE_DOCUMENT, WRAPPED_DOCUMENT_DID, WRAPPED_DOCUMENT_DID_OSCP, WRAPPED_DOCUMENT_DNS_TXT_V2 };