@trustvc/trustvc 1.0.0 → 1.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 CHANGED
@@ -1,18 +1,125 @@
1
1
  # TrustVC
2
2
 
3
3
  ## About
4
- TrustVC is a wrapper library that facilitates the signing and verification of TrustVC W3C [Verifiable Credentials (VC)](https://github.com/TrustVC/w3c/tree/alpha) 1.0.0-alpha, adhering to the W3C [VC](https://www.w3.org/TR/vc-data-model/) Data Model v1.1 and OpenAttestation [Verifiable Documents (VD)](https://github.com/Open-Attestation/open-attestation/tree/beta) v6.10.0-beta.
5
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 v1.1 (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
+
7
+ ## Table of Contents
8
+
9
+ - [TrustVC](#trustvc)
10
+ - [About](#about)
11
+ - [Installation](#installation)
12
+ - [Functions](#functions)
13
+ - [1. **Wrapping**](#1-wrapping)
14
+ - [a) wrapOADocument](#a-wrapoadocument)
15
+ - [b) wrapOADocuments](#b-wrapoadocuments)
16
+ - [2. **Signing**](#2-signing)
17
+ - [a) OpenAttestation Signing (signOA) v2 v3](#a-openattestation-signing-signoa-v2-v3)
18
+ - [b) TrustVC W3C Signing (signW3C)](#b-trustvc-w3c-signing-signw3c)
19
+ - [3. **Verifying**](#3-verifying)
20
+ - [4. **Encryption**](#4-encryption)
21
+ - [5. **Decryption**](#5-decryption)
22
+ - [6. **TradeTrust Token Registry**](#6-tradetrust-token-registry)
23
+ - [Usage](#usage-2)
24
+ - [TradeTrustToken](#tradetrusttoken)
25
+ - [a) Token Registry v4](#a-token-registry-v4)
26
+ - [b) Token Registry V5](#b-token-registry-v5)
27
+
28
+ ## Installation
29
+
30
+ ```ts
31
+ npm install
32
+ npm run build
33
+ npm run test
34
+ ```
6
35
 
7
36
  ## Functions
8
- ### 1. **Signing**
9
37
 
10
- > Independent signing function for TrustVC W3C VC and OpenAttestation VD
38
+ ### 1. **Wrapping**
39
+
40
+ > This module provides utility functions for wrapping OpenAttestation documents of version 2 (v2) and version 3 (v3). These functions validate the document version and apply the appropriate wrapping logic using the OpenAttestation library. Note that wrapping is not required for W3C-compliant documents, as they follow a different format and standard.
41
+
42
+ #### a) wrapOADocument
43
+
44
+ #### Description
45
+
46
+ > Wraps a single OpenAttestation document asynchronously, supporting both v2 and v3 documents.
47
+
48
+ #### Parameters
11
49
 
12
- 1. OpenAttestation Signing (signOA), supporting only OA Schema [v4](https://github.com/Open-Attestation/open-attestation/tree/beta/src/4.0)
13
-
14
- > [!NOTE]
15
- > Do not confuse OA Schema V4 with OA package version.
50
+ > **document: OpenAttestationDocument**
51
+ > The OpenAttestation document to be wrapped.
52
+
53
+ #### Returns
54
+
55
+ > **Promise<WrappedDocument>**
56
+ > A promise that resolves to the wrapped document.
57
+
58
+ #### Throws
59
+
60
+ > **Error**
61
+ > If the document version is unsupported or if an error occurs during wrapping.
62
+
63
+ ```ts
64
+ import { wrapOADocument } from '@trustvc/trustvc';
65
+
66
+ const document = {
67
+ /* OpenAttestation document (v2 or v3) */
68
+ };
69
+ const wrappedDocument = await wrapOADocument(document);
70
+ console.log(wrappedDocument);
71
+ ```
72
+
73
+ #### b) wrapOADocuments
74
+
75
+ #### Description
76
+
77
+ > Wraps multiple OpenAttestation documents asynchronously, supporting both v2 and v3 documents.
78
+
79
+ #### Parameters
80
+
81
+ > **documents: OpenAttestationDocument[]**
82
+ > An array of OpenAttestation documents to be wrapped.
83
+
84
+ #### Returns
85
+
86
+ > **Promise<WrappedDocument[]>**
87
+ > A promise that resolves to the array of wrapped documents.
88
+
89
+ #### Throws
90
+
91
+ > **Error**
92
+ > If the documents include unsupported versions or if an error occurs during wrapping.
93
+
94
+ #### Example
95
+
96
+ ```ts
97
+ import { wrapOADocuments } from '@trustvc/trustvc';
98
+
99
+ const documents = [
100
+ {
101
+ /* doc1 */
102
+ },
103
+ {
104
+ /* doc2 */
105
+ },
106
+ ];
107
+ const wrappedDocuments = await wrapOADocuments(documents);
108
+ console.log(wrappedDocuments);
109
+ ```
110
+
111
+ ---
112
+
113
+ ### 2. **Signing**
114
+
115
+ > The TrustVC Signing feature simplifies the signing process for OA documents and W3C-compliant verifiable credentials using BBS+ signatures. This feature allows you to easily sign W3C Verifiable Credentials (VCs) and ensure they comply with the latest standards.
116
+
117
+ The signing functionality is split into two methods:
118
+
119
+ 1. signOA: Designed specifically for signing OpenAttestation documents.
120
+ 2. signW3C: Tailored for signing W3C-compliant verifiable credentials.
121
+
122
+ #### a) OpenAttestation Signing (signOA) [v2](https://github.com/Open-Attestation/open-attestation/tree/master/src/2.0) [v3](https://github.com/Open-Attestation/open-attestation/tree/master/src/3.0)
16
123
 
17
124
  ```ts
18
125
  import { wrapOA, signOA } from '@trustvc/trustvc';
@@ -34,7 +141,7 @@ const rawDocument = {
34
141
  name: 'Government Technology Agency of Singapore (GovTech)',
35
142
  identityProof: { identityProofType: 'DNS-DID', identifier: 'example.openattestation.com' },
36
143
  },
37
- }
144
+ };
38
145
 
39
146
  const wrappedDocument = await wrapOA(rawDocument);
40
147
 
@@ -44,11 +151,10 @@ const signedWrappedDocument = await signOA(wrappedDocument, {
44
151
  });
45
152
  ```
46
153
 
47
- 2. TrustVC W3C Signing (signW3C)
154
+ #### b) TrustVC W3C Signing (signW3C)
48
155
 
49
156
  ```ts
50
- import { signW3C } from '@trustvc/trustvc';
51
- import { VerificationType } from '@trustvc/w3c-issuer';
157
+ import { signW3C, VerificationType } from '@trustvc/trustvc';
52
158
 
53
159
  const rawDocument = {
54
160
  '@context': [
@@ -72,8 +178,8 @@ const rawDocument = {
72
178
  expirationDate: '2029-12-03T12:19:52Z',
73
179
  issuer: 'did:web:trustvc.github.io:did:1',
74
180
  type: ['VerifiableCredential'],
75
- issuanceDate: '2024-04-01T12:19:52Z'
76
- }
181
+ issuanceDate: '2024-04-01T12:19:52Z',
182
+ };
77
183
 
78
184
  const signingResult = await signW3C(rawDocument, {
79
185
  id: 'did:web:trustvc.github.io:did:1#keys-1',
@@ -85,11 +191,11 @@ const signingResult = await signW3C(rawDocument, {
85
191
  });
86
192
  ```
87
193
 
88
- ### 2. **Verifying**
194
+ ---
89
195
 
90
- > Single verifying function to simplify the process
196
+ ### 3. **Verifying**
91
197
 
92
- 1. Verify
198
+ > 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.
93
199
 
94
200
  ```ts
95
201
  import { verifyDocument } from '@trustvc/trustvc';
@@ -125,14 +231,359 @@ const signedDocument = {
125
231
  'l79dlFQMowalep+WCFqgCvpVBcCAr0GDEFUV6S7gRVY/TQ+sp/wcwaT61PaD19rJYUHlKfzccE4m7waZyoLEkBLFiK2g54Q2i+CdtYBgDdkUDsoULSBMcH1MwGHwdjfXpldFNFrHFx/IAvLVniyeMQ==',
126
232
  verificationMethod: 'did:web:trustvc.github.io:did:1#keys-1',
127
233
  },
128
- }
234
+ };
129
235
 
130
236
  const resultFragments = await verifyDocument(signedDocument);
131
237
  ```
132
238
 
133
- ## Running the code
239
+ ---
240
+
241
+ ### 4. **Encryption**
242
+
243
+ > The `encrypt` function encrypts plaintext messages using the **ChaCha20** encryption algorithm, ensuring the security and integrity of the input data. It supports custom keys and nonces, returning the encrypted message in hexadecimal format.
244
+
245
+ #### Function Signature
246
+
247
+ function encrypt(message: string, key: string, nonce?: string): string;
248
+
249
+ #### Description
250
+
251
+ The `encrypt` function is a utility for encrypting text messages using **ChaCha20**, a stream cipher known for its speed and security. This function ensures that the key meets the 32-byte requirement and that a valid 12-byte nonce is either supplied or generated.
252
+
253
+ The output is a hexadecimal string representing the encrypted data.
254
+
255
+ #### Parameters
256
+
257
+ - `message` (string): The plaintext message to encrypt.
258
+ - `key` (string): The encryption key, which will be transformed into a 32-byte key.
259
+ - `nonce` (string, optional): A 12-byte nonce for encryption. If omitted, a new nonce will be generated automatically.
260
+
261
+ #### Returns
262
+
263
+ - `string`: The encrypted message encoded in hexadecimal format.
264
+
265
+ #### Errors
266
+
267
+ - Runtime errors: Issues during key transformation, nonce generation, or encryption.
268
+
269
+ #### Usage
270
+
271
+ #### Example 1: Basic Encryption
272
+
273
+ ```ts
274
+ import { encrypt } from '@trustvc/trustvc';
275
+
276
+ const message = 'Hello, ChaCha20!';
277
+ const key = 'my-secret-key';
278
+ const encryptedMessage = encrypt(message, key);
279
+
280
+ console.log(`Encrypted Message: ${encryptedMessage}`);
134
281
  ```
135
- npm install
136
- npm run build
137
- npm run test
282
+
283
+ #### Example 2: Encryption with a Custom Nonce
284
+
285
+ ```ts
286
+ import { encrypt } from '@trustvc/trustvc';
287
+
288
+ const message = 'Secure this message.';
289
+ const key = 'another-secret-key';
290
+ const nonce = '123456789012'; // Custom 12-byte nonce
291
+
292
+ const encryptedMessage = encrypt(message, key, nonce);
293
+ console.log(`Encrypted Message with Nonce: ${encryptedMessage}`);
294
+ ```
295
+
296
+ #### Internal Dependencies
297
+
298
+ The function uses the following utilities:
299
+
300
+ 1. `stringToUint8Array`: Converts strings to `Uint8Array`.
301
+ 2. `generate32ByteKey`: Ensures the key is exactly 32 bytes.
302
+ 3. `generate12ByteNonce`: Produces a valid 12-byte nonce if none is provided.
303
+
304
+ It also relies on the `ts-chacha20` library for encryption operations.
305
+
306
+ #### Output Format
307
+
308
+ - The encrypted message is returned as a **hexadecimal string**.
309
+
310
+ #### Notes
311
+
312
+ 1. Always ensure the key and nonce are securely stored and not reused.
313
+ 2. ChaCha20 requires a unique nonce for each encryption to maintain security.
314
+ 3. Hexadecimal encoding is used by default for simplicity and readability.
315
+
316
+ ---
317
+
318
+ ### 5. **Decryption**
319
+
320
+ > The `decrypt` function decrypts messages encrypted with the **ChaCha20** algorithm. It converts the input from a hexadecimal format back into plaintext using the provided key and nonce.
321
+
322
+ #### Function Signature
323
+
324
+ ```ts
325
+ function decrypt(encryptedMessage: string, key: string, nonce?: string): string;
138
326
  ```
327
+
328
+ #### Description
329
+
330
+ The `decrypt` function is a utility for decrypting hexadecimal-encoded messages that were encrypted using the **ChaCha20** stream cipher. It ensures the key meets the 32-byte requirement and validates or generates a 12-byte nonce if not supplied.
331
+
332
+ The function returns the original plaintext message in UTF-8 format.
333
+
334
+ #### Parameters
335
+
336
+ - `encryptedMessage` (string): The encrypted message, in hexadecimal format.
337
+ - `key` (string): The decryption key, which will be transformed into a 32-byte key. Defaults to `DEFAULT_KEY` if an empty key is provided.
338
+ - `nonce` (string, optional): A 12-byte nonce used during encryption. If omitted, one will be generated.
339
+
340
+ #### Returns
341
+
342
+ - `string`: The decrypted plaintext message in UTF-8 format.
343
+
344
+ #### Errors
345
+
346
+ The function throws an error if:
347
+
348
+ - The key is invalid or transformation fails.
349
+ - The decryption process encounters unexpected issues.
350
+
351
+ #### Usage
352
+
353
+ #### Example 1: Basic Decryption
354
+
355
+ ```ts
356
+ import { decrypt } from '@trustvc/trustvc';
357
+
358
+ const encryptedMessage = 'e8b7c7e9...';
359
+ const key = 'my-secret-key';
360
+ const decryptedMessage = decrypt(encryptedMessage, key);
361
+
362
+ console.log(`Decrypted Message: ${decryptedMessage}`);
363
+ ```
364
+
365
+ #### Example 2: Decryption with a Custom Nonce
366
+
367
+ ```ts
368
+ import { decrypt } from '@trustvc/trustvc';
369
+
370
+ const encryptedMessage = 'f3a7e9b2...';
371
+ const key = 'another-secret-key';
372
+ const nonce = '123456789012'; // Custom 12-byte nonce
373
+
374
+ const decryptedMessage = decrypt(encryptedMessage, key, nonce);
375
+ console.log(`Decrypted Message with Nonce: ${decryptedMessage}`);
376
+ ```
377
+
378
+ #### Internal Dependencies
379
+
380
+ The function uses the following utilities:
381
+
382
+ 1. `stringToUint8Array`: Converts strings to `Uint8Array`.
383
+ 2. `generate32ByteKey`: Ensures the key is exactly 32 bytes.
384
+ 3. `generate12ByteNonce`: Produces a valid 12-byte nonce if none is provided.
385
+
386
+ It also relies on the `ts-chacha20` library for decryption operations.
387
+
388
+ #### Output Format
389
+
390
+ - The function accepts the encrypted message in **hexadecimal format** and returns the decrypted message in **UTF-8 format**.
391
+
392
+ #### Notes
393
+
394
+ 1. Always use the same key and nonce pair that were used during encryption for successful decryption.
395
+ 2. If a custom nonce is not provided, the function will generate a new one, which may not match the original encryption nonce and will result in decryption failure.
396
+ 3. The default key, `DEFAULT_KEY`, should only be used for fallback scenarios and not in production environments.
397
+ 4. Suggestion: If available, consider using the value of the key Id inside the document as the encryption key. This can simplify key management and enhance the security of your encryption process.
398
+
399
+ ---
400
+
401
+ ### 6. **TradeTrust Token Registry**
402
+
403
+ > The Electronic Bill of Lading (eBL) is a digital document that can be used to prove the ownership of goods. It is a standardized document that is accepted by all major shipping lines and customs authorities. The [Token Registry](https://github.com/TradeTrust/token-registry) repository contains both the smart contract (v4 and v5) code for token registry (in `/contracts`) as well as the node package for using this library (in `/src`).
404
+ > The TrustVC library not only simplifies signing and verification but also imports and integrates existing TradeTrust libraries and smart contracts for token registry (V4 and V5), making it a versatile tool for decentralized identity and trust solutions.
405
+
406
+ #### Usage
407
+
408
+ > To use the package, you will need to provide your own Web3 [provider](https://docs.ethers.io/v5/api/providers/api-providers/) or [signer](https://docs.ethers.io/v5/api/signer/#Wallet) (if you are writing to the blockchain). This package exposes the [Typechain(Ethers)](https://github.com/dethcrypto/TypeChain/tree/master/packages/target-ethers-v5) bindings for the contracts.
409
+
410
+ #### TradeTrustToken
411
+
412
+ > The `TradeTrustToken` is a Soulbound Token (SBT) tied to the Title Escrow. The SBT implementation is loosely based on OpenZeppelin's implementation of the [ERC721](http://erc721.org/) standard.
413
+ > An SBT is used in this case because the token, while can be transferred to the registry, is largely restricted to its designated Title Escrow contracts.
414
+ > See issue [#108](https://github.com/Open-Attestation/token-registry/issues/108) for more details.
415
+
416
+ #### a) Token Registry v4
417
+
418
+ #### Connect to existing token registry
419
+
420
+ ```ts
421
+ import { v4Contracts } from '@trustvc/trustvc';
422
+
423
+ const v4connectedRegistry = v4Contracts.TradeTrustToken__factory.connect(
424
+ tokenRegistryAddress,
425
+ signer,
426
+ );
427
+ ```
428
+
429
+ #### Issuing a Document
430
+
431
+ ```ts
432
+ await v4connectedRegistry.mint(beneficiaryAddress, holderAddress, tokenId);
433
+ ```
434
+
435
+ #### Restoring a Document
436
+
437
+ ```ts
438
+ await v4connectedRegistry.restore(tokenId);
439
+ ```
440
+
441
+ #### Accept/Burn a Document
442
+
443
+ ```ts
444
+ await v4connectedRegistry.burn(tokenId);
445
+ ```
446
+
447
+ For more information on Token Registry and Title Escrow contracts **version v4**, please visit the readme of [TradeTrust Token Registry V4](https://github.com/TradeTrust/token-registry/blob/v4/README.md).
448
+
449
+ #### b) Token Registry V5
450
+
451
+ > Token Registry v5 is the newest version. It allows you to manage token-based credentials and ownership transfers through smart contracts.
452
+ > The Tradetrust Token Registry now supports **encrypted remarks** for enhanced security when executing contract functions. This guide explains how to use the updated title-escrow command with encrypted remarks and highlights the changes introduced in this version.
453
+ > A new **rejection function** feature has been introduced, allowing a new holder or owner of a document to reject the transfer of the document. This provides an additional layer of control and flexibility for holders and owners to refuse ownership or custodianship if required.
454
+
455
+ > [!IMPORTANT]
456
+ > This new version uses:
457
+ >
458
+ > - **Ethers v6**
459
+ > - **OpenZeppelin v5**
460
+ > - Contracts are upgraded to **v 0.8.20**
461
+ > - Runs on **Compiler v 0.8.22**
462
+
463
+ > The `remark` field is optional and can be left empty by providing an empty string `"0x"`.
464
+ > Please note that any value in the `remark` field is limited to **120** characters, and encryption is **recommended**.
465
+
466
+ #### Connect to Token Registry
467
+
468
+ In Token Registry v5, the way you connect to a registry hasn’t changed much, but it's **important** to ensure you're using the **updated contract and factory from Token Registry v5**.
469
+
470
+ In TrustVC, you will use the token-registry-v5 module to access the Token Registry v5 contracts.
471
+
472
+ ```ts
473
+ import { v5Contracts } from '@trustvc/trustvc';
474
+
475
+ const connectedRegistry = v5Contracts.TradeTrustToken__factory.connect(
476
+ tokenRegistryAddress,
477
+ signer,
478
+ );
479
+ ```
480
+
481
+ #### Issuing a Document
482
+
483
+ In Token Registry v5, there is a slight change when you mint tokens. You will now need to pass `remarks` as an optional argument. If no remarks are provided, ensure you pass `0x` to avoid errors.
484
+
485
+ ```ts
486
+ await connectedRegistry.mint(beneficiaryAddress, holderAddress, tokenId, remarks);
487
+ ```
488
+
489
+ **If no remarks are passed, the method expects '0x' as the value for remarks**:
490
+
491
+ ```ts
492
+ await connectedRegistry.mint(beneficiaryAddress, holderAddress, tokenId, '0x');
493
+ ```
494
+
495
+ #### Restoring a Document
496
+
497
+ The restore method remains mostly the same, but you'll now also have the option to include remarks.
498
+
499
+ ```ts
500
+ await connectedRegistry.restore(tokenId, remarks);
501
+ ```
502
+
503
+ **If no remarks are passed, use '0x'**:
504
+
505
+ ```ts
506
+ await connectedRegistry.restore(tokenId, '0x');
507
+ ```
508
+
509
+ #### Accepting/Burning a Document
510
+
511
+ You can burn or accept a document in Token Registry v5 by passing remarks as an optional argument.
512
+
513
+ ```ts
514
+ await connectedRegistry.burn(tokenId, remarks);
515
+ ```
516
+
517
+ **If no remarks are passed, use '0x'**:
518
+
519
+ ```ts
520
+ await connectedRegistry.burn(tokenId, '0x');
521
+ ```
522
+
523
+ #### Connecting to Title Escrow
524
+
525
+ When connecting to Title Escrow, the process is similar. You will use the updated contract from Token Registry v5 or TrustVC depending on your installation choice.
526
+
527
+ > [!IMPORTANT]
528
+ > A new `remark` field has been **introduced** for all contract operations.
529
+ >
530
+ > The `remark` field is optional and can be left empty by providing an empty string `"0x"`.
531
+ > Please note that any value in the `remark` field is limited to **120** characters, and encryption is **recommended**.
532
+
533
+ ```ts
534
+ import { v5Contracts } from '@trustvc/trustvc';
535
+
536
+ const connectedEscrow = v5Contracts.TitleEscrow__factory.connect(
537
+ existingTitleEscrowAddress,
538
+ signer,
539
+ );
540
+ ```
541
+
542
+ #### Surrender to Return to Issuer
543
+
544
+ In Token Registry v4, the method to return the title to the issuer was surrender(). With Token Registry v5, this has been updated to returnToIssuer().
545
+
546
+ ```ts
547
+ await connectedEscrow.returnToIssuer(remarks);
548
+ ```
549
+
550
+ **If no remarks are provided, you must pass '0x' as the argument**:
551
+
552
+ ```ts
553
+ await connectedEscrow.returnToIssuer('0x');
554
+ ```
555
+
556
+ #### Rejecting Transfers of Beneficiary/Holder
557
+
558
+ Token Registry v5 introduces additional methods for rejecting transfers, if necessary, for wrongful transactions:
559
+
560
+ > [!IMPORTANT]
561
+ > Rejection must occur as the very next action after being appointed as **`beneficiary`** and/or **`holder`**. If any transactions occur by the new appointee, it will be considered as an implicit acceptance of appointment.
562
+ >
563
+ > There are separate methods to reject a **`beneficiary`** (`rejectTransferBeneficiary`) and a **`holder`** (`rejectTransferHolder`). However, if you are both, you must use `rejectTransferOwners`, as the other two methods will not work in this case.
564
+
565
+ **Reject Transfer of Ownership**:
566
+
567
+ Prevents a transfer of ownership to an incorrect or unauthorized party.
568
+
569
+ ```ts
570
+ function rejectTransferOwner(bytes calldata _remark) external;
571
+ ```
572
+
573
+ **Reject Transfer of Holding**:
574
+
575
+ Prevents a transfer of holding to an incorrect or unauthorized party.
576
+
577
+ ```ts
578
+ function rejectTransferHolder(bytes calldata _remark) external;
579
+ ```
580
+
581
+ **Reject Both Roles (Ownership & Holding)**:
582
+
583
+ Prevents both ownership and holding transfers, effectively rejecting the entire transfer process.
584
+
585
+ ```ts
586
+ function rejectTransferOwners(bytes calldata _remark) external;
587
+ ```
588
+
589
+ For more information on Token Registry and Title Escrow contracts **version v5**, please visit the readme of [TradeTrust Token Registry V5](https://github.com/TradeTrust/token-registry/blob/master/README.md)
@@ -1,5 +1,5 @@
1
1
  import { openAttestationVerifiers as openAttestationVerifiers$1, openAttestationDidIdentityProof, openAttestationHash, openAttestationDidSignedDocumentStatus, openAttestationEthereumDocumentStoreStatus, openAttestationEthereumTokenRegistryStatus, openAttestationDnsDidIdentityProof, openAttestationDnsTxtIdentityProof } from '@tradetrust-tt/tt-verify';
2
- export { isValid, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
2
+ export { createResolver, getIdentifier, isValid, utils, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
3
3
  import { w3cSignatureIntegrity } from './fragments/document-integrity/w3cSignatureIntegrity';
4
4
  import { credentialStatusTransferableRecordVerifier } from './fragments/document-status/transferableRecords/transferableRecordVerifier';
5
5
  import { w3cCredentialStatus } from './fragments/document-status/w3cCredentialStatus';
package/dist/index.d.mts CHANGED
@@ -27,8 +27,8 @@ export * from '@tradetrust-tt/tradetrust-utils/constants/supportedChains';
27
27
  export * from '@tradetrust-tt/dnsprove';
28
28
  export { OpenAttestationDocument, SUPPORTED_SIGNING_ALGORITHM, SchemaId, SignedWrappedDocument, WrappedDocument, getData as getDataV2, isSchemaValidationError, obfuscateDocument, v2, v3, validateSchema, __unsafe__use__it__at__your__own__risks__wrapDocument as wrapOADocumentV3, __unsafe__use__it__at__your__own__risks__wrapDocuments as wrapOADocumentsV3 } from '@tradetrust-tt/tradetrust';
29
29
  export { DiagnoseError } from '@tradetrust-tt/tradetrust/dist/types/shared/utils';
30
- export { isValid, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
31
- export { DocumentsToVerify, ErrorVerificationFragment, InvalidVerificationFragment, ProviderDetails, providerType as ProviderType, SkippedVerificationFragment, ValidVerificationFragment, VerificationBuilderOptions, VerificationFragment, VerificationFragmentStatus, VerificationFragmentType, VerifierOptions } from '@tradetrust-tt/tt-verify/dist/types/src/types/core';
30
+ export { createResolver, getIdentifier, isValid, utils, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
31
+ export { DocumentsToVerify, ErrorVerificationFragment, InvalidVerificationFragment, ProviderDetails, providerType as ProviderType, SkippedVerificationFragment, ValidVerificationFragment, VerificationBuilderOptions, VerificationFragment, VerificationFragmentStatus, VerificationFragmentType, Verifier, VerifierOptions } from '@tradetrust-tt/tt-verify/dist/types/src/types/core';
32
32
  import '@tradetrust-tt/token-registry-v4/contracts';
33
33
  import '@tradetrust-tt/token-registry-v5/contracts';
34
34
  import '@ethersproject/abstract-signer';
package/dist/index.d.ts CHANGED
@@ -27,8 +27,8 @@ export * from '@tradetrust-tt/tradetrust-utils/constants/supportedChains';
27
27
  export * from '@tradetrust-tt/dnsprove';
28
28
  export { OpenAttestationDocument, SUPPORTED_SIGNING_ALGORITHM, SchemaId, SignedWrappedDocument, WrappedDocument, getData as getDataV2, isSchemaValidationError, obfuscateDocument, v2, v3, validateSchema, __unsafe__use__it__at__your__own__risks__wrapDocument as wrapOADocumentV3, __unsafe__use__it__at__your__own__risks__wrapDocuments as wrapOADocumentsV3 } from '@tradetrust-tt/tradetrust';
29
29
  export { DiagnoseError } from '@tradetrust-tt/tradetrust/dist/types/shared/utils';
30
- export { isValid, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
31
- export { DocumentsToVerify, ErrorVerificationFragment, InvalidVerificationFragment, ProviderDetails, providerType as ProviderType, SkippedVerificationFragment, ValidVerificationFragment, VerificationBuilderOptions, VerificationFragment, VerificationFragmentStatus, VerificationFragmentType, VerifierOptions } from '@tradetrust-tt/tt-verify/dist/types/src/types/core';
30
+ export { createResolver, getIdentifier, isValid, utils, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
31
+ export { DocumentsToVerify, ErrorVerificationFragment, InvalidVerificationFragment, ProviderDetails, providerType as ProviderType, SkippedVerificationFragment, ValidVerificationFragment, VerificationBuilderOptions, VerificationFragment, VerificationFragmentStatus, VerificationFragmentType, Verifier, VerifierOptions } from '@tradetrust-tt/tt-verify/dist/types/src/types/core';
32
32
  import '@tradetrust-tt/token-registry-v4/contracts';
33
33
  import '@tradetrust-tt/token-registry-v5/contracts';
34
34
  import '@ethersproject/abstract-signer';
@@ -1,7 +1,7 @@
1
1
  export { openAttestationVerifiers, verifiers, w3cVerifiers } from './verify.mjs';
2
2
  export { i as fragments } from '../index-CUw8WpjA.mjs';
3
- export { isValid, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
4
- export { DocumentsToVerify, ErrorVerificationFragment, InvalidVerificationFragment, ProviderDetails, providerType as ProviderType, SkippedVerificationFragment, ValidVerificationFragment, VerificationBuilderOptions, VerificationFragment, VerificationFragmentStatus, VerificationFragmentType, VerifierOptions } from '@tradetrust-tt/tt-verify/dist/types/src/types/core';
3
+ export { createResolver, getIdentifier, isValid, utils, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
4
+ export { DocumentsToVerify, ErrorVerificationFragment, InvalidVerificationFragment, ProviderDetails, providerType as ProviderType, SkippedVerificationFragment, ValidVerificationFragment, VerificationBuilderOptions, VerificationFragment, VerificationFragmentStatus, VerificationFragmentType, Verifier, VerifierOptions } from '@tradetrust-tt/tt-verify/dist/types/src/types/core';
5
5
  import './fragments/document-status/transferableRecords/transferableRecordVerifier.types.mjs';
6
6
  import './fragments/document-integrity/w3cSignatureIntegrity.mjs';
7
7
  import './fragments/document-status/transferableRecords/transferableRecordVerifier.mjs';
@@ -1,7 +1,7 @@
1
1
  export { openAttestationVerifiers, verifiers, w3cVerifiers } from './verify.js';
2
2
  export { i as fragments } from '../index-DK8Em_TZ.js';
3
- export { isValid, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
4
- export { DocumentsToVerify, ErrorVerificationFragment, InvalidVerificationFragment, ProviderDetails, providerType as ProviderType, SkippedVerificationFragment, ValidVerificationFragment, VerificationBuilderOptions, VerificationFragment, VerificationFragmentStatus, VerificationFragmentType, VerifierOptions } from '@tradetrust-tt/tt-verify/dist/types/src/types/core';
3
+ export { createResolver, getIdentifier, isValid, utils, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
4
+ export { DocumentsToVerify, ErrorVerificationFragment, InvalidVerificationFragment, ProviderDetails, providerType as ProviderType, SkippedVerificationFragment, ValidVerificationFragment, VerificationBuilderOptions, VerificationFragment, VerificationFragmentStatus, VerificationFragmentType, Verifier, VerifierOptions } from '@tradetrust-tt/tt-verify/dist/types/src/types/core';
5
5
  import './fragments/document-status/transferableRecords/transferableRecordVerifier.types.js';
6
6
  import './fragments/document-integrity/w3cSignatureIntegrity.js';
7
7
  import './fragments/document-status/transferableRecords/transferableRecordVerifier.js';
@@ -1,8 +1,8 @@
1
1
  import { VerifierType } from './fragments/document-status/transferableRecords/transferableRecordVerifier.types.mjs';
2
2
  import * as _tradetrust_tt_tt_verify from '@tradetrust-tt/tt-verify';
3
- export { isValid, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
3
+ export { createResolver, getIdentifier, isValid, utils, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
4
4
  import { Verifier, VerificationFragment } from '@tradetrust-tt/tt-verify/dist/types/src/types/core';
5
- export { DocumentsToVerify, ErrorVerificationFragment, InvalidVerificationFragment, ProviderDetails, providerType as ProviderType, SkippedVerificationFragment, ValidVerificationFragment, VerificationBuilderOptions, VerificationFragment, VerificationFragmentStatus, VerificationFragmentType, VerifierOptions } from '@tradetrust-tt/tt-verify/dist/types/src/types/core';
5
+ export { DocumentsToVerify, ErrorVerificationFragment, InvalidVerificationFragment, ProviderDetails, providerType as ProviderType, SkippedVerificationFragment, ValidVerificationFragment, VerificationBuilderOptions, VerificationFragment, VerificationFragmentStatus, VerificationFragmentType, Verifier, VerifierOptions } from '@tradetrust-tt/tt-verify/dist/types/src/types/core';
6
6
 
7
7
  declare const verifiers: {
8
8
  documentIntegrity: {
@@ -1,8 +1,8 @@
1
1
  import { VerifierType } from './fragments/document-status/transferableRecords/transferableRecordVerifier.types.js';
2
2
  import * as _tradetrust_tt_tt_verify from '@tradetrust-tt/tt-verify';
3
- export { isValid, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
3
+ export { createResolver, getIdentifier, isValid, utils, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
4
4
  import { Verifier, VerificationFragment } from '@tradetrust-tt/tt-verify/dist/types/src/types/core';
5
- export { DocumentsToVerify, ErrorVerificationFragment, InvalidVerificationFragment, ProviderDetails, providerType as ProviderType, SkippedVerificationFragment, ValidVerificationFragment, VerificationBuilderOptions, VerificationFragment, VerificationFragmentStatus, VerificationFragmentType, VerifierOptions } from '@tradetrust-tt/tt-verify/dist/types/src/types/core';
5
+ export { DocumentsToVerify, ErrorVerificationFragment, InvalidVerificationFragment, ProviderDetails, providerType as ProviderType, SkippedVerificationFragment, ValidVerificationFragment, VerificationBuilderOptions, VerificationFragment, VerificationFragmentStatus, VerificationFragmentType, Verifier, VerifierOptions } from '@tradetrust-tt/tt-verify/dist/types/src/types/core';
6
6
 
7
7
  declare const verifiers: {
8
8
  documentIntegrity: {
@@ -36,10 +36,22 @@ const w3cVerifiers = [
36
36
  w3cIssuerIdentity.w3cIssuerIdentity
37
37
  ];
38
38
 
39
+ Object.defineProperty(exports, "createResolver", {
40
+ enumerable: true,
41
+ get: function () { return ttVerify.createResolver; }
42
+ });
43
+ Object.defineProperty(exports, "getIdentifier", {
44
+ enumerable: true,
45
+ get: function () { return ttVerify.getIdentifier; }
46
+ });
39
47
  Object.defineProperty(exports, "isValid", {
40
48
  enumerable: true,
41
49
  get: function () { return ttVerify.isValid; }
42
50
  });
51
+ Object.defineProperty(exports, "utils", {
52
+ enumerable: true,
53
+ get: function () { return ttVerify.utils; }
54
+ });
43
55
  Object.defineProperty(exports, "verificationBuilder", {
44
56
  enumerable: true,
45
57
  get: function () { return ttVerify.verificationBuilder; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trustvc/trustvc",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "TrustVC library",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -109,12 +109,12 @@
109
109
  }
110
110
  },
111
111
  "dependencies": {
112
- "@tradetrust-tt/dnsprove": "^2.14.2",
113
- "@tradetrust-tt/token-registry-v4": "npm:@tradetrust-tt/token-registry@^4.14.0",
114
- "@tradetrust-tt/token-registry-v5": "npm:@tradetrust-tt/token-registry@^5.0.2",
112
+ "@tradetrust-tt/dnsprove": "^2.15.0",
113
+ "@tradetrust-tt/token-registry-v4": "npm:@tradetrust-tt/token-registry@^4.15.0",
114
+ "@tradetrust-tt/token-registry-v5": "npm:@tradetrust-tt/token-registry@^5.1.0",
115
115
  "@tradetrust-tt/tradetrust": "^6.9.7",
116
- "@tradetrust-tt/tradetrust-utils": "^2.0.2",
117
- "@tradetrust-tt/tt-verify": "^9.1.0",
116
+ "@tradetrust-tt/tradetrust-utils": "^2.1.1",
117
+ "@tradetrust-tt/tt-verify": "^9.2.0",
118
118
  "@trustvc/w3c-context": "^1.0.0",
119
119
  "@trustvc/w3c-credential-status": "^1.0.0",
120
120
  "@trustvc/w3c-issuer": "^1.0.0",