@trustvc/trustvc 1.6.0-alpha.4 → 1.6.0-alpha.6
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 +109 -22
- package/dist/cjs/core/documentBuilder.js +2 -2
- package/dist/cjs/open-attestation/utils.js +0 -2
- package/dist/cjs/token-registry-functions/returnToken.js +1 -1
- package/dist/cjs/utils/documents/index.js +27 -0
- package/dist/cjs/utils/errorMessages/index.js +8 -4
- package/dist/cjs/utils/errorMessages/types.js +2 -0
- package/dist/cjs/verify/fragments/document-integrity/ecdsaW3CSignatureIntegrity.js +87 -0
- package/dist/cjs/verify/fragments/index.js +5 -0
- package/dist/cjs/verify/verify.js +2 -0
- package/dist/cjs/w3c/derive.js +11 -0
- package/dist/cjs/w3c/index.js +7 -0
- package/dist/cjs/w3c/sign.js +2 -2
- package/dist/esm/core/documentBuilder.js +1 -1
- package/dist/esm/open-attestation/utils.js +1 -2
- package/dist/esm/token-registry-functions/returnToken.js +1 -1
- package/dist/esm/utils/documents/index.js +26 -1
- package/dist/esm/utils/errorMessages/index.js +6 -1
- package/dist/esm/utils/errorMessages/types.js +1 -0
- package/dist/esm/verify/fragments/document-integrity/ecdsaW3CSignatureIntegrity.js +85 -0
- package/dist/esm/verify/fragments/index.js +1 -0
- package/dist/esm/verify/verify.js +2 -0
- package/dist/esm/w3c/derive.js +9 -0
- package/dist/esm/w3c/index.js +1 -0
- package/dist/esm/w3c/sign.js +2 -2
- package/dist/types/core/documentBuilder.d.ts +2 -2
- package/dist/types/{index-CRVFHzes.d.ts → index-LpXMEhhr.d.ts} +3 -1
- package/dist/types/index.d.ts +8 -4
- package/dist/types/open-attestation/index.d.ts +1 -1
- package/dist/types/open-attestation/utils.d.ts +1 -2
- package/dist/types/utils/documents/index.d.ts +3 -1
- package/dist/types/utils/errorMessages/index.d.ts +6 -1
- package/dist/types/utils/errorMessages/types.d.ts +20 -0
- package/dist/types/utils/index.d.ts +4 -2
- package/dist/types/verify/fragments/document-integrity/ecdsaW3CSignatureIntegrity.d.ts +5 -0
- package/dist/types/verify/fragments/index.d.ts +1 -0
- package/dist/types/verify/index.d.ts +2 -1
- package/dist/types/w3c/derive.d.ts +11 -0
- package/dist/types/w3c/index.d.ts +1 -0
- package/dist/types/w3c/sign.d.ts +7 -3
- package/package.json +11 -10
package/README.md
CHANGED
|
@@ -16,15 +16,16 @@ TrustVC is a comprehensive wrapper library designed to simplify the signing and
|
|
|
16
16
|
- [2. **Signing**](#2-signing)
|
|
17
17
|
- [a) OpenAttestation Signing (signOA) v2 v3](#a-openattestation-signing-signoa-v2-v3)
|
|
18
18
|
- [b) TrustVC W3C Signing (signW3C)](#b-trustvc-w3c-signing-signw3c)
|
|
19
|
-
- [3. **
|
|
20
|
-
- [4. **
|
|
21
|
-
- [5. **
|
|
22
|
-
- [6. **
|
|
19
|
+
- [3. **Deriving (Selective Disclosure)**](#3-deriving-selective-disclosure)
|
|
20
|
+
- [4. **Verifying**](#4-verifying)
|
|
21
|
+
- [5. **Encryption**](#5-encryption)
|
|
22
|
+
- [6. **Decryption**](#6-decryption)
|
|
23
|
+
- [7. **TradeTrust Token Registry**](#7-tradetrust-token-registry)
|
|
23
24
|
- [Usage](#usage-2)
|
|
24
25
|
- [TradeTrustToken](#tradetrusttoken)
|
|
25
26
|
- [a) Token Registry v4](#a-token-registry-v4)
|
|
26
27
|
- [b) Token Registry V5](#b-token-registry-v5)
|
|
27
|
-
- [
|
|
28
|
+
- [8. **Document Builder**](#8-document-builder)
|
|
28
29
|
|
|
29
30
|
## Installation
|
|
30
31
|
|
|
@@ -154,15 +155,17 @@ const signedWrappedDocument = await signOA(wrappedDocument, {
|
|
|
154
155
|
|
|
155
156
|
#### b) TrustVC W3C Signing (signW3C)
|
|
156
157
|
|
|
158
|
+
The `signW3C` function signs W3C Verifiable Credentials using the provided cryptographic suite and key pair. By default, it uses the **ecdsa-sd-2023** crypto suite unless otherwise specified.
|
|
159
|
+
|
|
157
160
|
```ts
|
|
158
161
|
import { signW3C, VerificationType } from '@trustvc/trustvc';
|
|
159
162
|
|
|
160
163
|
const rawDocument = {
|
|
161
164
|
'@context': [
|
|
162
|
-
'https://www.w3.org/
|
|
163
|
-
'https://
|
|
164
|
-
'https://w3id.org/security/bbs/v1',
|
|
165
|
+
'https://www.w3.org/ns/credentials/v2',
|
|
166
|
+
'https://w3id.org/security/data-integrity/v2',
|
|
165
167
|
'https://w3id.org/vc/status-list/2021/v1',
|
|
168
|
+
'https://w3c-ccg.github.io/citizenship-vocab/contexts/citizenship-v2.jsonld',
|
|
166
169
|
],
|
|
167
170
|
credentialStatus: {
|
|
168
171
|
id: 'https://trustvc.github.io/did/credentials/statuslist/1#1',
|
|
@@ -172,29 +175,113 @@ const rawDocument = {
|
|
|
172
175
|
statusListCredential: 'https://trustvc.github.io/did/credentials/statuslist/1',
|
|
173
176
|
},
|
|
174
177
|
credentialSubject: {
|
|
175
|
-
|
|
178
|
+
type: ['Person']
|
|
179
|
+
givenName: 'TrustVC',
|
|
176
180
|
birthDate: '2024-04-01T12:19:52Z',
|
|
177
|
-
type: ['PermanentResident', 'Person'],
|
|
178
181
|
},
|
|
179
|
-
expirationDate: '2029-12-03T12:19:52Z',
|
|
180
182
|
issuer: 'did:web:trustvc.github.io:did:1',
|
|
181
183
|
type: ['VerifiableCredential'],
|
|
182
|
-
|
|
184
|
+
validFrom: '2024-04-01T12:19:52Z',
|
|
185
|
+
validUntil: '2029-12-03T12:19:52Z'
|
|
183
186
|
};
|
|
184
187
|
|
|
188
|
+
// Using default ecdsa-sd-2023 crypto suite
|
|
185
189
|
const signingResult = await signW3C(rawDocument, {
|
|
186
|
-
|
|
190
|
+
'@context': 'https://w3id.org/security/multikey/v1',
|
|
191
|
+
id: 'did:web:trustvc.github.io:did:1#multikey-1',
|
|
192
|
+
type: VerificationType.Multikey,
|
|
187
193
|
controller: 'did:web:trustvc.github.io:did:1',
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
'oRfEeWFresvhRtXCkihZbxyoi2JER7gHTJ5psXhHsdCoU1MttRMi3Yp9b9fpjmKh7bMgfWKLESiK2YovRd8KGzJsGuamoAXfqDDVhckxuc9nmsJ84skCSTijKeU4pfAcxeJ',
|
|
191
|
-
privateKeyBase58: '<privateKeyBase58>',
|
|
194
|
+
publicKeyMultibase: 'zDnaemDNwi4G5eTzGfRooFFu5Kns3be6yfyVNtiaMhWkZbwtc',
|
|
195
|
+
secretKeyMultibase: '<secretKeyMultibase>'
|
|
192
196
|
});
|
|
197
|
+
|
|
198
|
+
// You can also specify mandatory pointers for selective disclosure with ecdsa-sd-2023
|
|
199
|
+
const signingResultWithPointers = await signW3C(
|
|
200
|
+
rawDocument,
|
|
201
|
+
{
|
|
202
|
+
'@context': 'https://w3id.org/security/multikey/v1',
|
|
203
|
+
id: 'did:web:trustvc.github.io:did:1#multikey-1',
|
|
204
|
+
type: VerificationType.Multikey,
|
|
205
|
+
controller: 'did:web:trustvc.github.io:did:1',
|
|
206
|
+
publicKeyMultibase: 'zDnaemDNwi4G5eTzGfRooFFu5Kns3be6yfyVNtiaMhWkZbwtc',
|
|
207
|
+
secretKeyMultibase: '<secretKeyMultibase>'
|
|
208
|
+
},
|
|
209
|
+
'ecdsa-sd-2023',
|
|
210
|
+
{
|
|
211
|
+
mandatoryPointers: ['/credentialStatus']
|
|
212
|
+
}
|
|
213
|
+
);
|
|
214
|
+
|
|
215
|
+
// Alternatively, specify a different crypto suite. Ensure the context is updated to include the crypto suite.
|
|
216
|
+
const signingResultWithBbs = await signW3C(
|
|
217
|
+
rawDocument,
|
|
218
|
+
{
|
|
219
|
+
id: 'did:web:trustvc.github.io:did:1#keys-1',
|
|
220
|
+
controller: 'did:web:trustvc.github.io:did:1',
|
|
221
|
+
type: VerificationType.Bls12381G2Key2020,
|
|
222
|
+
publicKeyBase58: 'oRfEeWFresvhRtXCkihZbxyoi2JER7gHTJ5psXhHsdCoU1MttRMi3Yp9b9fpjmKh7bMgfWKLESiK2YovRd8KGzJsGuamoAXfqDDVhckxuc9nmsJ84skCSTijKeU4pfAcxeJ',
|
|
223
|
+
privateKeyBase58: '<privateKeyBase58>',
|
|
224
|
+
},
|
|
225
|
+
'BbsBlsSignature2020'
|
|
226
|
+
);
|
|
227
|
+
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
### 3. **Deriving (Selective Disclosure)**
|
|
233
|
+
|
|
234
|
+
> When using ECDSA-SD-2023 crypto suite, we can derive a new credential with selective disclosure. This means you can choose which parts of the credential to reveal while keeping others hidden.
|
|
235
|
+
|
|
236
|
+
```ts
|
|
237
|
+
import { deriveW3C } from '@trustvc/trustvc';
|
|
238
|
+
|
|
239
|
+
// This is a signed document using ecdsa-sd-2023
|
|
240
|
+
const signedDocument = {
|
|
241
|
+
'@context': [
|
|
242
|
+
'https://www.w3.org/ns/credentials/v2',
|
|
243
|
+
'https://w3id.org/security/data-integrity/v2',
|
|
244
|
+
'https://w3id.org/vc/status-list/2021/v1',
|
|
245
|
+
'https://w3c-ccg.github.io/citizenship-vocab/contexts/citizenship-v2.jsonld'
|
|
246
|
+
],
|
|
247
|
+
credentialStatus: {
|
|
248
|
+
id: 'https://trustvc.github.io/did/credentials/statuslist/1#1',
|
|
249
|
+
type: 'StatusList2021Entry',
|
|
250
|
+
statusPurpose: 'revocation',
|
|
251
|
+
statusListIndex: '10',
|
|
252
|
+
statusListCredential: 'https://trustvc.github.io/did/credentials/statuslist/1'
|
|
253
|
+
},
|
|
254
|
+
credentialSubject: {
|
|
255
|
+
type: ['Person'],
|
|
256
|
+
givenName: 'TrustVC',
|
|
257
|
+
birthDate: '2024-04-01T12:19:52Z'
|
|
258
|
+
},
|
|
259
|
+
issuer: 'did:web:trustvc.github.io:did:1',
|
|
260
|
+
type: ['VerifiableCredential'],
|
|
261
|
+
validFrom: '2024-04-01T12:19:52Z',
|
|
262
|
+
validUntil: '2029-12-03T12:19:52Z',
|
|
263
|
+
id: 'urn:uuid:0198bd9e-6686-7ccd-9b2a-ce763ae710d7',
|
|
264
|
+
proof: {
|
|
265
|
+
type: 'DataIntegrityProof',
|
|
266
|
+
created: '2025-08-18T14:38:51Z',
|
|
267
|
+
verificationMethod: 'did:web:trustvc.github.io:did:1#multikey-1',
|
|
268
|
+
cryptosuite: 'ecdsa-sd-2023',
|
|
269
|
+
proofPurpose: 'assertionMethod',
|
|
270
|
+
proofValue: 'u2V0AhVhAxfLFkbv8J_O3zJAQrSWrEY3sgeMwN02b2eaHEgjnJYu1rnCBYORfZUVZwRoRuNIiY1NTGHmQpzlgqtQz7A0R3FgjgCQDzt3_aUvSMrlIZdsyVcB4KPHHjA4BbSv-PZ4Bbm4GpY5YIA1mQ8LYmpjJ7vNvN3DsfIengZrnziTLO9exbZjn1KqFilhA0lp1y6BZ-fhiUdWsojYesLDSzCy6Tq_AICaIvCjYSJMEaY7SomJnCkdpuhM0GQHDTy5kjzb7sSzowACqDDf9OVhAfOC7vg4WQGrI6M3dvLZW3KlBzp1SurRz1PPeHcqOGEDrqybzIlolwNXMhc2T8rcVLl-E04wNsiVjamvqWAQN-lhA4HmVqIxKuR0QvCMEVq3cjUU7G1pQbgMdp9HZDasOT9nh_k5l3JfcXB1_qtRblljXWN0FRKAr9T-DhxzDzGl3-lhA4nNDzd-6xl74rWqr_7U9XZE7LoE-mbgBsyOAOlfHGumMxwddnEZp2iD2uZ7lLXX8Q-nSDXJVvUqKLksy1l2vqVhAm3daNYjH1kVrTW7V-DElcj3K_QfbHEvjd1F2TGVGtBVhF8o01yCxXRX0vzk-AZLZnpDnAUBTSTF5Q8rF-t7L9lhAO7NeIXQtQsdncqtLm2qk1XzFYL2FM5Hx4GZOX39VyT4T0AlFRZQuY9WXYnvMZSvacRvJaSJk5S3cZ6uBminQgVhAExuTEvJQu42-SiaOJ_6M0EjuQfqIgJE-JHirmYs3AAoH_4EKUtPU3y_jRB8XFZxA-wtFDv3KJjqXtNo5aA_6f1hAaokZPSJghFufTaVR8LAwHpXOncGJblKpUZQjKWuA_o2s6tGmx-ja0wgpsqSxvAGMTtkhFTMOI2-tzUuGE05tk1hAzABtV2yEX-RAQFpxkuV0XydAsJDh2dPscrpPHqMfmORsC3xRNL73uDaqqlaL99CvOgq4kJWmChw7TUYO62yaSVhA5-F-snwj-OZtws7_qMwvBgeNK9wvkZTlFLjRV6GDYx6r5TaLkR05GVzyBMv0Qs2z-cXPRZByS7p7_hbeykoYSYJnL2lzc3VlcmovdmFsaWRGcm9t'
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
// Derive a new credential with only specific fields disclosed
|
|
275
|
+
const derivationResult = await deriveW3C(signedDocument, {
|
|
276
|
+
// Only reveal the credential type and givenName, hide birthDate
|
|
277
|
+
selectivePointers: ['/type', '/credentialSubject/givenName']
|
|
278
|
+
});
|
|
279
|
+
|
|
193
280
|
```
|
|
194
281
|
|
|
195
282
|
---
|
|
196
283
|
|
|
197
|
-
###
|
|
284
|
+
### 4. **Verifying**
|
|
198
285
|
|
|
199
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.
|
|
200
287
|
|
|
@@ -239,7 +326,7 @@ const resultFragments = await verifyDocument(signedDocument);
|
|
|
239
326
|
|
|
240
327
|
---
|
|
241
328
|
|
|
242
|
-
###
|
|
329
|
+
### 5. **Encryption**
|
|
243
330
|
|
|
244
331
|
> 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.
|
|
245
332
|
|
|
@@ -316,7 +403,7 @@ It also relies on the `ts-chacha20` library for encryption operations.
|
|
|
316
403
|
|
|
317
404
|
---
|
|
318
405
|
|
|
319
|
-
###
|
|
406
|
+
### 6. **Decryption**
|
|
320
407
|
|
|
321
408
|
> 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.
|
|
322
409
|
|
|
@@ -399,7 +486,7 @@ It also relies on the `ts-chacha20` library for decryption operations.
|
|
|
399
486
|
|
|
400
487
|
---
|
|
401
488
|
|
|
402
|
-
###
|
|
489
|
+
### 7. **TradeTrust Token Registry**
|
|
403
490
|
|
|
404
491
|
> 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`).
|
|
405
492
|
> 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.
|
|
@@ -589,7 +676,7 @@ function rejectTransferOwners(bytes calldata _remark) external;
|
|
|
589
676
|
|
|
590
677
|
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)
|
|
591
678
|
|
|
592
|
-
###
|
|
679
|
+
### 8. **Document Builder**
|
|
593
680
|
> The `DocumentBuilder` class helps build and manage W3C Verifiable Credentials (VCs) with credential status features. It supports creating documents with two types of credential statuses: `transferableRecords` and `verifiableDocument`. It can sign the document using a private key, verify its signature, and serialize the document to a JSON format. Additionally, it allows for configuration of document rendering methods and expiration dates.
|
|
594
681
|
|
|
595
682
|
#### Usage
|
|
@@ -8,7 +8,7 @@ var tokenRegistryV4$1 = require('@tradetrust-tt/token-registry-v4');
|
|
|
8
8
|
var tokenRegistryV5$1 = require('@tradetrust-tt/token-registry-v5');
|
|
9
9
|
var tokenRegistryV4 = require('../token-registry-v4');
|
|
10
10
|
var tokenRegistryV5 = require('../token-registry-v5');
|
|
11
|
-
var
|
|
11
|
+
var utils = require('../utils');
|
|
12
12
|
|
|
13
13
|
var __defProp = Object.defineProperty;
|
|
14
14
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
@@ -181,7 +181,7 @@ class DocumentBuilder {
|
|
|
181
181
|
// Private helper method to verify that the token registry supports the required interface for transferable records.
|
|
182
182
|
async verifyTokenRegistry() {
|
|
183
183
|
const chainId = this.document.credentialStatus.tokenNetwork.chainId;
|
|
184
|
-
if (!(chainId in
|
|
184
|
+
if (!(chainId in utils.SUPPORTED_CHAINS)) {
|
|
185
185
|
throw new Error(`Unsupported Chain: Chain ID ${chainId} is not supported.`);
|
|
186
186
|
}
|
|
187
187
|
try {
|
|
@@ -12,7 +12,6 @@ const {
|
|
|
12
12
|
isSignedWrappedV3Document,
|
|
13
13
|
isRawV2Document,
|
|
14
14
|
isRawV3Document,
|
|
15
|
-
isObfuscated,
|
|
16
15
|
getDocumentData,
|
|
17
16
|
getIssuerAddress,
|
|
18
17
|
diagnose,
|
|
@@ -49,7 +48,6 @@ exports.getDocumentData = getDocumentData;
|
|
|
49
48
|
exports.getIssuerAddress = getIssuerAddress;
|
|
50
49
|
exports.getTemplateURL = getTemplateURL;
|
|
51
50
|
exports.isDocumentRevokable = isDocumentRevokable;
|
|
52
|
-
exports.isObfuscated = isObfuscated;
|
|
53
51
|
exports.isRawV2Document = isRawV2Document;
|
|
54
52
|
exports.isRawV3Document = isRawV3Document;
|
|
55
53
|
exports.isSignedWrappedV2Document = isSignedWrappedV2Document;
|
|
@@ -187,7 +187,7 @@ const acceptReturned = /* @__PURE__ */ __name(async (contractOptions, signer, pa
|
|
|
187
187
|
const encryptedRemarks = remarks && isV5TT ? `0x${core.encrypt(remarks, options.id)}` : "0x";
|
|
188
188
|
try {
|
|
189
189
|
const isV6 = ethers.isV6EthersProvider(signer.provider);
|
|
190
|
-
const args = isV5TT ? [encryptedRemarks] : [];
|
|
190
|
+
const args = isV5TT ? [tokenId, encryptedRemarks] : [tokenId];
|
|
191
191
|
if (isV6) {
|
|
192
192
|
await tradeTrustTokenContract.burn.staticCall(...args);
|
|
193
193
|
} else {
|
|
@@ -73,9 +73,36 @@ const getChainId = /* @__PURE__ */ __name((document) => {
|
|
|
73
73
|
return void 0;
|
|
74
74
|
}
|
|
75
75
|
}, "getChainId");
|
|
76
|
+
const isObfuscated = /* @__PURE__ */ __name((document) => {
|
|
77
|
+
if (openAttestation.isWrappedV3Document(document)) {
|
|
78
|
+
return !!document.proof.privacy?.obfuscated?.length;
|
|
79
|
+
}
|
|
80
|
+
if (openAttestation.isWrappedV2Document(document)) {
|
|
81
|
+
return !!document.privacy?.obfuscatedData?.length;
|
|
82
|
+
}
|
|
83
|
+
if (vc.isSignedDocument(document)) {
|
|
84
|
+
return document.proof?.type === "BbsBlsSignatureProof2020";
|
|
85
|
+
}
|
|
86
|
+
throw new Error(
|
|
87
|
+
"Unsupported document type: Can only check if there are obfuscated data from wrapped OpenAttestation v2, v3 documents and signed verifiable credentials."
|
|
88
|
+
);
|
|
89
|
+
}, "isObfuscated");
|
|
90
|
+
const getObfuscatedData = /* @__PURE__ */ __name((document) => {
|
|
91
|
+
if (openAttestation.isWrappedV3Document(document)) {
|
|
92
|
+
return document.proof.privacy?.obfuscated;
|
|
93
|
+
}
|
|
94
|
+
if (openAttestation.isWrappedV2Document(document)) {
|
|
95
|
+
return document.privacy?.obfuscatedData || [];
|
|
96
|
+
}
|
|
97
|
+
throw new Error(
|
|
98
|
+
"Unsupported document type: Can only retrieve obfuscated data from wrapped OpenAttestation v2 & v3 documents."
|
|
99
|
+
);
|
|
100
|
+
}, "getObfuscatedData");
|
|
76
101
|
|
|
77
102
|
exports.getChainId = getChainId;
|
|
103
|
+
exports.getObfuscatedData = getObfuscatedData;
|
|
78
104
|
exports.getTokenId = getTokenId;
|
|
79
105
|
exports.getTokenRegistryAddress = getTokenRegistryAddress;
|
|
80
106
|
exports.getTransferableRecordsCredentialStatus = getTransferableRecordsCredentialStatus;
|
|
107
|
+
exports.isObfuscated = isObfuscated;
|
|
81
108
|
exports.isTransferableRecord = isTransferableRecord;
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var tradetrustUtils = require('@tradetrust-tt/tradetrust-utils');
|
|
4
|
+
var types = require('./types');
|
|
4
5
|
|
|
6
|
+
const errorMessages = tradetrustUtils.CONSTANTS;
|
|
5
7
|
|
|
6
|
-
|
|
7
|
-
Object.
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
exports.errorMessages = errorMessages;
|
|
9
|
+
Object.keys(types).forEach(function (k) {
|
|
10
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () { return types[k]; }
|
|
13
|
+
});
|
|
10
14
|
});
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var __ = require('../../..');
|
|
4
|
+
var w3cVc = require('@trustvc/w3c-vc');
|
|
5
|
+
|
|
6
|
+
var __defProp = Object.defineProperty;
|
|
7
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
const PROOF_TYPE = "DataIntegrityProof";
|
|
9
|
+
const CRYPTOSUITE = "ecdsa-sd-2023";
|
|
10
|
+
const DERIVE_CREDENTIAL_ERROR = "Use deriveCredential() first";
|
|
11
|
+
function isSignedVerifiableCredential(document) {
|
|
12
|
+
return typeof document === "object" && document !== null && "proof" in document;
|
|
13
|
+
}
|
|
14
|
+
__name(isSignedVerifiableCredential, "isSignedVerifiableCredential");
|
|
15
|
+
const ecdsaW3CSignatureIntegrity = {
|
|
16
|
+
skip: /* @__PURE__ */ __name(async () => {
|
|
17
|
+
return {
|
|
18
|
+
type: "DOCUMENT_INTEGRITY",
|
|
19
|
+
name: "EcdsaW3CSignatureIntegrity",
|
|
20
|
+
reason: {
|
|
21
|
+
code: 0,
|
|
22
|
+
codeString: "SKIPPED",
|
|
23
|
+
message: `Document either has no proof or proof type is not '${PROOF_TYPE}' or proof cryptosuite is not '${CRYPTOSUITE}'.`
|
|
24
|
+
},
|
|
25
|
+
status: "SKIPPED"
|
|
26
|
+
};
|
|
27
|
+
}, "skip"),
|
|
28
|
+
test: /* @__PURE__ */ __name((document) => {
|
|
29
|
+
const doc = document;
|
|
30
|
+
return doc.proof?.type === "DataIntegrityProof" && doc.proof?.cryptosuite === "ecdsa-sd-2023";
|
|
31
|
+
}, "test"),
|
|
32
|
+
verify: /* @__PURE__ */ __name(async (document, verifierOptions) => {
|
|
33
|
+
if (!isSignedVerifiableCredential(document)) {
|
|
34
|
+
return {
|
|
35
|
+
type: "DOCUMENT_INTEGRITY",
|
|
36
|
+
name: "EcdsaW3CSignatureIntegrity",
|
|
37
|
+
data: false,
|
|
38
|
+
reason: {
|
|
39
|
+
message: "Document is not a valid SignedVerifiableCredential"
|
|
40
|
+
},
|
|
41
|
+
status: "INVALID"
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
try {
|
|
45
|
+
let verificationResult = await __.verifyW3CSignature(document, verifierOptions);
|
|
46
|
+
let isDerived = true;
|
|
47
|
+
if (!verificationResult.verified && verificationResult.error?.includes(DERIVE_CREDENTIAL_ERROR)) {
|
|
48
|
+
const derivedCredential = await w3cVc.deriveCredential(document, []);
|
|
49
|
+
verificationResult = await __.verifyW3CSignature(derivedCredential.derived, verifierOptions);
|
|
50
|
+
isDerived = false;
|
|
51
|
+
}
|
|
52
|
+
if (verificationResult.verified) {
|
|
53
|
+
return {
|
|
54
|
+
type: "DOCUMENT_INTEGRITY",
|
|
55
|
+
name: "EcdsaW3CSignatureIntegrity",
|
|
56
|
+
data: true,
|
|
57
|
+
reason: {
|
|
58
|
+
message: isDerived ? "Document verified successfully" : "Document verified after derivation"
|
|
59
|
+
},
|
|
60
|
+
status: "VALID"
|
|
61
|
+
};
|
|
62
|
+
} else {
|
|
63
|
+
return {
|
|
64
|
+
type: "DOCUMENT_INTEGRITY",
|
|
65
|
+
name: "EcdsaW3CSignatureIntegrity",
|
|
66
|
+
data: false,
|
|
67
|
+
reason: {
|
|
68
|
+
message: verificationResult.error || "Verification failed"
|
|
69
|
+
},
|
|
70
|
+
status: "INVALID"
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
} catch (error) {
|
|
74
|
+
return {
|
|
75
|
+
type: "DOCUMENT_INTEGRITY",
|
|
76
|
+
name: "EcdsaW3CSignatureIntegrity",
|
|
77
|
+
data: false,
|
|
78
|
+
reason: {
|
|
79
|
+
message: error instanceof Error ? error.message : "Unknown verification error"
|
|
80
|
+
},
|
|
81
|
+
status: "INVALID"
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
}, "verify")
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
exports.ecdsaW3CSignatureIntegrity = ecdsaW3CSignatureIntegrity;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var ttVerify = require('@tradetrust-tt/tt-verify');
|
|
4
4
|
var w3cSignatureIntegrity = require('./document-integrity/w3cSignatureIntegrity');
|
|
5
|
+
var ecdsaW3CSignatureIntegrity = require('./document-integrity/ecdsaW3CSignatureIntegrity');
|
|
5
6
|
var transferableRecordVerifier = require('./document-status/transferableRecords/transferableRecordVerifier');
|
|
6
7
|
var w3cCredentialStatus = require('./document-status/w3cCredentialStatus');
|
|
7
8
|
var w3cIssuerIdentity = require('./issuer-identity/w3cIssuerIdentity');
|
|
@@ -41,6 +42,10 @@ Object.defineProperty(exports, "w3cSignatureIntegrity", {
|
|
|
41
42
|
enumerable: true,
|
|
42
43
|
get: function () { return w3cSignatureIntegrity.w3cSignatureIntegrity; }
|
|
43
44
|
});
|
|
45
|
+
Object.defineProperty(exports, "ecdsaW3CSignatureIntegrity", {
|
|
46
|
+
enumerable: true,
|
|
47
|
+
get: function () { return ecdsaW3CSignatureIntegrity.ecdsaW3CSignatureIntegrity; }
|
|
48
|
+
});
|
|
44
49
|
Object.defineProperty(exports, "TRANSFERABLE_RECORDS_TYPE", {
|
|
45
50
|
enumerable: true,
|
|
46
51
|
get: function () { return transferableRecordVerifier.TRANSFERABLE_RECORDS_TYPE; }
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var ttVerify = require('@tradetrust-tt/tt-verify');
|
|
4
4
|
var w3cSignatureIntegrity = require('./fragments/document-integrity/w3cSignatureIntegrity');
|
|
5
|
+
var ecdsaW3CSignatureIntegrity = require('./fragments/document-integrity/ecdsaW3CSignatureIntegrity');
|
|
5
6
|
var transferableRecordVerifier = require('./fragments/document-status/transferableRecords/transferableRecordVerifier');
|
|
6
7
|
var w3cCredentialStatus = require('./fragments/document-status/w3cCredentialStatus');
|
|
7
8
|
var w3cIssuerIdentity = require('./fragments/issuer-identity/w3cIssuerIdentity');
|
|
@@ -33,6 +34,7 @@ const openAttestationVerifiers = [
|
|
|
33
34
|
];
|
|
34
35
|
const w3cVerifiers = [
|
|
35
36
|
w3cSignatureIntegrity.w3cSignatureIntegrity,
|
|
37
|
+
ecdsaW3CSignatureIntegrity.ecdsaW3CSignatureIntegrity,
|
|
36
38
|
w3cCredentialStatus.w3cCredentialStatus,
|
|
37
39
|
transferableRecordVerifier.credentialStatusTransferableRecordVerifier,
|
|
38
40
|
fragments.w3cEmptyCredentialStatus,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var w3cVc = require('@trustvc/w3c-vc');
|
|
4
|
+
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
const deriveW3C = /* @__PURE__ */ __name(async (credential, revealedAttributes) => {
|
|
8
|
+
return w3cVc.deriveCredential(credential, revealedAttributes);
|
|
9
|
+
}, "deriveW3C");
|
|
10
|
+
|
|
11
|
+
exports.deriveW3C = deriveW3C;
|
package/dist/cjs/w3c/index.js
CHANGED
|
@@ -7,6 +7,7 @@ var sign = require('./sign');
|
|
|
7
7
|
var types = require('./types');
|
|
8
8
|
var vc = require('./vc');
|
|
9
9
|
var verify = require('./verify');
|
|
10
|
+
var derive = require('./derive');
|
|
10
11
|
|
|
11
12
|
function _interopNamespace(e) {
|
|
12
13
|
if (e && e.__esModule) return e;
|
|
@@ -55,3 +56,9 @@ Object.keys(verify).forEach(function (k) {
|
|
|
55
56
|
get: function () { return verify[k]; }
|
|
56
57
|
});
|
|
57
58
|
});
|
|
59
|
+
Object.keys(derive).forEach(function (k) {
|
|
60
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
61
|
+
enumerable: true,
|
|
62
|
+
get: function () { return derive[k]; }
|
|
63
|
+
});
|
|
64
|
+
});
|
package/dist/cjs/w3c/sign.js
CHANGED
|
@@ -4,8 +4,8 @@ var w3cVc = require('@trustvc/w3c-vc');
|
|
|
4
4
|
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
6
6
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
-
const signW3C = /* @__PURE__ */ __name(async (credential, keyPair, cryptoSuite = "
|
|
8
|
-
return w3cVc.signCredential(credential, keyPair, cryptoSuite);
|
|
7
|
+
const signW3C = /* @__PURE__ */ __name(async (credential, keyPair, cryptoSuite = "ecdsa-sd-2023", options) => {
|
|
8
|
+
return w3cVc.signCredential(credential, keyPair, cryptoSuite, options);
|
|
9
9
|
}, "signW3C");
|
|
10
10
|
|
|
11
11
|
exports.signW3C = signW3C;
|
|
@@ -6,7 +6,7 @@ import { constants } from '@tradetrust-tt/token-registry-v4';
|
|
|
6
6
|
import { constants as constants$1 } from '@tradetrust-tt/token-registry-v5';
|
|
7
7
|
import { v4Contracts } from '../token-registry-v4';
|
|
8
8
|
import { v5Contracts } from '../token-registry-v5';
|
|
9
|
-
import { SUPPORTED_CHAINS } from '
|
|
9
|
+
import { SUPPORTED_CHAINS } from '../utils';
|
|
10
10
|
|
|
11
11
|
var __defProp = Object.defineProperty;
|
|
12
12
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
@@ -11,11 +11,10 @@ const {
|
|
|
11
11
|
isSignedWrappedV3Document,
|
|
12
12
|
isRawV2Document,
|
|
13
13
|
isRawV3Document,
|
|
14
|
-
isObfuscated,
|
|
15
14
|
getDocumentData,
|
|
16
15
|
getIssuerAddress,
|
|
17
16
|
diagnose,
|
|
18
17
|
getTemplateURL
|
|
19
18
|
} = utils;
|
|
20
19
|
|
|
21
|
-
export { diagnose, getAssetId, getDocumentData, getIssuerAddress, getTemplateURL, isDocumentRevokable,
|
|
20
|
+
export { diagnose, getAssetId, getDocumentData, getIssuerAddress, getTemplateURL, isDocumentRevokable, isRawV2Document, isRawV3Document, isSignedWrappedV2Document, isSignedWrappedV3Document, isTransferableAsset, isWrappedV2Document, isWrappedV3Document };
|
|
@@ -185,7 +185,7 @@ const acceptReturned = /* @__PURE__ */ __name(async (contractOptions, signer, pa
|
|
|
185
185
|
const encryptedRemarks = remarks && isV5TT ? `0x${encrypt(remarks, options.id)}` : "0x";
|
|
186
186
|
try {
|
|
187
187
|
const isV6 = isV6EthersProvider(signer.provider);
|
|
188
|
-
const args = isV5TT ? [encryptedRemarks] : [];
|
|
188
|
+
const args = isV5TT ? [tokenId, encryptedRemarks] : [tokenId];
|
|
189
189
|
if (isV6) {
|
|
190
190
|
await tradeTrustTokenContract.burn.staticCall(...args);
|
|
191
191
|
} else {
|
|
@@ -71,5 +71,30 @@ const getChainId = /* @__PURE__ */ __name((document) => {
|
|
|
71
71
|
return void 0;
|
|
72
72
|
}
|
|
73
73
|
}, "getChainId");
|
|
74
|
+
const isObfuscated = /* @__PURE__ */ __name((document) => {
|
|
75
|
+
if (isWrappedV3Document(document)) {
|
|
76
|
+
return !!document.proof.privacy?.obfuscated?.length;
|
|
77
|
+
}
|
|
78
|
+
if (isWrappedV2Document(document)) {
|
|
79
|
+
return !!document.privacy?.obfuscatedData?.length;
|
|
80
|
+
}
|
|
81
|
+
if (isSignedDocument(document)) {
|
|
82
|
+
return document.proof?.type === "BbsBlsSignatureProof2020";
|
|
83
|
+
}
|
|
84
|
+
throw new Error(
|
|
85
|
+
"Unsupported document type: Can only check if there are obfuscated data from wrapped OpenAttestation v2, v3 documents and signed verifiable credentials."
|
|
86
|
+
);
|
|
87
|
+
}, "isObfuscated");
|
|
88
|
+
const getObfuscatedData = /* @__PURE__ */ __name((document) => {
|
|
89
|
+
if (isWrappedV3Document(document)) {
|
|
90
|
+
return document.proof.privacy?.obfuscated;
|
|
91
|
+
}
|
|
92
|
+
if (isWrappedV2Document(document)) {
|
|
93
|
+
return document.privacy?.obfuscatedData || [];
|
|
94
|
+
}
|
|
95
|
+
throw new Error(
|
|
96
|
+
"Unsupported document type: Can only retrieve obfuscated data from wrapped OpenAttestation v2 & v3 documents."
|
|
97
|
+
);
|
|
98
|
+
}, "getObfuscatedData");
|
|
74
99
|
|
|
75
|
-
export { getChainId, getTokenId, getTokenRegistryAddress, getTransferableRecordsCredentialStatus, isTransferableRecord };
|
|
100
|
+
export { getChainId, getObfuscatedData, getTokenId, getTokenRegistryAddress, getTransferableRecordsCredentialStatus, isObfuscated, isTransferableRecord };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { verifyW3CSignature } from '../../..';
|
|
2
|
+
import { deriveCredential } from '@trustvc/w3c-vc';
|
|
3
|
+
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
6
|
+
const PROOF_TYPE = "DataIntegrityProof";
|
|
7
|
+
const CRYPTOSUITE = "ecdsa-sd-2023";
|
|
8
|
+
const DERIVE_CREDENTIAL_ERROR = "Use deriveCredential() first";
|
|
9
|
+
function isSignedVerifiableCredential(document) {
|
|
10
|
+
return typeof document === "object" && document !== null && "proof" in document;
|
|
11
|
+
}
|
|
12
|
+
__name(isSignedVerifiableCredential, "isSignedVerifiableCredential");
|
|
13
|
+
const ecdsaW3CSignatureIntegrity = {
|
|
14
|
+
skip: /* @__PURE__ */ __name(async () => {
|
|
15
|
+
return {
|
|
16
|
+
type: "DOCUMENT_INTEGRITY",
|
|
17
|
+
name: "EcdsaW3CSignatureIntegrity",
|
|
18
|
+
reason: {
|
|
19
|
+
code: 0,
|
|
20
|
+
codeString: "SKIPPED",
|
|
21
|
+
message: `Document either has no proof or proof type is not '${PROOF_TYPE}' or proof cryptosuite is not '${CRYPTOSUITE}'.`
|
|
22
|
+
},
|
|
23
|
+
status: "SKIPPED"
|
|
24
|
+
};
|
|
25
|
+
}, "skip"),
|
|
26
|
+
test: /* @__PURE__ */ __name((document) => {
|
|
27
|
+
const doc = document;
|
|
28
|
+
return doc.proof?.type === "DataIntegrityProof" && doc.proof?.cryptosuite === "ecdsa-sd-2023";
|
|
29
|
+
}, "test"),
|
|
30
|
+
verify: /* @__PURE__ */ __name(async (document, verifierOptions) => {
|
|
31
|
+
if (!isSignedVerifiableCredential(document)) {
|
|
32
|
+
return {
|
|
33
|
+
type: "DOCUMENT_INTEGRITY",
|
|
34
|
+
name: "EcdsaW3CSignatureIntegrity",
|
|
35
|
+
data: false,
|
|
36
|
+
reason: {
|
|
37
|
+
message: "Document is not a valid SignedVerifiableCredential"
|
|
38
|
+
},
|
|
39
|
+
status: "INVALID"
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
try {
|
|
43
|
+
let verificationResult = await verifyW3CSignature(document, verifierOptions);
|
|
44
|
+
let isDerived = true;
|
|
45
|
+
if (!verificationResult.verified && verificationResult.error?.includes(DERIVE_CREDENTIAL_ERROR)) {
|
|
46
|
+
const derivedCredential = await deriveCredential(document, []);
|
|
47
|
+
verificationResult = await verifyW3CSignature(derivedCredential.derived, verifierOptions);
|
|
48
|
+
isDerived = false;
|
|
49
|
+
}
|
|
50
|
+
if (verificationResult.verified) {
|
|
51
|
+
return {
|
|
52
|
+
type: "DOCUMENT_INTEGRITY",
|
|
53
|
+
name: "EcdsaW3CSignatureIntegrity",
|
|
54
|
+
data: true,
|
|
55
|
+
reason: {
|
|
56
|
+
message: isDerived ? "Document verified successfully" : "Document verified after derivation"
|
|
57
|
+
},
|
|
58
|
+
status: "VALID"
|
|
59
|
+
};
|
|
60
|
+
} else {
|
|
61
|
+
return {
|
|
62
|
+
type: "DOCUMENT_INTEGRITY",
|
|
63
|
+
name: "EcdsaW3CSignatureIntegrity",
|
|
64
|
+
data: false,
|
|
65
|
+
reason: {
|
|
66
|
+
message: verificationResult.error || "Verification failed"
|
|
67
|
+
},
|
|
68
|
+
status: "INVALID"
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
} catch (error) {
|
|
72
|
+
return {
|
|
73
|
+
type: "DOCUMENT_INTEGRITY",
|
|
74
|
+
name: "EcdsaW3CSignatureIntegrity",
|
|
75
|
+
data: false,
|
|
76
|
+
reason: {
|
|
77
|
+
message: error instanceof Error ? error.message : "Unknown verification error"
|
|
78
|
+
},
|
|
79
|
+
status: "INVALID"
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}, "verify")
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export { ecdsaW3CSignatureIntegrity };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { openAttestationDidIdentityProof, openAttestationDidSignedDocumentStatus, openAttestationDnsDidIdentityProof, openAttestationDnsTxtIdentityProof, openAttestationEthereumDocumentStoreStatus, openAttestationEthereumTokenRegistryStatus, openAttestationHash } from '@tradetrust-tt/tt-verify';
|
|
2
2
|
export { w3cSignatureIntegrity } from './document-integrity/w3cSignatureIntegrity';
|
|
3
|
+
export { ecdsaW3CSignatureIntegrity } from './document-integrity/ecdsaW3CSignatureIntegrity';
|
|
3
4
|
export { TRANSFERABLE_RECORDS_TYPE, credentialStatusTransferableRecordVerifier } from './document-status/transferableRecords/transferableRecordVerifier';
|
|
4
5
|
export { w3cCredentialStatus } from './document-status/w3cCredentialStatus';
|
|
5
6
|
export { w3cIssuerIdentity } from './issuer-identity/w3cIssuerIdentity';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { openAttestationVerifiers as openAttestationVerifiers$1, openAttestationDidIdentityProof, openAttestationDnsTxtIdentityProof, openAttestationDnsDidIdentityProof, openAttestationEthereumTokenRegistryStatus, openAttestationEthereumDocumentStoreStatus, openAttestationDidSignedDocumentStatus, openAttestationHash } from '@tradetrust-tt/tt-verify';
|
|
2
2
|
export { createResolver, getIdentifier, isValid, openAttestationDidIdentityProof, utils, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
|
|
3
3
|
import { w3cSignatureIntegrity } from './fragments/document-integrity/w3cSignatureIntegrity';
|
|
4
|
+
import { ecdsaW3CSignatureIntegrity } from './fragments/document-integrity/ecdsaW3CSignatureIntegrity';
|
|
4
5
|
import { credentialStatusTransferableRecordVerifier } from './fragments/document-status/transferableRecords/transferableRecordVerifier';
|
|
5
6
|
import { w3cCredentialStatus } from './fragments/document-status/w3cCredentialStatus';
|
|
6
7
|
import { w3cIssuerIdentity } from './fragments/issuer-identity/w3cIssuerIdentity';
|
|
@@ -32,6 +33,7 @@ const openAttestationVerifiers = [
|
|
|
32
33
|
];
|
|
33
34
|
const w3cVerifiers = [
|
|
34
35
|
w3cSignatureIntegrity,
|
|
36
|
+
ecdsaW3CSignatureIntegrity,
|
|
35
37
|
w3cCredentialStatus,
|
|
36
38
|
credentialStatusTransferableRecordVerifier,
|
|
37
39
|
w3cEmptyCredentialStatus,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { deriveCredential } from '@trustvc/w3c-vc';
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
+
const deriveW3C = /* @__PURE__ */ __name(async (credential, revealedAttributes) => {
|
|
6
|
+
return deriveCredential(credential, revealedAttributes);
|
|
7
|
+
}, "deriveW3C");
|
|
8
|
+
|
|
9
|
+
export { deriveW3C };
|
package/dist/esm/w3c/index.js
CHANGED
package/dist/esm/w3c/sign.js
CHANGED
|
@@ -2,8 +2,8 @@ import { signCredential } from '@trustvc/w3c-vc';
|
|
|
2
2
|
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
|
-
const signW3C = /* @__PURE__ */ __name(async (credential, keyPair, cryptoSuite = "
|
|
6
|
-
return signCredential(credential, keyPair, cryptoSuite);
|
|
5
|
+
const signW3C = /* @__PURE__ */ __name(async (credential, keyPair, cryptoSuite = "ecdsa-sd-2023", options) => {
|
|
6
|
+
return signCredential(credential, keyPair, cryptoSuite, options);
|
|
7
7
|
}, "signW3C");
|
|
8
8
|
|
|
9
9
|
export { signW3C };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PrivateKeyPair } from '@trustvc/w3c-issuer';
|
|
2
|
-
import { VerifiableCredential, SignedVerifiableCredential } from '@trustvc/w3c-vc';
|
|
2
|
+
import { VerifiableCredential, CryptoSuiteName, SignedVerifiableCredential } from '@trustvc/w3c-vc';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Configuration for a W3C Verifiable Document using a Bitstring Status List.
|
|
@@ -69,7 +69,7 @@ declare class DocumentBuilder {
|
|
|
69
69
|
expirationDate(date: string | Date): this;
|
|
70
70
|
renderMethod(method: RenderMethod): this;
|
|
71
71
|
qrCode(method: qrCode): this;
|
|
72
|
-
sign(privateKey: PrivateKeyPair, cryptoSuite?:
|
|
72
|
+
sign(privateKey: PrivateKeyPair, cryptoSuite?: CryptoSuiteName): Promise<SignedVerifiableCredential>;
|
|
73
73
|
verify(): Promise<boolean>;
|
|
74
74
|
toString(): string;
|
|
75
75
|
private isTransferableRecordsConfig;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { openAttestationDidIdentityProof, openAttestationDidSignedDocumentStatus, openAttestationDnsDidIdentityProof, openAttestationDnsTxtIdentityProof, openAttestationEthereumDocumentStoreStatus, openAttestationEthereumTokenRegistryStatus, openAttestationHash } from '@tradetrust-tt/tt-verify';
|
|
2
2
|
import { w3cSignatureIntegrity } from './verify/fragments/document-integrity/w3cSignatureIntegrity.js';
|
|
3
|
+
import { ecdsaW3CSignatureIntegrity } from './verify/fragments/document-integrity/ecdsaW3CSignatureIntegrity.js';
|
|
3
4
|
import { TRANSFERABLE_RECORDS_TYPE, credentialStatusTransferableRecordVerifier } from './verify/fragments/document-status/transferableRecords/transferableRecordVerifier.js';
|
|
4
5
|
import { w3cCredentialStatus } from './verify/fragments/document-status/w3cCredentialStatus.js';
|
|
5
6
|
import { w3cIssuerIdentity } from './verify/fragments/issuer-identity/w3cIssuerIdentity.js';
|
|
@@ -7,6 +8,7 @@ import { w3cEmptyCredentialStatus } from './verify/fragments/document-status/w3c
|
|
|
7
8
|
|
|
8
9
|
declare const index_TRANSFERABLE_RECORDS_TYPE: typeof TRANSFERABLE_RECORDS_TYPE;
|
|
9
10
|
declare const index_credentialStatusTransferableRecordVerifier: typeof credentialStatusTransferableRecordVerifier;
|
|
11
|
+
declare const index_ecdsaW3CSignatureIntegrity: typeof ecdsaW3CSignatureIntegrity;
|
|
10
12
|
declare const index_openAttestationDidIdentityProof: typeof openAttestationDidIdentityProof;
|
|
11
13
|
declare const index_openAttestationDidSignedDocumentStatus: typeof openAttestationDidSignedDocumentStatus;
|
|
12
14
|
declare const index_openAttestationDnsDidIdentityProof: typeof openAttestationDnsDidIdentityProof;
|
|
@@ -19,7 +21,7 @@ declare const index_w3cEmptyCredentialStatus: typeof w3cEmptyCredentialStatus;
|
|
|
19
21
|
declare const index_w3cIssuerIdentity: typeof w3cIssuerIdentity;
|
|
20
22
|
declare const index_w3cSignatureIntegrity: typeof w3cSignatureIntegrity;
|
|
21
23
|
declare namespace index {
|
|
22
|
-
export { index_TRANSFERABLE_RECORDS_TYPE as TRANSFERABLE_RECORDS_TYPE, index_credentialStatusTransferableRecordVerifier as credentialStatusTransferableRecordVerifier, index_openAttestationDidIdentityProof as openAttestationDidIdentityProof, index_openAttestationDidSignedDocumentStatus as openAttestationDidSignedDocumentStatus, index_openAttestationDnsDidIdentityProof as openAttestationDnsDidIdentityProof, index_openAttestationDnsTxtIdentityProof as openAttestationDnsTxtIdentityProof, index_openAttestationEthereumDocumentStoreStatus as openAttestationEthereumDocumentStoreStatus, index_openAttestationEthereumTokenRegistryStatus as openAttestationEthereumTokenRegistryStatus, index_openAttestationHash as openAttestationHash, index_w3cCredentialStatus as w3cCredentialStatus, index_w3cEmptyCredentialStatus as w3cEmptyCredentialStatus, index_w3cIssuerIdentity as w3cIssuerIdentity, index_w3cSignatureIntegrity as w3cSignatureIntegrity };
|
|
24
|
+
export { index_TRANSFERABLE_RECORDS_TYPE as TRANSFERABLE_RECORDS_TYPE, index_credentialStatusTransferableRecordVerifier as credentialStatusTransferableRecordVerifier, index_ecdsaW3CSignatureIntegrity as ecdsaW3CSignatureIntegrity, index_openAttestationDidIdentityProof as openAttestationDidIdentityProof, index_openAttestationDidSignedDocumentStatus as openAttestationDidSignedDocumentStatus, index_openAttestationDnsDidIdentityProof as openAttestationDnsDidIdentityProof, index_openAttestationDnsTxtIdentityProof as openAttestationDnsTxtIdentityProof, index_openAttestationEthereumDocumentStoreStatus as openAttestationEthereumDocumentStoreStatus, index_openAttestationEthereumTokenRegistryStatus as openAttestationEthereumTokenRegistryStatus, index_openAttestationHash as openAttestationHash, index_w3cCredentialStatus as w3cCredentialStatus, index_w3cEmptyCredentialStatus as w3cEmptyCredentialStatus, index_w3cIssuerIdentity as w3cIssuerIdentity, index_w3cSignatureIntegrity as w3cSignatureIntegrity };
|
|
23
25
|
}
|
|
24
26
|
|
|
25
27
|
export { index as i };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -27,11 +27,11 @@ export { TitleEscrowInterface, checkSupportsInterface, fetchEndorsementChain, ge
|
|
|
27
27
|
export { DocumentBuilder, RenderMethod, W3CTransferableRecordsConfig, W3CVerifiableDocumentConfig, qrCode } from './core/documentBuilder.js';
|
|
28
28
|
export { signOA } from './open-attestation/sign.js';
|
|
29
29
|
export { KeyPair } from './open-attestation/types.js';
|
|
30
|
-
export { diagnose, getAssetId, getDocumentData, getIssuerAddress, getTemplateURL, isDocumentRevokable,
|
|
30
|
+
export { diagnose, getAssetId, getDocumentData, getIssuerAddress, getTemplateURL, isDocumentRevokable, isRawV2Document, isRawV3Document, isSignedWrappedV2Document, isSignedWrappedV3Document, isTransferableAsset, isWrappedV2Document, isWrappedV3Document } from './open-attestation/utils.js';
|
|
31
31
|
export { verifyOASignature } from './open-attestation/verify.js';
|
|
32
32
|
export { wrapOADocument, wrapOADocumentV2, wrapOADocuments, wrapOADocumentsV2 } from './open-attestation/wrap.js';
|
|
33
33
|
export { openAttestationVerifiers, verifiers, w3cVerifiers } from './verify/verify.js';
|
|
34
|
-
export { i as fragments } from './index-
|
|
34
|
+
export { i as fragments } from './index-LpXMEhhr.js';
|
|
35
35
|
export { i as context } from './index-DwAYXQn2.js';
|
|
36
36
|
export { i as credentialStatus } from './index-CjwEVGoM.js';
|
|
37
37
|
export { i as issuer } from './index-ClF4_Nqk.js';
|
|
@@ -40,18 +40,21 @@ export { RawVerifiableCredential, SignedVerifiableCredential, SigningResult, Ver
|
|
|
40
40
|
export { PrivateKeyPair } from '@trustvc/w3c-issuer';
|
|
41
41
|
export { i as vc } from './index-1ws_BWZW.js';
|
|
42
42
|
export { verifyW3CSignature } from './w3c/verify.js';
|
|
43
|
+
export { deriveW3C } from './w3c/derive.js';
|
|
43
44
|
export { errorMessageHandling, w3cCredentialStatusRevoked, w3cCredentialStatusSuspended } from './utils/fragment/index.js';
|
|
44
45
|
export * from '@tradetrust-tt/tradetrust-utils/constants/network';
|
|
45
46
|
export { generate12ByteNonce, generate32ByteKey, stringToUint8Array } from './utils/stringUtils/index.js';
|
|
46
47
|
export * from '@tradetrust-tt/tradetrust-utils/constants/supportedChains';
|
|
47
|
-
export {
|
|
48
|
-
export { WrappedOrSignedOpenAttestationDocument, getChainId, getTokenId, getTokenRegistryAddress, getTransferableRecordsCredentialStatus, isTransferableRecord } from './utils/documents/index.js';
|
|
48
|
+
export { errorMessages } from './utils/errorMessages/index.js';
|
|
49
|
+
export { WrappedOrSignedOpenAttestationDocument, getChainId, getObfuscatedData, getTokenId, getTokenRegistryAddress, getTransferableRecordsCredentialStatus, isObfuscated, isTransferableRecord } from './utils/documents/index.js';
|
|
50
|
+
export { GasStationFeeData, GasStationFunction, calculateMaxFee, gasStation, interpretFragments, scaleBigNumber } from '@tradetrust-tt/tradetrust-utils';
|
|
49
51
|
export { AwsKmsSigner, AwsKmsSignerCredentials } from '@tradetrust-tt/ethers-aws-kms-signer';
|
|
50
52
|
export { CustomDnsResolver, IDNSQueryResponse, IDNSRecord, OpenAttestationDNSTextRecord, OpenAttestationDnsDidRecord, defaultDnsResolvers, getDnsDidRecords, getDocumentStoreRecords, parseDnsDidResults, parseDocumentStoreResults, parseOpenAttestationRecord, queryDns } from '@tradetrust-tt/dnsprove';
|
|
51
53
|
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';
|
|
52
54
|
export { DiagnoseError } from '@tradetrust-tt/tradetrust/dist/types/shared/utils';
|
|
53
55
|
export { createResolver, getIdentifier, isValid, openAttestationDidIdentityProof, utils, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
|
|
54
56
|
export { DocumentsToVerify, ErrorVerificationFragment, InvalidVerificationFragment, ProviderDetails, providerType as ProviderType, SkippedVerificationFragment, ValidVerificationFragment, VerificationBuilderOptions, VerificationFragment, VerificationFragmentStatus, VerificationFragmentType, VerificationFragmentWithData, Verifier, VerifierOptions } from '@tradetrust-tt/tt-verify/dist/types/src/types/core';
|
|
57
|
+
export { ErrorMessage, ErrorMessageTypes, ErrorMessages, MessagesDictionary } from './utils/errorMessages/types.js';
|
|
55
58
|
import '@tradetrust-tt/token-registry-v4/contracts';
|
|
56
59
|
import 'ethers';
|
|
57
60
|
import '@typechain/ethers-v5/static/common';
|
|
@@ -69,6 +72,7 @@ import '@tradetrust-tt/tradetrust/dist/types/__generated__/schema.2.0';
|
|
|
69
72
|
import '@tradetrust-tt/tradetrust/dist/types/shared/utils/@types/diagnose';
|
|
70
73
|
import './verify/fragments/document-status/transferableRecords/transferableRecordVerifier.types.js';
|
|
71
74
|
import './verify/fragments/document-integrity/w3cSignatureIntegrity.js';
|
|
75
|
+
import './verify/fragments/document-integrity/ecdsaW3CSignatureIntegrity.js';
|
|
72
76
|
import './verify/fragments/document-status/transferableRecords/transferableRecordVerifier.js';
|
|
73
77
|
import './verify/fragments/document-status/w3cCredentialStatus.js';
|
|
74
78
|
import './verify/fragments/issuer-identity/w3cIssuerIdentity.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { signOA } from './sign.js';
|
|
2
2
|
export { KeyPair } from './types.js';
|
|
3
|
-
export { diagnose, getAssetId, getDocumentData, getIssuerAddress, getTemplateURL, isDocumentRevokable,
|
|
3
|
+
export { diagnose, getAssetId, getDocumentData, getIssuerAddress, getTemplateURL, isDocumentRevokable, isRawV2Document, isRawV3Document, isSignedWrappedV2Document, isSignedWrappedV3Document, isTransferableAsset, isWrappedV2Document, isWrappedV3Document } from './utils.js';
|
|
4
4
|
export { verifyOASignature } from './verify.js';
|
|
5
5
|
export { wrapOADocument, wrapOADocumentV2, wrapOADocuments, wrapOADocumentsV2 } from './wrap.js';
|
|
6
6
|
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';
|
|
@@ -28,7 +28,6 @@ declare const isRawV2Document: (document: any, { mode }?: {
|
|
|
28
28
|
declare const isRawV3Document: (document: any, { mode }?: {
|
|
29
29
|
mode: _tradetrust_tt_tradetrust_dist_types_shared_utils__types_diagnose.Mode;
|
|
30
30
|
}) => document is _tradetrust_tt_tradetrust_dist_types___generated___schema_3_0.OpenAttestationDocument;
|
|
31
|
-
declare const isObfuscated: (document: _tradetrust_tt_tradetrust_dist_types_3_0_types.WrappedDocument<_tradetrust_tt_tradetrust_dist_types___generated___schema_3_0.OpenAttestationDocument> | _tradetrust_tt_tradetrust_dist_types_2_0_types.WrappedDocument<_tradetrust_tt_tradetrust_dist_types___generated___schema_2_0.OpenAttestationDocument>) => boolean;
|
|
32
31
|
declare const getDocumentData: (document: _tradetrust_tt_tradetrust.WrappedDocument<_tradetrust_tt_tradetrust.OpenAttestationDocument>) => _tradetrust_tt_tradetrust.OpenAttestationDocument;
|
|
33
32
|
declare const getIssuerAddress: typeof utils.getIssuerAddress;
|
|
34
33
|
declare const diagnose: ({ version, kind, document, debug, mode, }: {
|
|
@@ -40,4 +39,4 @@ declare const diagnose: ({ version, kind, document, debug, mode, }: {
|
|
|
40
39
|
}) => utils.DiagnoseError[];
|
|
41
40
|
declare const getTemplateURL: (document: any) => string | undefined;
|
|
42
41
|
|
|
43
|
-
export { diagnose, getAssetId, getDocumentData, getIssuerAddress, getTemplateURL, isDocumentRevokable,
|
|
42
|
+
export { diagnose, getAssetId, getDocumentData, getIssuerAddress, getTemplateURL, isDocumentRevokable, isRawV2Document, isRawV3Document, isSignedWrappedV2Document, isSignedWrappedV3Document, isTransferableAsset, isWrappedV2Document, isWrappedV3Document };
|
|
@@ -9,5 +9,7 @@ declare const isTransferableRecord: (document: WrappedOrSignedOpenAttestationDoc
|
|
|
9
9
|
declare const getTokenRegistryAddress: (document: WrappedOrSignedOpenAttestationDocument | SignedVerifiableCredential) => string | undefined;
|
|
10
10
|
declare const getTokenId: (document: WrappedOrSignedOpenAttestationDocument | SignedVerifiableCredential) => string;
|
|
11
11
|
declare const getChainId: (document: WrappedOrSignedOpenAttestationDocument | SignedVerifiableCredential) => CHAIN_ID | undefined;
|
|
12
|
+
declare const isObfuscated: (document: WrappedDocument<OpenAttestationDocument> | SignedVerifiableCredential) => boolean;
|
|
13
|
+
declare const getObfuscatedData: (document: WrappedDocument<OpenAttestationDocument>) => string[];
|
|
12
14
|
|
|
13
|
-
export { type WrappedOrSignedOpenAttestationDocument, getChainId, getTokenId, getTokenRegistryAddress, getTransferableRecordsCredentialStatus, isTransferableRecord };
|
|
15
|
+
export { type WrappedOrSignedOpenAttestationDocument, getChainId, getObfuscatedData, getTokenId, getTokenRegistryAddress, getTransferableRecordsCredentialStatus, isObfuscated, isTransferableRecord };
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { ErrorMessages } from './types.js';
|
|
2
|
+
export { ErrorMessage, ErrorMessageTypes, MessagesDictionary } from './types.js';
|
|
3
|
+
|
|
4
|
+
declare const errorMessages: ErrorMessages;
|
|
5
|
+
|
|
6
|
+
export { ErrorMessages, errorMessages };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions matching the structure in @tradetrust-tt/tradetrust-utils/VerificationErrorMessages.ts
|
|
3
|
+
*/
|
|
4
|
+
interface ErrorMessage {
|
|
5
|
+
failureTitle: string;
|
|
6
|
+
failureMessage: string;
|
|
7
|
+
successTitle: string;
|
|
8
|
+
}
|
|
9
|
+
interface MessagesDictionary {
|
|
10
|
+
[key: string]: ErrorMessage;
|
|
11
|
+
}
|
|
12
|
+
interface ErrorMessageTypes {
|
|
13
|
+
[key: string]: string;
|
|
14
|
+
}
|
|
15
|
+
interface ErrorMessages {
|
|
16
|
+
MESSAGES: MessagesDictionary;
|
|
17
|
+
TYPES: ErrorMessageTypes;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type { ErrorMessage, ErrorMessageTypes, ErrorMessages, MessagesDictionary };
|
|
@@ -2,9 +2,11 @@ export { errorMessageHandling, w3cCredentialStatusRevoked, w3cCredentialStatusSu
|
|
|
2
2
|
export * from '@tradetrust-tt/tradetrust-utils/constants/network';
|
|
3
3
|
export { generate12ByteNonce, generate32ByteKey, stringToUint8Array } from './stringUtils/index.js';
|
|
4
4
|
export * from '@tradetrust-tt/tradetrust-utils/constants/supportedChains';
|
|
5
|
-
export {
|
|
6
|
-
export { WrappedOrSignedOpenAttestationDocument, getChainId, getTokenId, getTokenRegistryAddress, getTransferableRecordsCredentialStatus, isTransferableRecord } from './documents/index.js';
|
|
5
|
+
export { errorMessages } from './errorMessages/index.js';
|
|
6
|
+
export { WrappedOrSignedOpenAttestationDocument, getChainId, getObfuscatedData, getTokenId, getTokenRegistryAddress, getTransferableRecordsCredentialStatus, isObfuscated, isTransferableRecord } from './documents/index.js';
|
|
7
|
+
export { GasStationFeeData, GasStationFunction, calculateMaxFee, gasStation, interpretFragments, scaleBigNumber } from '@tradetrust-tt/tradetrust-utils';
|
|
7
8
|
export { AwsKmsSigner, AwsKmsSignerCredentials } from '@tradetrust-tt/ethers-aws-kms-signer';
|
|
9
|
+
export { ErrorMessage, ErrorMessageTypes, ErrorMessages, MessagesDictionary } from './errorMessages/types.js';
|
|
8
10
|
import '@tradetrust-tt/tt-verify';
|
|
9
11
|
import '@tradetrust-tt/tradetrust';
|
|
10
12
|
import '@trustvc/w3c-credential-status';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { openAttestationDidIdentityProof, openAttestationDidSignedDocumentStatus, openAttestationDnsDidIdentityProof, openAttestationDnsTxtIdentityProof, openAttestationEthereumDocumentStoreStatus, openAttestationEthereumTokenRegistryStatus, openAttestationHash } from '@tradetrust-tt/tt-verify';
|
|
2
2
|
export { w3cSignatureIntegrity } from './document-integrity/w3cSignatureIntegrity.js';
|
|
3
|
+
export { ecdsaW3CSignatureIntegrity } from './document-integrity/ecdsaW3CSignatureIntegrity.js';
|
|
3
4
|
export { TRANSFERABLE_RECORDS_TYPE, credentialStatusTransferableRecordVerifier } from './document-status/transferableRecords/transferableRecordVerifier.js';
|
|
4
5
|
export { w3cCredentialStatus } from './document-status/w3cCredentialStatus.js';
|
|
5
6
|
export { w3cIssuerIdentity } from './issuer-identity/w3cIssuerIdentity.js';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export { openAttestationVerifiers, verifiers, w3cVerifiers } from './verify.js';
|
|
2
|
-
export { i as fragments } from '../index-
|
|
2
|
+
export { i as fragments } from '../index-LpXMEhhr.js';
|
|
3
3
|
export { createResolver, getIdentifier, isValid, openAttestationDidIdentityProof, utils, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
|
|
4
4
|
export { DocumentsToVerify, ErrorVerificationFragment, InvalidVerificationFragment, ProviderDetails, providerType as ProviderType, SkippedVerificationFragment, ValidVerificationFragment, VerificationBuilderOptions, VerificationFragment, VerificationFragmentStatus, VerificationFragmentType, VerificationFragmentWithData, 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
|
+
import './fragments/document-integrity/ecdsaW3CSignatureIntegrity.js';
|
|
7
8
|
import './fragments/document-status/transferableRecords/transferableRecordVerifier.js';
|
|
8
9
|
import './fragments/document-status/w3cCredentialStatus.js';
|
|
9
10
|
import './fragments/issuer-identity/w3cIssuerIdentity.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { SignedVerifiableCredential, ContextDocument, DerivedResult } from '@trustvc/w3c-vc';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Derives a credential with selective disclosure based on revealed attributes.
|
|
5
|
+
* @param {object} credential - The verifiable credential to be selectively disclosed.
|
|
6
|
+
* @param {object|string[]} revealedAttributes - For BBS+: The attributes from the credential that should be revealed. For ECDSA-SD-2023: Array of selective pointers.
|
|
7
|
+
* @returns {Promise<DerivedResult>} A DerivedResult containing the derived proof or an error message.
|
|
8
|
+
*/
|
|
9
|
+
declare const deriveW3C: (credential: SignedVerifiableCredential, revealedAttributes: ContextDocument | string[]) => Promise<DerivedResult>;
|
|
10
|
+
|
|
11
|
+
export { deriveW3C };
|
|
@@ -6,5 +6,6 @@ export { RawVerifiableCredential, SignedVerifiableCredential, SigningResult, Ver
|
|
|
6
6
|
export { PrivateKeyPair } from '@trustvc/w3c-issuer';
|
|
7
7
|
export { i as vc } from '../index-1ws_BWZW.js';
|
|
8
8
|
export { verifyW3CSignature } from './verify.js';
|
|
9
|
+
export { deriveW3C } from './derive.js';
|
|
9
10
|
import '@trustvc/w3c-context';
|
|
10
11
|
import '@trustvc/w3c-credential-status';
|
package/dist/types/w3c/sign.d.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import { RawVerifiableCredential, SigningResult } from '@trustvc/w3c-vc';
|
|
1
|
+
import { RawVerifiableCredential, CryptoSuiteName, SigningResult } from '@trustvc/w3c-vc';
|
|
2
2
|
import { PrivateKeyPair } from '@trustvc/w3c-issuer';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Signs a W3C Verifiable Credential using the provided cryptographic suite and key pair.
|
|
6
6
|
* @param {RawVerifiableCredential} credential - The verifiable credential object that needs to be signed.
|
|
7
7
|
* @param {PrivateKeyPair} keyPair - The private and public key pair used for signing the credential.
|
|
8
|
-
* @param {
|
|
8
|
+
* @param {CryptoSuiteName} [cryptoSuite='ecdsa-sd-2023'] - The cryptographic suite to be used for signing (default is 'ecdsa-sd-2023').
|
|
9
|
+
* @param {object} [options] - Optional parameters including mandatoryPointers for ECDSA-SD-2023.
|
|
10
|
+
* @param {string[]} [options.mandatoryPointers] - Optional mandatory pointers for ECDSA-SD-2023.
|
|
9
11
|
* @returns {Promise<SigningResult>} A promise that resolves to the result of the signing operation, which includes the signed credential.
|
|
10
12
|
*/
|
|
11
|
-
declare const signW3C: (credential: RawVerifiableCredential, keyPair: PrivateKeyPair, cryptoSuite?:
|
|
13
|
+
declare const signW3C: (credential: RawVerifiableCredential, keyPair: PrivateKeyPair, cryptoSuite?: CryptoSuiteName, options?: {
|
|
14
|
+
mandatoryPointers?: string[];
|
|
15
|
+
}) => Promise<SigningResult>;
|
|
12
16
|
|
|
13
17
|
export { signW3C };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trustvc/trustvc",
|
|
3
|
-
"version": "1.6.0-alpha.
|
|
3
|
+
"version": "1.6.0-alpha.6",
|
|
4
4
|
"description": "TrustVC library",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -114,17 +114,18 @@
|
|
|
114
114
|
}
|
|
115
115
|
},
|
|
116
116
|
"dependencies": {
|
|
117
|
-
"@tradetrust-tt/dnsprove": "^2.
|
|
117
|
+
"@tradetrust-tt/dnsprove": "^2.18.0",
|
|
118
118
|
"@tradetrust-tt/ethers-aws-kms-signer": "^2.1.4",
|
|
119
119
|
"@tradetrust-tt/token-registry-v4": "npm:@tradetrust-tt/token-registry@^4.16.0",
|
|
120
|
-
"@tradetrust-tt/token-registry-v5": "npm:@tradetrust-tt/token-registry@^5.
|
|
121
|
-
"@tradetrust-tt/tradetrust": "^6.10.
|
|
122
|
-
"@tradetrust-tt/tradetrust-utils": "^2.
|
|
123
|
-
"@tradetrust-tt/tt-verify": "^9.
|
|
124
|
-
"@trustvc/w3c
|
|
125
|
-
"@trustvc/w3c-
|
|
126
|
-
"@trustvc/w3c-
|
|
127
|
-
"@trustvc/w3c-
|
|
120
|
+
"@tradetrust-tt/token-registry-v5": "npm:@tradetrust-tt/token-registry@^5.5.0",
|
|
121
|
+
"@tradetrust-tt/tradetrust": "^6.10.2",
|
|
122
|
+
"@tradetrust-tt/tradetrust-utils": "^2.4.2",
|
|
123
|
+
"@tradetrust-tt/tt-verify": "^9.5.1",
|
|
124
|
+
"@trustvc/w3c": "^1.3.0-alpha.6",
|
|
125
|
+
"@trustvc/w3c-context": "^1.3.0-alpha.6",
|
|
126
|
+
"@trustvc/w3c-credential-status": "^1.3.0-alpha.6",
|
|
127
|
+
"@trustvc/w3c-issuer": "^1.3.0-alpha.5",
|
|
128
|
+
"@trustvc/w3c-vc": "^1.3.0-alpha.6",
|
|
128
129
|
"ethers": "^5.8.0",
|
|
129
130
|
"ethersV6": "npm:ethers@^6.14.4",
|
|
130
131
|
"js-sha3": "^0.9.3",
|