@trustvc/trustvc 1.2.10 → 1.3.0
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/dist/cjs/core/documentBuilder.js +153 -2
- package/dist/cjs/core/index.js +7 -0
- package/dist/esm/core/documentBuilder.js +153 -2
- package/dist/esm/core/index.js +1 -0
- package/dist/types/core/documentBuilder.d.ts +32 -3
- package/dist/types/core/index.d.ts +2 -0
- package/dist/types/{index-1ws_BWZW.d.ts → index-Bc5NlE8f.d.ts} +2 -2
- package/dist/types/index.d.ts +2 -1
- package/dist/types/w3c/index.d.ts +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var w3c = require('../w3c');
|
|
4
|
+
var w3cCredentialStatus = require('@trustvc/w3c-credential-status');
|
|
5
|
+
var w3cVc = require('@trustvc/w3c-vc');
|
|
6
|
+
var ethers = require('ethers');
|
|
7
|
+
var tokenRegistryV4$1 = require('@tradetrust-tt/token-registry-v4');
|
|
8
|
+
var tokenRegistryV5$1 = require('@tradetrust-tt/token-registry-v5');
|
|
9
|
+
var tokenRegistryV4 = require('../token-registry-v4');
|
|
10
|
+
var tokenRegistryV5 = require('../token-registry-v5');
|
|
11
|
+
var tradetrustUtils = require('@tradetrust-tt/tradetrust-utils');
|
|
12
|
+
|
|
3
13
|
var __defProp = Object.defineProperty;
|
|
4
14
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
5
15
|
class DocumentBuilder {
|
|
@@ -7,8 +17,149 @@ class DocumentBuilder {
|
|
|
7
17
|
__name(this, "DocumentBuilder");
|
|
8
18
|
}
|
|
9
19
|
document;
|
|
10
|
-
|
|
11
|
-
|
|
20
|
+
// Holds the document to be built and signed.
|
|
21
|
+
documentType = "w3c";
|
|
22
|
+
// Default to W3C
|
|
23
|
+
selectedStatusType = null;
|
|
24
|
+
// Tracks selected status type.
|
|
25
|
+
statusConfig = {};
|
|
26
|
+
// Configuration for the credential status.
|
|
27
|
+
rpcProviderUrl;
|
|
28
|
+
// Holds the RPC provider URL for verifying token registry.
|
|
29
|
+
requiredFields = ["credentialSubject"];
|
|
30
|
+
// Required fields that must be present in the document.
|
|
31
|
+
/**
|
|
32
|
+
* Constructor to initialize the document builder.
|
|
33
|
+
* @param {Partial<VerifiableCredential>} input - The input document.
|
|
34
|
+
* @param {string} [documentType] - The type of the document (default is "w3c").
|
|
35
|
+
*/
|
|
36
|
+
constructor(input, documentType = "w3c") {
|
|
37
|
+
this.validateRequiredFields(input);
|
|
38
|
+
this.document = this.initializeDocument(input);
|
|
39
|
+
this.documentType = documentType;
|
|
40
|
+
}
|
|
41
|
+
// Public method to configure the document for transferable records. Sets up the token network and token registry.
|
|
42
|
+
transferableRecords(config) {
|
|
43
|
+
if (this.selectedStatusType) {
|
|
44
|
+
throw new Error(
|
|
45
|
+
"Configuration Error: You can only call either .transferableRecords() or .verifiableDocument(), not both."
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
this.selectedStatusType = "transferableRecords";
|
|
49
|
+
this.addContext("https://trustvc.io/context/transferable-records-context.json");
|
|
50
|
+
this.statusConfig = {
|
|
51
|
+
type: "TransferableRecords",
|
|
52
|
+
tokenNetwork: { chain: config.chain, chainId: config.chainId },
|
|
53
|
+
tokenRegistry: config.tokenRegistry
|
|
54
|
+
};
|
|
55
|
+
this.rpcProviderUrl = config.rpcProviderUrl;
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
58
|
+
// Public method to configure the document for verifiable credentials. Sets up the status list and revocation information.
|
|
59
|
+
verifiableDocument(config) {
|
|
60
|
+
if (this.selectedStatusType) {
|
|
61
|
+
throw new Error(
|
|
62
|
+
"Configuration Error: You can only call either .transferableRecords() or .verifiableDocument(), not both."
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
this.selectedStatusType = "verifiableDocument";
|
|
66
|
+
this.addContext("https://w3id.org/vc/status-list/2021/v1");
|
|
67
|
+
this.statusConfig = {
|
|
68
|
+
id: `${config.url}#${config.index}`,
|
|
69
|
+
type: "StatusList2021Entry",
|
|
70
|
+
statusPurpose: config.purpose || "revocation",
|
|
71
|
+
// Set status purpose to "revocation" by default.
|
|
72
|
+
statusListIndex: config.index,
|
|
73
|
+
statusListCredential: config.url
|
|
74
|
+
};
|
|
75
|
+
return this;
|
|
76
|
+
}
|
|
77
|
+
// Public method to sign the document using the provided private key and an optional cryptographic suite.
|
|
78
|
+
async sign(privateKey, cryptoSuite) {
|
|
79
|
+
if (this.selectedStatusType) {
|
|
80
|
+
this.document.credentialStatus = this.statusConfig;
|
|
81
|
+
}
|
|
82
|
+
if (this.selectedStatusType === "verifiableDocument") {
|
|
83
|
+
w3cCredentialStatus.assertCredentialStatus(this.document.credentialStatus);
|
|
84
|
+
const verificationResult = await w3cVc.verifyCredentialStatus(this.document.credentialStatus);
|
|
85
|
+
if (verificationResult.error)
|
|
86
|
+
throw new Error(`Credential Verification Failed: ${verificationResult.error}`);
|
|
87
|
+
if (verificationResult.status)
|
|
88
|
+
throw new Error("Credential Verification Failed: Invalid credential status detected.");
|
|
89
|
+
} else if (this.selectedStatusType === "transferableRecords") {
|
|
90
|
+
w3cCredentialStatus.assertTransferableRecords(this.document.credentialStatus, "sign");
|
|
91
|
+
await this.verifyTokenRegistry();
|
|
92
|
+
}
|
|
93
|
+
this.document.issuer = privateKey.id.split("#")[0];
|
|
94
|
+
this.document.issuanceDate = this.document.issuanceDate || (/* @__PURE__ */ new Date()).toISOString();
|
|
95
|
+
this.addContext("https://w3id.org/security/bbs/v1");
|
|
96
|
+
const signedVC = await w3c.signW3C(this.document, privateKey, cryptoSuite);
|
|
97
|
+
if (signedVC.error) throw new Error(`Signing Error: ${signedVC.error}`);
|
|
98
|
+
return signedVC.signed;
|
|
99
|
+
}
|
|
100
|
+
// Private helper method to validate that the required fields are present in the input document.
|
|
101
|
+
validateRequiredFields(input) {
|
|
102
|
+
this.requiredFields.forEach((field) => {
|
|
103
|
+
if (!input[field]) {
|
|
104
|
+
throw new Error(`Validation Error: Missing required field "${field}" in the credential.`);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
// Private helper method to initialize the document with required context and type, adding the necessary context URL.
|
|
109
|
+
initializeDocument(input) {
|
|
110
|
+
return {
|
|
111
|
+
...input,
|
|
112
|
+
"@context": this.buildContext(input["@context"]),
|
|
113
|
+
type: Array.from(new Set([].concat(input.type || [], "VerifiableCredential")))
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
// Private helper method to build the context for the document, ensuring uniqueness and adding the default W3C context.
|
|
117
|
+
buildContext(context) {
|
|
118
|
+
return [
|
|
119
|
+
"https://www.w3.org/2018/credentials/v1",
|
|
120
|
+
...Array.isArray(context) ? context : context ? [context] : []
|
|
121
|
+
].filter((v, i, a) => a.indexOf(v) === i);
|
|
122
|
+
}
|
|
123
|
+
// Private helper method to add a new context to the document if it does not already exist.
|
|
124
|
+
addContext(context) {
|
|
125
|
+
if (!this.document["@context"].includes(context)) {
|
|
126
|
+
this.document["@context"].push(context);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
// Private helper method to verify that the token registry supports the required interface for transferable records.
|
|
130
|
+
async verifyTokenRegistry() {
|
|
131
|
+
const chainId = this.document.credentialStatus.tokenNetwork.chainId;
|
|
132
|
+
if (!(chainId in tradetrustUtils.SUPPORTED_CHAINS)) {
|
|
133
|
+
throw new Error(`Unsupported Chain: Chain ID ${chainId} is not supported.`);
|
|
134
|
+
}
|
|
135
|
+
try {
|
|
136
|
+
const provider = new ethers.ethers.providers.JsonRpcProvider(this.rpcProviderUrl);
|
|
137
|
+
const isV4Supported = await this.supportsInterface(
|
|
138
|
+
tokenRegistryV4.v4Contracts.TradeTrustToken__factory,
|
|
139
|
+
tokenRegistryV4$1.constants.contractInterfaceId.TradeTrustTokenMintable,
|
|
140
|
+
provider
|
|
141
|
+
);
|
|
142
|
+
const isV5Supported = await this.supportsInterface(
|
|
143
|
+
tokenRegistryV5.v5Contracts.TradeTrustToken__factory,
|
|
144
|
+
tokenRegistryV5$1.constants.contractInterfaceId.TradeTrustTokenMintable,
|
|
145
|
+
provider
|
|
146
|
+
);
|
|
147
|
+
if (!isV4Supported && !isV5Supported)
|
|
148
|
+
throw new Error("Token registry version is not supported.");
|
|
149
|
+
} catch (error) {
|
|
150
|
+
if (error.message === "Token registry version is not supported.") {
|
|
151
|
+
throw error;
|
|
152
|
+
} else {
|
|
153
|
+
throw new Error(
|
|
154
|
+
`Network Error: Unable to verify token registry. Please check the RPC URL or token registry address.`
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
// Private helper method to check if a contract supports a specific interface ID.
|
|
160
|
+
async supportsInterface(contractFactory, interfaceId, provider) {
|
|
161
|
+
const contract = contractFactory.connect(this.statusConfig.tokenRegistry, provider);
|
|
162
|
+
return contract.supportsInterface(interfaceId);
|
|
12
163
|
}
|
|
13
164
|
}
|
|
14
165
|
|
package/dist/cjs/core/index.js
CHANGED
|
@@ -4,6 +4,7 @@ var decrypt = require('./decrypt');
|
|
|
4
4
|
var encrypt = require('./encrypt');
|
|
5
5
|
var verify = require('./verify');
|
|
6
6
|
var endorsementChain = require('./endorsement-chain');
|
|
7
|
+
var documentBuilder = require('./documentBuilder');
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
|
|
@@ -31,3 +32,9 @@ Object.keys(endorsementChain).forEach(function (k) {
|
|
|
31
32
|
get: function () { return endorsementChain[k]; }
|
|
32
33
|
});
|
|
33
34
|
});
|
|
35
|
+
Object.keys(documentBuilder).forEach(function (k) {
|
|
36
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () { return documentBuilder[k]; }
|
|
39
|
+
});
|
|
40
|
+
});
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
import { signW3C } from '../w3c';
|
|
2
|
+
import { assertCredentialStatus, assertTransferableRecords } from '@trustvc/w3c-credential-status';
|
|
3
|
+
import { verifyCredentialStatus } from '@trustvc/w3c-vc';
|
|
4
|
+
import { ethers } from 'ethers';
|
|
5
|
+
import { constants } from '@tradetrust-tt/token-registry-v4';
|
|
6
|
+
import { constants as constants$1 } from '@tradetrust-tt/token-registry-v5';
|
|
7
|
+
import { v4Contracts } from '../token-registry-v4';
|
|
8
|
+
import { v5Contracts } from '../token-registry-v5';
|
|
9
|
+
import { SUPPORTED_CHAINS } from '@tradetrust-tt/tradetrust-utils';
|
|
10
|
+
|
|
1
11
|
var __defProp = Object.defineProperty;
|
|
2
12
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
13
|
class DocumentBuilder {
|
|
@@ -5,8 +15,149 @@ class DocumentBuilder {
|
|
|
5
15
|
__name(this, "DocumentBuilder");
|
|
6
16
|
}
|
|
7
17
|
document;
|
|
8
|
-
|
|
9
|
-
|
|
18
|
+
// Holds the document to be built and signed.
|
|
19
|
+
documentType = "w3c";
|
|
20
|
+
// Default to W3C
|
|
21
|
+
selectedStatusType = null;
|
|
22
|
+
// Tracks selected status type.
|
|
23
|
+
statusConfig = {};
|
|
24
|
+
// Configuration for the credential status.
|
|
25
|
+
rpcProviderUrl;
|
|
26
|
+
// Holds the RPC provider URL for verifying token registry.
|
|
27
|
+
requiredFields = ["credentialSubject"];
|
|
28
|
+
// Required fields that must be present in the document.
|
|
29
|
+
/**
|
|
30
|
+
* Constructor to initialize the document builder.
|
|
31
|
+
* @param {Partial<VerifiableCredential>} input - The input document.
|
|
32
|
+
* @param {string} [documentType] - The type of the document (default is "w3c").
|
|
33
|
+
*/
|
|
34
|
+
constructor(input, documentType = "w3c") {
|
|
35
|
+
this.validateRequiredFields(input);
|
|
36
|
+
this.document = this.initializeDocument(input);
|
|
37
|
+
this.documentType = documentType;
|
|
38
|
+
}
|
|
39
|
+
// Public method to configure the document for transferable records. Sets up the token network and token registry.
|
|
40
|
+
transferableRecords(config) {
|
|
41
|
+
if (this.selectedStatusType) {
|
|
42
|
+
throw new Error(
|
|
43
|
+
"Configuration Error: You can only call either .transferableRecords() or .verifiableDocument(), not both."
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
this.selectedStatusType = "transferableRecords";
|
|
47
|
+
this.addContext("https://trustvc.io/context/transferable-records-context.json");
|
|
48
|
+
this.statusConfig = {
|
|
49
|
+
type: "TransferableRecords",
|
|
50
|
+
tokenNetwork: { chain: config.chain, chainId: config.chainId },
|
|
51
|
+
tokenRegistry: config.tokenRegistry
|
|
52
|
+
};
|
|
53
|
+
this.rpcProviderUrl = config.rpcProviderUrl;
|
|
54
|
+
return this;
|
|
55
|
+
}
|
|
56
|
+
// Public method to configure the document for verifiable credentials. Sets up the status list and revocation information.
|
|
57
|
+
verifiableDocument(config) {
|
|
58
|
+
if (this.selectedStatusType) {
|
|
59
|
+
throw new Error(
|
|
60
|
+
"Configuration Error: You can only call either .transferableRecords() or .verifiableDocument(), not both."
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
this.selectedStatusType = "verifiableDocument";
|
|
64
|
+
this.addContext("https://w3id.org/vc/status-list/2021/v1");
|
|
65
|
+
this.statusConfig = {
|
|
66
|
+
id: `${config.url}#${config.index}`,
|
|
67
|
+
type: "StatusList2021Entry",
|
|
68
|
+
statusPurpose: config.purpose || "revocation",
|
|
69
|
+
// Set status purpose to "revocation" by default.
|
|
70
|
+
statusListIndex: config.index,
|
|
71
|
+
statusListCredential: config.url
|
|
72
|
+
};
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
// Public method to sign the document using the provided private key and an optional cryptographic suite.
|
|
76
|
+
async sign(privateKey, cryptoSuite) {
|
|
77
|
+
if (this.selectedStatusType) {
|
|
78
|
+
this.document.credentialStatus = this.statusConfig;
|
|
79
|
+
}
|
|
80
|
+
if (this.selectedStatusType === "verifiableDocument") {
|
|
81
|
+
assertCredentialStatus(this.document.credentialStatus);
|
|
82
|
+
const verificationResult = await verifyCredentialStatus(this.document.credentialStatus);
|
|
83
|
+
if (verificationResult.error)
|
|
84
|
+
throw new Error(`Credential Verification Failed: ${verificationResult.error}`);
|
|
85
|
+
if (verificationResult.status)
|
|
86
|
+
throw new Error("Credential Verification Failed: Invalid credential status detected.");
|
|
87
|
+
} else if (this.selectedStatusType === "transferableRecords") {
|
|
88
|
+
assertTransferableRecords(this.document.credentialStatus, "sign");
|
|
89
|
+
await this.verifyTokenRegistry();
|
|
90
|
+
}
|
|
91
|
+
this.document.issuer = privateKey.id.split("#")[0];
|
|
92
|
+
this.document.issuanceDate = this.document.issuanceDate || (/* @__PURE__ */ new Date()).toISOString();
|
|
93
|
+
this.addContext("https://w3id.org/security/bbs/v1");
|
|
94
|
+
const signedVC = await signW3C(this.document, privateKey, cryptoSuite);
|
|
95
|
+
if (signedVC.error) throw new Error(`Signing Error: ${signedVC.error}`);
|
|
96
|
+
return signedVC.signed;
|
|
97
|
+
}
|
|
98
|
+
// Private helper method to validate that the required fields are present in the input document.
|
|
99
|
+
validateRequiredFields(input) {
|
|
100
|
+
this.requiredFields.forEach((field) => {
|
|
101
|
+
if (!input[field]) {
|
|
102
|
+
throw new Error(`Validation Error: Missing required field "${field}" in the credential.`);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
// Private helper method to initialize the document with required context and type, adding the necessary context URL.
|
|
107
|
+
initializeDocument(input) {
|
|
108
|
+
return {
|
|
109
|
+
...input,
|
|
110
|
+
"@context": this.buildContext(input["@context"]),
|
|
111
|
+
type: Array.from(new Set([].concat(input.type || [], "VerifiableCredential")))
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
// Private helper method to build the context for the document, ensuring uniqueness and adding the default W3C context.
|
|
115
|
+
buildContext(context) {
|
|
116
|
+
return [
|
|
117
|
+
"https://www.w3.org/2018/credentials/v1",
|
|
118
|
+
...Array.isArray(context) ? context : context ? [context] : []
|
|
119
|
+
].filter((v, i, a) => a.indexOf(v) === i);
|
|
120
|
+
}
|
|
121
|
+
// Private helper method to add a new context to the document if it does not already exist.
|
|
122
|
+
addContext(context) {
|
|
123
|
+
if (!this.document["@context"].includes(context)) {
|
|
124
|
+
this.document["@context"].push(context);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
// Private helper method to verify that the token registry supports the required interface for transferable records.
|
|
128
|
+
async verifyTokenRegistry() {
|
|
129
|
+
const chainId = this.document.credentialStatus.tokenNetwork.chainId;
|
|
130
|
+
if (!(chainId in SUPPORTED_CHAINS)) {
|
|
131
|
+
throw new Error(`Unsupported Chain: Chain ID ${chainId} is not supported.`);
|
|
132
|
+
}
|
|
133
|
+
try {
|
|
134
|
+
const provider = new ethers.providers.JsonRpcProvider(this.rpcProviderUrl);
|
|
135
|
+
const isV4Supported = await this.supportsInterface(
|
|
136
|
+
v4Contracts.TradeTrustToken__factory,
|
|
137
|
+
constants.contractInterfaceId.TradeTrustTokenMintable,
|
|
138
|
+
provider
|
|
139
|
+
);
|
|
140
|
+
const isV5Supported = await this.supportsInterface(
|
|
141
|
+
v5Contracts.TradeTrustToken__factory,
|
|
142
|
+
constants$1.contractInterfaceId.TradeTrustTokenMintable,
|
|
143
|
+
provider
|
|
144
|
+
);
|
|
145
|
+
if (!isV4Supported && !isV5Supported)
|
|
146
|
+
throw new Error("Token registry version is not supported.");
|
|
147
|
+
} catch (error) {
|
|
148
|
+
if (error.message === "Token registry version is not supported.") {
|
|
149
|
+
throw error;
|
|
150
|
+
} else {
|
|
151
|
+
throw new Error(
|
|
152
|
+
`Network Error: Unable to verify token registry. Please check the RPC URL or token registry address.`
|
|
153
|
+
);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// Private helper method to check if a contract supports a specific interface ID.
|
|
158
|
+
async supportsInterface(contractFactory, interfaceId, provider) {
|
|
159
|
+
const contract = contractFactory.connect(this.statusConfig.tokenRegistry, provider);
|
|
160
|
+
return contract.supportsInterface(interfaceId);
|
|
10
161
|
}
|
|
11
162
|
}
|
|
12
163
|
|
package/dist/esm/core/index.js
CHANGED
|
@@ -1,6 +1,35 @@
|
|
|
1
|
+
import * as _trustvc_w3c_vc from '@trustvc/w3c-vc';
|
|
2
|
+
import { VerifiableCredential } from '@trustvc/w3c-vc';
|
|
3
|
+
import { PrivateKeyPair } from '@trustvc/w3c-issuer';
|
|
4
|
+
|
|
5
|
+
interface W3CVerifiableDocumentConfig {
|
|
6
|
+
url: string;
|
|
7
|
+
index: number;
|
|
8
|
+
purpose?: string;
|
|
9
|
+
}
|
|
10
|
+
interface W3CTransferableRecordsConfig {
|
|
11
|
+
chain: string;
|
|
12
|
+
chainId: number;
|
|
13
|
+
tokenRegistry: string;
|
|
14
|
+
rpcProviderUrl: string;
|
|
15
|
+
}
|
|
1
16
|
declare class DocumentBuilder {
|
|
2
|
-
document
|
|
3
|
-
|
|
17
|
+
private document;
|
|
18
|
+
private documentType;
|
|
19
|
+
private selectedStatusType;
|
|
20
|
+
private statusConfig;
|
|
21
|
+
private rpcProviderUrl;
|
|
22
|
+
private requiredFields;
|
|
23
|
+
constructor(input: Partial<VerifiableCredential>, documentType?: string);
|
|
24
|
+
transferableRecords(config: W3CTransferableRecordsConfig): this;
|
|
25
|
+
verifiableDocument(config: W3CVerifiableDocumentConfig): this;
|
|
26
|
+
sign(privateKey: PrivateKeyPair, cryptoSuite?: string): Promise<_trustvc_w3c_vc.SignedVerifiableCredential>;
|
|
27
|
+
private validateRequiredFields;
|
|
28
|
+
private initializeDocument;
|
|
29
|
+
private buildContext;
|
|
30
|
+
private addContext;
|
|
31
|
+
private verifyTokenRegistry;
|
|
32
|
+
private supportsInterface;
|
|
4
33
|
}
|
|
5
34
|
|
|
6
|
-
export { DocumentBuilder };
|
|
35
|
+
export { DocumentBuilder, type W3CTransferableRecordsConfig, type W3CVerifiableDocumentConfig };
|
|
@@ -7,9 +7,11 @@ export { fetchEventTime, mergeTransfersV4, mergeTransfersV5, sortLogChain } from
|
|
|
7
7
|
export { getEndorsementChain } from './endorsement-chain/retrieveEndorsementChain.js';
|
|
8
8
|
export { EndorsementChain, ParsedLog, TitleEscrowTransferEvent, TitleEscrowTransferEventType, TokenTransferEvent, TokenTransferEventType, TradeTrustTokenEventType, TransferBaseEvent, TransferEvent, TransferEventType, TypedEvent } from './endorsement-chain/types.js';
|
|
9
9
|
export { TitleEscrowInterface, fetchEndorsementChain, getTitleEscrowAddress, isTitleEscrowVersion } from './endorsement-chain/useEndorsementChain.js';
|
|
10
|
+
export { DocumentBuilder, W3CTransferableRecordsConfig, W3CVerifiableDocumentConfig } from './documentBuilder.js';
|
|
10
11
|
import '@trustvc/w3c-vc';
|
|
11
12
|
import '@tradetrust-tt/tt-verify/dist/types/src/types/core';
|
|
12
13
|
import 'ethersV6';
|
|
13
14
|
import '@ethersproject/abstract-provider';
|
|
14
15
|
import 'ethers';
|
|
15
16
|
import 'ethers/lib/utils';
|
|
17
|
+
import '@trustvc/w3c-issuer';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _trustvc_w3c_vc from '@trustvc/w3c-vc';
|
|
2
2
|
|
|
3
3
|
function _mergeNamespaces(n, m) {
|
|
4
4
|
m.forEach(function (e) {
|
|
@@ -17,6 +17,6 @@ function _mergeNamespaces(n, m) {
|
|
|
17
17
|
|
|
18
18
|
var index = /*#__PURE__*/_mergeNamespaces({
|
|
19
19
|
__proto__: null
|
|
20
|
-
}, [
|
|
20
|
+
}, [_trustvc_w3c_vc]);
|
|
21
21
|
|
|
22
22
|
export { index as i };
|
package/dist/types/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export { fetchEventTime, mergeTransfersV4, mergeTransfersV5, sortLogChain } from
|
|
|
19
19
|
export { getEndorsementChain } from './core/endorsement-chain/retrieveEndorsementChain.js';
|
|
20
20
|
export { EndorsementChain, ParsedLog, TitleEscrowTransferEvent, TitleEscrowTransferEventType, TokenTransferEvent, TokenTransferEventType, TradeTrustTokenEventType, TransferBaseEvent, TransferEvent, TransferEventType, TypedEvent } from './core/endorsement-chain/types.js';
|
|
21
21
|
export { TitleEscrowInterface, fetchEndorsementChain, getTitleEscrowAddress, isTitleEscrowVersion } from './core/endorsement-chain/useEndorsementChain.js';
|
|
22
|
+
export { DocumentBuilder, W3CTransferableRecordsConfig, W3CVerifiableDocumentConfig } from './core/documentBuilder.js';
|
|
22
23
|
export { signOA } from './open-attestation/sign.js';
|
|
23
24
|
export { KeyPair } from './open-attestation/types.js';
|
|
24
25
|
export { diagnose, getAssetId, getDocumentData, getIssuerAddress, getTemplateURL, isObfuscated, isRawV2Document, isRawV3Document, isSignedWrappedV2Document, isSignedWrappedV3Document, isTransferableAsset, isWrappedV2Document, isWrappedV3Document } from './open-attestation/utils.js';
|
|
@@ -32,7 +33,7 @@ export { i as isser } from './index-ClF4_Nqk.js';
|
|
|
32
33
|
export { signW3C } from './w3c/sign.js';
|
|
33
34
|
export { RawVerifiableCredential, SignedVerifiableCredential, SigningResult, VerificationResult } from '@trustvc/w3c-vc';
|
|
34
35
|
export { PrivateKeyPair } from '@trustvc/w3c-issuer';
|
|
35
|
-
export { i as vc } from './index-
|
|
36
|
+
export { i as vc } from './index-Bc5NlE8f.js';
|
|
36
37
|
export { verifyW3CSignature } from './w3c/verify.js';
|
|
37
38
|
export { errorMessageHandling, CONSTANTS as errorMessages, interpretFragments } from '@tradetrust-tt/tradetrust-utils';
|
|
38
39
|
export * from '@tradetrust-tt/tradetrust-utils/constants/network';
|
|
@@ -4,7 +4,7 @@ export { i as isser } from '../index-ClF4_Nqk.js';
|
|
|
4
4
|
export { signW3C } from './sign.js';
|
|
5
5
|
export { RawVerifiableCredential, SignedVerifiableCredential, SigningResult, VerificationResult } from '@trustvc/w3c-vc';
|
|
6
6
|
export { PrivateKeyPair } from '@trustvc/w3c-issuer';
|
|
7
|
-
export { i as vc } from '../index-
|
|
7
|
+
export { i as vc } from '../index-Bc5NlE8f.js';
|
|
8
8
|
export { verifyW3CSignature } from './verify.js';
|
|
9
9
|
import '@trustvc/w3c-context';
|
|
10
10
|
import '@trustvc/w3c-credential-status';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trustvc/trustvc",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "TrustVC library",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"@tradetrust-tt/token-registry-v4": "npm:@tradetrust-tt/token-registry@^4.15.2",
|
|
115
115
|
"@tradetrust-tt/token-registry-v5": "npm:@tradetrust-tt/token-registry@^5.1.4",
|
|
116
116
|
"@tradetrust-tt/tradetrust": "^6.10.1",
|
|
117
|
-
"@tradetrust-tt/tradetrust-utils": "^2.2.
|
|
117
|
+
"@tradetrust-tt/tradetrust-utils": "^2.2.1",
|
|
118
118
|
"@tradetrust-tt/tt-verify": "^9.3.1",
|
|
119
119
|
"@trustvc/w3c-context": "^1.2.1",
|
|
120
120
|
"@trustvc/w3c-credential-status": "^1.2.1",
|