@trustvc/trustvc 2.0.0 → 2.0.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.
- package/README.md +25 -26
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## About
|
|
4
4
|
|
|
5
|
-
TrustVC is a comprehensive wrapper library designed to simplify the signing and verification processes for TrustVC W3C [Verifiable Credentials (VC)](https://github.com/TrustVC/w3c) and OpenAttestation Verifiable Documents (VD), adhering to the W3C [VC](https://www.w3.org/TR/vc-data-model/) Data Model
|
|
5
|
+
TrustVC is a comprehensive wrapper library designed to simplify the signing and verification processes for TrustVC W3C [Verifiable Credentials (VC)](https://github.com/TrustVC/w3c) and OpenAttestation Verifiable Documents (VD), adhering to the W3C [VC](https://www.w3.org/TR/vc-data-model/) Data Model v2.0 (W3C Standard). It ensures compatibility and interoperability for Verifiable Credentials while supporting OpenAttestation [Verifiable Documents (VD)](https://github.com/Open-Attestation/open-attestation) v6.9.5. TrustVC seamlessly integrates functionalities for handling W3C Verifiable Credentials and OpenAttestation Verifiable Documents, leveraging existing TradeTrust libraries and smart contracts for [Token Registry](https://github.com/TradeTrust/token-registry) (V4 and V5). Additionally, it includes essential utility functions for strings, networks, and chains, making it a versatile tool for developers working with decentralized identity and verifiable data solutions.
|
|
6
6
|
|
|
7
7
|
## Table of Contents
|
|
8
8
|
|
|
@@ -114,7 +114,7 @@ console.log(wrappedDocuments);
|
|
|
114
114
|
|
|
115
115
|
### 2. **Signing**
|
|
116
116
|
|
|
117
|
-
> The TrustVC Signing feature simplifies the signing process for OA documents and W3C-compliant verifiable credentials using
|
|
117
|
+
> The TrustVC Signing feature simplifies the signing process for OA documents and W3C-compliant verifiable credentials using ECDSA signature. This feature allows you to easily sign W3C Verifiable Credentials (VCs) and ensure they comply with the latest standards.
|
|
118
118
|
|
|
119
119
|
The signing functionality is split into two methods:
|
|
120
120
|
|
|
@@ -169,7 +169,7 @@ const rawDocument = {
|
|
|
169
169
|
],
|
|
170
170
|
credentialStatus: {
|
|
171
171
|
id: 'https://trustvc.github.io/did/credentials/statuslist/1#1',
|
|
172
|
-
type: '
|
|
172
|
+
type: 'BitstringStatusListEntry',
|
|
173
173
|
statusPurpose: 'revocation',
|
|
174
174
|
statusListIndex: '10',
|
|
175
175
|
statusListCredential: 'https://trustvc.github.io/did/credentials/statuslist/1',
|
|
@@ -241,12 +241,11 @@ const signedDocument = {
|
|
|
241
241
|
'@context': [
|
|
242
242
|
'https://www.w3.org/ns/credentials/v2',
|
|
243
243
|
'https://w3id.org/security/data-integrity/v2',
|
|
244
|
-
'https://w3id.org/vc/status-list/2021/v1',
|
|
245
244
|
'https://w3c-ccg.github.io/citizenship-vocab/contexts/citizenship-v2.jsonld'
|
|
246
245
|
],
|
|
247
246
|
credentialStatus: {
|
|
248
247
|
id: 'https://trustvc.github.io/did/credentials/statuslist/1#1',
|
|
249
|
-
type: '
|
|
248
|
+
type: 'BitstringStatusListEntry',
|
|
250
249
|
statusPurpose: 'revocation',
|
|
251
250
|
statusListIndex: '10',
|
|
252
251
|
statusListCredential: 'https://trustvc.github.io/did/credentials/statuslist/1'
|
|
@@ -260,14 +259,14 @@ const signedDocument = {
|
|
|
260
259
|
type: ['VerifiableCredential'],
|
|
261
260
|
validFrom: '2024-04-01T12:19:52Z',
|
|
262
261
|
validUntil: '2029-12-03T12:19:52Z',
|
|
263
|
-
id: 'urn:uuid:
|
|
262
|
+
id: 'urn:uuid:0198e4a3-b601-7117-9d02-8c9a9a54ab5d',
|
|
264
263
|
proof: {
|
|
265
264
|
type: 'DataIntegrityProof',
|
|
266
265
|
created: '2025-08-18T14:38:51Z',
|
|
267
266
|
verificationMethod: 'did:web:trustvc.github.io:did:1#multikey-1',
|
|
268
267
|
cryptosuite: 'ecdsa-sd-2023',
|
|
269
268
|
proofPurpose: 'assertionMethod',
|
|
270
|
-
proofValue: '
|
|
269
|
+
proofValue: 'u2V0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FsaWRGcm9t'
|
|
271
270
|
}
|
|
272
271
|
};
|
|
273
272
|
|
|
@@ -283,42 +282,42 @@ const derivationResult = await deriveW3C(signedDocument, {
|
|
|
283
282
|
|
|
284
283
|
### 4. **Verifying**
|
|
285
284
|
|
|
286
|
-
> TrustVC simplifies the verification process with a single function that supports both W3C Verifiable Credentials (VCs) and OpenAttestation Verifiable Documents (VDs). Whether you're working with W3C standards or OpenAttestation standards, TrustVC handles the verification seamlessly.
|
|
285
|
+
> TrustVC simplifies the verification process with a single function that supports both W3C Verifiable Credentials (VCs) and OpenAttestation Verifiable Documents (VDs). Whether you're working with W3C standards or OpenAttestation standards, TrustVC handles the verification seamlessly. For ECDSA-signed documents, which normally require derivation before verification, TrustVC automatically handles this process internally - if a document is not derived, the `verifyDocument` function will automatically derive and verify the document in a single step.
|
|
287
286
|
|
|
288
287
|
```ts
|
|
289
288
|
import { verifyDocument } from '@trustvc/trustvc';
|
|
290
289
|
|
|
291
290
|
const signedDocument = {
|
|
292
291
|
'@context': [
|
|
293
|
-
'https://www.w3.org/
|
|
294
|
-
'https://
|
|
295
|
-
'https://
|
|
296
|
-
'https://w3id.org/vc/status-list/2021/v1',
|
|
292
|
+
'https://www.w3.org/ns/credentials/v2',
|
|
293
|
+
'https://w3id.org/security/data-integrity/v2',
|
|
294
|
+
'https://w3c-ccg.github.io/citizenship-vocab/contexts/citizenship-v2.jsonld'
|
|
297
295
|
],
|
|
298
296
|
credentialStatus: {
|
|
299
297
|
id: 'https://trustvc.github.io/did/credentials/statuslist/1#1',
|
|
300
|
-
type: '
|
|
298
|
+
type: 'BitstringStatusListEntry',
|
|
301
299
|
statusPurpose: 'revocation',
|
|
302
300
|
statusListIndex: '10',
|
|
303
|
-
statusListCredential: 'https://trustvc.github.io/did/credentials/statuslist/1'
|
|
301
|
+
statusListCredential: 'https://trustvc.github.io/did/credentials/statuslist/1'
|
|
304
302
|
},
|
|
305
303
|
credentialSubject: {
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
304
|
+
type: ['Person'],
|
|
305
|
+
givenName: 'TrustVC',
|
|
306
|
+
birthDate: '2024-04-01T12:19:52Z'
|
|
309
307
|
},
|
|
310
|
-
expirationDate: '2029-12-03T12:19:52Z',
|
|
311
308
|
issuer: 'did:web:trustvc.github.io:did:1',
|
|
312
309
|
type: ['VerifiableCredential'],
|
|
313
|
-
|
|
310
|
+
validFrom: '2024-04-01T12:19:52Z',
|
|
311
|
+
validUntil: '2029-12-03T12:19:52Z',
|
|
312
|
+
id: 'urn:uuid:0198e4a3-b601-7117-9d02-8c9a9a54ab5d',
|
|
314
313
|
proof: {
|
|
315
|
-
type: '
|
|
316
|
-
created: '
|
|
314
|
+
type: 'DataIntegrityProof',
|
|
315
|
+
created: '2025-08-18T14:38:51Z',
|
|
316
|
+
verificationMethod: 'did:web:trustvc.github.io:did:1#multikey-1',
|
|
317
|
+
cryptosuite: 'ecdsa-sd-2023',
|
|
317
318
|
proofPurpose: 'assertionMethod',
|
|
318
|
-
proofValue:
|
|
319
|
-
|
|
320
|
-
verificationMethod: 'did:web:trustvc.github.io:did:1#keys-1',
|
|
321
|
-
},
|
|
319
|
+
proofValue: 'u2V0AhVhAWvyp4W7vt4DBhJy2JjKdbDjNSjh3mFsIfPv68Xk2uc4PSFf1iiAeq19rvnHou1LW_Ff0MrRxzcmuTsBO54q3vVgjgCQDz9CT1s28B8Wsk-i8hgzexvcOZgInRbK9VpG6pMwSfbNYIA0xoaqSwjMxAISQ2l2uRmBFlIdL3XFduNUlo93wj5EMilhA24fPUQHaYlpN2hezHkI2QbUpUzVdIoRFA9KdzA1JNWM9GuCKWF0A62W91QmN82237JIiF1d2aLq3lnCpgR_Y-VhAdhqKN1MXPH5BNYAmM1rSZLHGF92dYt2k3XLb84UsgBYNx0f5VKOKFKNY-ZNho59RdsSTRNbsUzU-zzH1CLkc-lhAKgI6LHZPLePwB-Vsad2jOO-_PGHoHas5-uNJDDSp-xTO2auFGmpI6OGx-U_xwcKYX3su3qwtYCJ3nf2-l-t5SFhAfNLg1QbwjJBStUFCcVZWzu1wDh1d9owiox2nNm9EDun4DU40ThWLoWJEEGtqJYE0XFeMxCNkGJGvBQkXJxKZYlhAXBhzKu4D8oXuUHymh5rXvp-a4cUHI0Mh0H0eEifx41FqPc_hNNhCEZKAl_lB6mxIAA-5rqDkUH8zj-gH0TDgq1hA8GZCjLF6wE5feS14DscTe_oVIAfe_2YYTdDLwtklycGXiIGjMs3XmX002URnASJU2RcX1hROupc2tpXFGOQZmlhAPwgkCD6aSL2gusl56goodXi7lg5GDJyh3iYSSA2qL0HkBs7q3FsbijIvscH3-bIEWZHUX127ZC3f1UL85WPR01hAQi-48VLrcfPC1aFuwuUQm_UEwkZ4LZsEvvPrPtrC1WjtGq7-NDAfNkz6cO9MgsUwjAncXliJW-tTNX3ujDfEA1hAARmh7uujgnsv7CoQt4suDhtVJKZA5UdKahJkUvqXZKRFfhRmJHPwJKnM04IV_AcQd8RH--v2ZUzD6IUGYXCUIVhABjkqmiaLL9PY20li9JBOd0VR7udnu0eM8JMGnnHm_gEIKM3eHWPqyfJyw9AfFymBwm0fgBqRxf0LIo9uDkLlwYJnL2lzc3VlcmovdmFsaWRGcm9t'
|
|
320
|
+
}
|
|
322
321
|
};
|
|
323
322
|
|
|
324
323
|
const resultFragments = await verifyDocument(signedDocument);
|
|
@@ -809,7 +808,7 @@ Example Output After Signing
|
|
|
809
808
|
},
|
|
810
809
|
"credentialStatus": {
|
|
811
810
|
"id": "https://example.com/status-list#<placeholder>",
|
|
812
|
-
"type": "
|
|
811
|
+
"type": "BitstringStatusListEntry",
|
|
813
812
|
"statusPurpose": "revocation",
|
|
814
813
|
"statusListIndex": "<placeholder>",
|
|
815
814
|
"statusListCredential": "https://example.com/status-list"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trustvc/trustvc",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2",
|
|
4
4
|
"description": "TrustVC library",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
"@trustvc/w3c-context": "^1.3.0-alpha.7",
|
|
126
126
|
"@trustvc/w3c-credential-status": "^1.3.0-alpha.7",
|
|
127
127
|
"@trustvc/w3c-issuer": "^1.3.0-alpha.5",
|
|
128
|
-
"@trustvc/w3c-vc": "^1.3.0-alpha.
|
|
128
|
+
"@trustvc/w3c-vc": "^1.3.0-alpha.8",
|
|
129
129
|
"ethers": "^5.8.0",
|
|
130
130
|
"ethersV6": "npm:ethers@^6.14.4",
|
|
131
131
|
"js-sha3": "^0.9.3",
|