@trustvc/trustvc 1.0.0-alpha.9 → 1.0.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.
- package/README.md +472 -21
- package/dist/contracts-BsBT1cT2.d.mts +22 -0
- package/dist/contracts-BsBT1cT2.d.ts +22 -0
- package/dist/contracts-Cbud3a4b.d.mts +22 -0
- package/dist/contracts-Cbud3a4b.d.ts +22 -0
- package/dist/core/decrypt.js +2 -2
- package/dist/core/documentBuilder.d.mts +6 -0
- package/dist/core/documentBuilder.d.ts +6 -0
- package/dist/core/documentBuilder.js +13 -0
- package/dist/core/encrypt.js +2 -2
- package/dist/core/index.d.mts +3 -3
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.js +6 -6
- package/dist/core/verify.d.mts +1 -1
- package/dist/core/verify.d.ts +1 -1
- package/dist/core/verify.js +13 -32
- package/dist/dnsprove/index.d.mts +1 -0
- package/dist/dnsprove/index.d.ts +1 -0
- package/dist/dnsprove/index.js +12 -0
- package/dist/esm/core/decrypt.js +1 -1
- package/dist/esm/core/documentBuilder.js +11 -0
- package/dist/esm/core/encrypt.js +1 -1
- package/dist/esm/core/index.js +2 -2
- package/dist/esm/core/verify.js +11 -30
- package/dist/esm/dnsprove/index.js +1 -0
- package/dist/esm/index.js +10 -1
- package/dist/esm/open-attestation/index.js +3 -2
- package/dist/esm/open-attestation/sign.js +10 -5
- package/dist/esm/open-attestation/types.js +1 -1
- package/dist/esm/open-attestation/utils.js +19 -0
- package/dist/esm/open-attestation/verify.js +2 -2
- package/dist/esm/open-attestation/wrap.js +28 -5
- package/dist/esm/token-registry-v4/contracts.js +1 -0
- package/dist/esm/token-registry-v4/index.js +1 -0
- package/dist/esm/token-registry-v4/supportInterfaceIds.js +5 -0
- package/dist/esm/token-registry-v5/contracts.js +1 -0
- package/dist/esm/token-registry-v5/index.js +1 -0
- package/dist/esm/token-registry-v5/supportInterfaceIds.js +5 -0
- package/dist/esm/utils/fragment/index.js +1 -0
- package/dist/esm/utils/index.js +4 -0
- package/dist/esm/utils/network/index.js +1 -0
- package/dist/esm/utils/supportedChains/index.js +1 -0
- package/dist/esm/{core → verify}/fragments/document-status/transferableRecords/transferableRecordVerifier.js +2 -6
- package/dist/esm/{core → verify}/fragments/document-status/transferableRecords/utils.js +2 -2
- package/dist/esm/verify/fragments/index.js +5 -0
- package/dist/esm/verify/index.js +3 -0
- package/dist/esm/verify/verify.js +38 -0
- package/dist/esm/w3c/context/index.js +1 -0
- package/dist/esm/w3c/credential-status/index.js +1 -0
- package/dist/esm/w3c/index.js +9 -1
- package/dist/esm/w3c/issuer/index.js +1 -0
- package/dist/esm/w3c/vc/index.js +1 -0
- package/dist/index-1ws_BWZW.d.mts +22 -0
- package/dist/index-1ws_BWZW.d.ts +22 -0
- package/dist/index-CUw8WpjA.d.mts +22 -0
- package/dist/index-CjwEVGoM.d.mts +22 -0
- package/dist/index-CjwEVGoM.d.ts +22 -0
- package/dist/index-ClF4_Nqk.d.mts +22 -0
- package/dist/index-ClF4_Nqk.d.ts +22 -0
- package/dist/index-DK8Em_TZ.d.ts +22 -0
- package/dist/index-DwAYXQn2.d.mts +22 -0
- package/dist/index-DwAYXQn2.d.ts +22 -0
- package/dist/index.d.mts +40 -8
- package/dist/index.d.ts +40 -8
- package/dist/index.js +70 -14
- package/dist/open-attestation/index.d.mts +10 -3
- package/dist/open-attestation/index.d.ts +10 -3
- package/dist/open-attestation/index.js +15 -8
- package/dist/open-attestation/sign.d.mts +5 -3
- package/dist/open-attestation/sign.d.ts +5 -3
- package/dist/open-attestation/sign.js +10 -5
- package/dist/open-attestation/types.d.mts +2 -1
- package/dist/open-attestation/types.d.ts +2 -1
- package/dist/open-attestation/types.js +0 -16
- package/dist/open-attestation/utils.d.mts +41 -0
- package/dist/open-attestation/utils.d.ts +41 -0
- package/dist/open-attestation/utils.js +55 -0
- package/dist/open-attestation/verify.d.mts +2 -2
- package/dist/open-attestation/verify.d.ts +2 -2
- package/dist/open-attestation/verify.js +3 -3
- package/dist/open-attestation/wrap.d.mts +7 -3
- package/dist/open-attestation/wrap.d.ts +7 -3
- package/dist/open-attestation/wrap.js +39 -6
- package/dist/token-registry-v4/contracts.d.mts +1 -0
- package/dist/token-registry-v4/contracts.d.ts +1 -0
- package/dist/token-registry-v4/contracts.js +12 -0
- package/dist/token-registry-v4/index.d.mts +1 -0
- package/dist/token-registry-v4/index.d.ts +1 -0
- package/dist/token-registry-v4/index.js +12 -0
- package/dist/token-registry-v4/supportInterfaceIds.d.mts +12 -0
- package/dist/token-registry-v4/supportInterfaceIds.d.ts +12 -0
- package/dist/token-registry-v4/supportInterfaceIds.js +7 -0
- package/dist/token-registry-v5/contracts.d.mts +1 -0
- package/dist/token-registry-v5/contracts.d.ts +1 -0
- package/dist/token-registry-v5/contracts.js +12 -0
- package/dist/token-registry-v5/index.d.mts +1 -0
- package/dist/token-registry-v5/index.d.ts +1 -0
- package/dist/token-registry-v5/index.js +12 -0
- package/dist/token-registry-v5/supportInterfaceIds.d.mts +12 -0
- package/dist/token-registry-v5/supportInterfaceIds.d.ts +12 -0
- package/dist/token-registry-v5/supportInterfaceIds.js +7 -0
- package/dist/utils/fragment/index.d.mts +1 -0
- package/dist/utils/fragment/index.d.ts +1 -0
- package/dist/utils/fragment/index.js +14 -0
- package/dist/utils/index.d.mts +4 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +33 -0
- package/dist/utils/network/index.d.mts +1 -0
- package/dist/utils/network/index.d.ts +1 -0
- package/dist/utils/network/index.js +12 -0
- package/dist/utils/{stringUtils.d.ts → stringUtils/index.d.mts} +4 -0
- package/dist/utils/{stringUtils.d.mts → stringUtils/index.d.ts} +4 -0
- package/dist/utils/supportedChains/index.d.mts +1 -0
- package/dist/utils/supportedChains/index.d.ts +1 -0
- package/dist/utils/supportedChains/index.js +12 -0
- package/dist/{core → verify}/fragments/document-integrity/w3cSignatureIntegrity.d.mts +1 -1
- package/dist/{core → verify}/fragments/document-integrity/w3cSignatureIntegrity.d.ts +1 -1
- package/dist/{core → verify}/fragments/document-status/transferableRecords/transferableRecordVerifier.d.mts +1 -1
- package/dist/{core → verify}/fragments/document-status/transferableRecords/transferableRecordVerifier.d.ts +1 -1
- package/dist/{core → verify}/fragments/document-status/transferableRecords/transferableRecordVerifier.js +14 -18
- package/dist/{core → verify}/fragments/document-status/transferableRecords/transferableRecordVerifier.types.d.mts +1 -1
- package/dist/{core → verify}/fragments/document-status/transferableRecords/transferableRecordVerifier.types.d.ts +1 -1
- package/dist/{core → verify}/fragments/document-status/transferableRecords/utils.d.mts +1 -1
- package/dist/{core → verify}/fragments/document-status/transferableRecords/utils.d.ts +1 -1
- package/dist/{core → verify}/fragments/document-status/transferableRecords/utils.js +9 -9
- package/dist/{core → verify}/fragments/document-status/w3cCredentialStatus.d.mts +1 -1
- package/dist/{core → verify}/fragments/document-status/w3cCredentialStatus.d.ts +1 -1
- package/dist/verify/fragments/index.d.mts +6 -0
- package/dist/verify/fragments/index.d.ts +6 -0
- package/dist/verify/fragments/index.js +54 -0
- package/dist/{core → verify}/fragments/issuer-identity/w3cIssuerIdentity.d.mts +1 -1
- package/dist/{core → verify}/fragments/issuer-identity/w3cIssuerIdentity.d.ts +1 -1
- package/dist/verify/index.d.mts +9 -0
- package/dist/verify/index.d.ts +9 -0
- package/dist/verify/index.js +34 -0
- package/dist/verify/verify.d.mts +29 -0
- package/dist/verify/verify.d.ts +29 -0
- package/dist/verify/verify.js +53 -0
- package/dist/w3c/context/index.d.mts +1 -0
- package/dist/w3c/context/index.d.ts +1 -0
- package/dist/w3c/context/index.js +12 -0
- package/dist/w3c/credential-status/index.d.mts +1 -0
- package/dist/w3c/credential-status/index.d.ts +1 -0
- package/dist/w3c/credential-status/index.js +12 -0
- package/dist/w3c/index.d.mts +7 -1
- package/dist/w3c/index.d.ts +7 -1
- package/dist/w3c/index.js +46 -15
- package/dist/w3c/issuer/index.d.mts +1 -0
- package/dist/w3c/issuer/index.d.ts +1 -0
- package/dist/w3c/issuer/index.js +12 -0
- package/dist/w3c/types.d.mts +6 -0
- package/dist/w3c/types.d.ts +6 -0
- package/dist/w3c/vc/index.d.mts +1 -0
- package/dist/w3c/vc/index.d.ts +1 -0
- package/dist/w3c/vc/index.js +12 -0
- package/package.json +100 -10
- /package/dist/{config.d.mts → constants.d.mts} +0 -0
- /package/dist/{config.d.ts → constants.d.ts} +0 -0
- /package/dist/{config.js → constants.js} +0 -0
- /package/dist/esm/{config.js → constants.js} +0 -0
- /package/dist/esm/utils/{stringUtils.js → stringUtils/index.js} +0 -0
- /package/dist/esm/{core → verify}/fragments/document-integrity/w3cSignatureIntegrity.js +0 -0
- /package/dist/esm/{core → verify}/fragments/document-status/transferableRecords/transferableRecordVerifier.types.js +0 -0
- /package/dist/esm/{core → verify}/fragments/document-status/w3cCredentialStatus.js +0 -0
- /package/dist/esm/{core → verify}/fragments/issuer-identity/w3cIssuerIdentity.js +0 -0
- /package/dist/utils/{stringUtils.js → stringUtils/index.js} +0 -0
- /package/dist/{core → verify}/fragments/document-integrity/w3cSignatureIntegrity.js +0 -0
- /package/dist/{core → verify}/fragments/document-status/transferableRecords/transferableRecordVerifier.types.js +0 -0
- /package/dist/{core → verify}/fragments/document-status/w3cCredentialStatus.js +0 -0
- /package/dist/{core → verify}/fragments/issuer-identity/w3cIssuerIdentity.js +0 -0
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
|
-
|
|
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
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
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
|
-
|
|
194
|
+
---
|
|
89
195
|
|
|
90
|
-
|
|
196
|
+
### 3. **Verifying**
|
|
91
197
|
|
|
92
|
-
|
|
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
|
-
|
|
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
|
-
|
|
136
|
-
|
|
137
|
-
|
|
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)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as contracts$1 from '@tradetrust-tt/token-registry-v4/contracts';
|
|
2
|
+
|
|
3
|
+
function _mergeNamespaces(n, m) {
|
|
4
|
+
m.forEach(function (e) {
|
|
5
|
+
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
6
|
+
if (k !== 'default' && !(k in n)) {
|
|
7
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
8
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return e[k]; }
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
return Object.freeze(n);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
var contracts = /*#__PURE__*/_mergeNamespaces({
|
|
19
|
+
__proto__: null
|
|
20
|
+
}, [contracts$1]);
|
|
21
|
+
|
|
22
|
+
export { contracts as c };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as contracts$1 from '@tradetrust-tt/token-registry-v4/contracts';
|
|
2
|
+
|
|
3
|
+
function _mergeNamespaces(n, m) {
|
|
4
|
+
m.forEach(function (e) {
|
|
5
|
+
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
6
|
+
if (k !== 'default' && !(k in n)) {
|
|
7
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
8
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return e[k]; }
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
return Object.freeze(n);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
var contracts = /*#__PURE__*/_mergeNamespaces({
|
|
19
|
+
__proto__: null
|
|
20
|
+
}, [contracts$1]);
|
|
21
|
+
|
|
22
|
+
export { contracts as c };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as contracts$1 from '@tradetrust-tt/token-registry-v5/contracts';
|
|
2
|
+
|
|
3
|
+
function _mergeNamespaces(n, m) {
|
|
4
|
+
m.forEach(function (e) {
|
|
5
|
+
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
6
|
+
if (k !== 'default' && !(k in n)) {
|
|
7
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
8
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return e[k]; }
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
return Object.freeze(n);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
var contracts = /*#__PURE__*/_mergeNamespaces({
|
|
19
|
+
__proto__: null
|
|
20
|
+
}, [contracts$1]);
|
|
21
|
+
|
|
22
|
+
export { contracts as c };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as contracts$1 from '@tradetrust-tt/token-registry-v5/contracts';
|
|
2
|
+
|
|
3
|
+
function _mergeNamespaces(n, m) {
|
|
4
|
+
m.forEach(function (e) {
|
|
5
|
+
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
6
|
+
if (k !== 'default' && !(k in n)) {
|
|
7
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
8
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return e[k]; }
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
return Object.freeze(n);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
var contracts = /*#__PURE__*/_mergeNamespaces({
|
|
19
|
+
__proto__: null
|
|
20
|
+
}, [contracts$1]);
|
|
21
|
+
|
|
22
|
+
export { contracts as c };
|
package/dist/core/decrypt.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var constants = require('../constants');
|
|
4
4
|
var stringUtils = require('../utils/stringUtils');
|
|
5
5
|
var tsChacha20 = require('ts-chacha20');
|
|
6
6
|
|
|
7
7
|
var __defProp = Object.defineProperty;
|
|
8
8
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
9
|
function decrypt(encryptedMessage, key, nonce) {
|
|
10
|
-
key = key.length > 0 ? key :
|
|
10
|
+
key = key.length > 0 ? key : constants.DEFAULT_KEY;
|
|
11
11
|
key = stringUtils.generate32ByteKey(key);
|
|
12
12
|
nonce = stringUtils.generate12ByteNonce(nonce ?? "");
|
|
13
13
|
const keyBuffer = stringUtils.stringToUint8Array(key);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
const _DocumentBuilder = class _DocumentBuilder {
|
|
6
|
+
constructor() {
|
|
7
|
+
this.document = new _DocumentBuilder();
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
__name(_DocumentBuilder, "DocumentBuilder");
|
|
11
|
+
let DocumentBuilder = _DocumentBuilder;
|
|
12
|
+
|
|
13
|
+
exports.DocumentBuilder = DocumentBuilder;
|