@trustvc/trustvc 1.6.0-alpha.3 → 1.6.0-alpha.5
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 +2 -2
- package/dist/cjs/core/endorsement-chain/useEndorsementChain.js +6 -6
- 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/esm/core/documentBuilder.js +1 -1
- package/dist/esm/core/endorsement-chain/useEndorsementChain.js +6 -6
- 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/types/core/documentBuilder.d.ts +2 -2
- package/dist/types/core/endorsement-chain/useEndorsementChain.d.ts +1 -1
- package/dist/types/{index-CRVFHzes.d.ts → index-LpXMEhhr.d.ts} +3 -1
- package/dist/types/index.d.ts +7 -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/sign.d.ts +3 -3
- package/package.json +11 -10
|
@@ -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 {
|
|
@@ -120,19 +120,19 @@ const isTitleEscrowVersion = /* @__PURE__ */ __name(async ({
|
|
|
120
120
|
return false;
|
|
121
121
|
}
|
|
122
122
|
}, "isTitleEscrowVersion");
|
|
123
|
-
const fetchEndorsementChain = /* @__PURE__ */ __name(async (tokenRegistryAddress, tokenId, provider, keyId) => {
|
|
123
|
+
const fetchEndorsementChain = /* @__PURE__ */ __name(async (tokenRegistryAddress, tokenId, provider, keyId, titleEscrowAddress) => {
|
|
124
124
|
if (!tokenRegistryAddress || !tokenId || !provider) {
|
|
125
125
|
throw new Error("Missing required dependencies");
|
|
126
126
|
}
|
|
127
|
-
const
|
|
127
|
+
const resolvedTitleEscrowAddress = titleEscrowAddress ?? await getTitleEscrowAddress(tokenRegistryAddress, tokenId, provider);
|
|
128
128
|
const [isV4, isV5] = await Promise.all([
|
|
129
129
|
isTitleEscrowVersion({
|
|
130
|
-
titleEscrowAddress,
|
|
130
|
+
titleEscrowAddress: resolvedTitleEscrowAddress,
|
|
131
131
|
versionInterface: TitleEscrowInterface.V4,
|
|
132
132
|
provider
|
|
133
133
|
}),
|
|
134
134
|
isTitleEscrowVersion({
|
|
135
|
-
titleEscrowAddress,
|
|
135
|
+
titleEscrowAddress: resolvedTitleEscrowAddress,
|
|
136
136
|
versionInterface: TitleEscrowInterface.V5,
|
|
137
137
|
provider
|
|
138
138
|
})
|
|
@@ -144,13 +144,13 @@ const fetchEndorsementChain = /* @__PURE__ */ __name(async (tokenRegistryAddress
|
|
|
144
144
|
if (isV4) {
|
|
145
145
|
const [tokenLogs, titleEscrowLogs] = await Promise.all([
|
|
146
146
|
fetchTokenTransfer.fetchTokenTransfers(provider, tokenRegistryAddress, tokenId),
|
|
147
|
-
fetchEscrowTransfer.fetchEscrowTransfersV4(provider,
|
|
147
|
+
fetchEscrowTransfer.fetchEscrowTransfersV4(provider, resolvedTitleEscrowAddress)
|
|
148
148
|
]);
|
|
149
149
|
transferEvents = helpers.mergeTransfersV4([...titleEscrowLogs, ...tokenLogs]);
|
|
150
150
|
} else if (isV5) {
|
|
151
151
|
const titleEscrowLogs = await fetchEscrowTransfer.fetchEscrowTransfersV5(
|
|
152
152
|
provider,
|
|
153
|
-
|
|
153
|
+
resolvedTitleEscrowAddress,
|
|
154
154
|
tokenRegistryAddress
|
|
155
155
|
);
|
|
156
156
|
transferEvents = helpers.mergeTransfersV5(titleEscrowLogs);
|
|
@@ -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,
|
|
@@ -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 });
|
|
@@ -118,19 +118,19 @@ const isTitleEscrowVersion = /* @__PURE__ */ __name(async ({
|
|
|
118
118
|
return false;
|
|
119
119
|
}
|
|
120
120
|
}, "isTitleEscrowVersion");
|
|
121
|
-
const fetchEndorsementChain = /* @__PURE__ */ __name(async (tokenRegistryAddress, tokenId, provider, keyId) => {
|
|
121
|
+
const fetchEndorsementChain = /* @__PURE__ */ __name(async (tokenRegistryAddress, tokenId, provider, keyId, titleEscrowAddress) => {
|
|
122
122
|
if (!tokenRegistryAddress || !tokenId || !provider) {
|
|
123
123
|
throw new Error("Missing required dependencies");
|
|
124
124
|
}
|
|
125
|
-
const
|
|
125
|
+
const resolvedTitleEscrowAddress = titleEscrowAddress ?? await getTitleEscrowAddress(tokenRegistryAddress, tokenId, provider);
|
|
126
126
|
const [isV4, isV5] = await Promise.all([
|
|
127
127
|
isTitleEscrowVersion({
|
|
128
|
-
titleEscrowAddress,
|
|
128
|
+
titleEscrowAddress: resolvedTitleEscrowAddress,
|
|
129
129
|
versionInterface: TitleEscrowInterface.V4,
|
|
130
130
|
provider
|
|
131
131
|
}),
|
|
132
132
|
isTitleEscrowVersion({
|
|
133
|
-
titleEscrowAddress,
|
|
133
|
+
titleEscrowAddress: resolvedTitleEscrowAddress,
|
|
134
134
|
versionInterface: TitleEscrowInterface.V5,
|
|
135
135
|
provider
|
|
136
136
|
})
|
|
@@ -142,13 +142,13 @@ const fetchEndorsementChain = /* @__PURE__ */ __name(async (tokenRegistryAddress
|
|
|
142
142
|
if (isV4) {
|
|
143
143
|
const [tokenLogs, titleEscrowLogs] = await Promise.all([
|
|
144
144
|
fetchTokenTransfers(provider, tokenRegistryAddress, tokenId),
|
|
145
|
-
fetchEscrowTransfersV4(provider,
|
|
145
|
+
fetchEscrowTransfersV4(provider, resolvedTitleEscrowAddress)
|
|
146
146
|
]);
|
|
147
147
|
transferEvents = mergeTransfersV4([...titleEscrowLogs, ...tokenLogs]);
|
|
148
148
|
} else if (isV5) {
|
|
149
149
|
const titleEscrowLogs = await fetchEscrowTransfersV5(
|
|
150
150
|
provider,
|
|
151
|
-
|
|
151
|
+
resolvedTitleEscrowAddress,
|
|
152
152
|
tokenRegistryAddress
|
|
153
153
|
);
|
|
154
154
|
transferEvents = mergeTransfersV5(titleEscrowLogs);
|
|
@@ -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,
|
|
@@ -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;
|
|
@@ -26,6 +26,6 @@ interface TitleEscrowVersionParams {
|
|
|
26
26
|
* @returns {Promise<boolean>} - return true if titleEscrow matches supportInterface
|
|
27
27
|
*/
|
|
28
28
|
declare const isTitleEscrowVersion: ({ tokenRegistryAddress, tokenId, titleEscrowAddress, versionInterface, provider, }: TitleEscrowVersionParams) => Promise<boolean>;
|
|
29
|
-
declare const fetchEndorsementChain: (tokenRegistryAddress: string, tokenId: string, provider: Provider | ethers.Provider, keyId?: string) => Promise<EndorsementChain>;
|
|
29
|
+
declare const fetchEndorsementChain: (tokenRegistryAddress: string, tokenId: string, provider: Provider | ethers.Provider, keyId?: string, titleEscrowAddress?: string) => Promise<EndorsementChain>;
|
|
30
30
|
|
|
31
31
|
export { TitleEscrowInterface, checkSupportsInterface, fetchEndorsementChain, getDocumentOwner, getTitleEscrowAddress, isTitleEscrowVersion };
|
|
@@ -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';
|
|
@@ -44,14 +44,16 @@ export { errorMessageHandling, w3cCredentialStatusRevoked, w3cCredentialStatusSu
|
|
|
44
44
|
export * from '@tradetrust-tt/tradetrust-utils/constants/network';
|
|
45
45
|
export { generate12ByteNonce, generate32ByteKey, stringToUint8Array } from './utils/stringUtils/index.js';
|
|
46
46
|
export * from '@tradetrust-tt/tradetrust-utils/constants/supportedChains';
|
|
47
|
-
export {
|
|
48
|
-
export { WrappedOrSignedOpenAttestationDocument, getChainId, getTokenId, getTokenRegistryAddress, getTransferableRecordsCredentialStatus, isTransferableRecord } from './utils/documents/index.js';
|
|
47
|
+
export { errorMessages } from './utils/errorMessages/index.js';
|
|
48
|
+
export { WrappedOrSignedOpenAttestationDocument, getChainId, getObfuscatedData, getTokenId, getTokenRegistryAddress, getTransferableRecordsCredentialStatus, isObfuscated, isTransferableRecord } from './utils/documents/index.js';
|
|
49
|
+
export { GasStationFeeData, GasStationFunction, calculateMaxFee, gasStation, interpretFragments, scaleBigNumber } from '@tradetrust-tt/tradetrust-utils';
|
|
49
50
|
export { AwsKmsSigner, AwsKmsSignerCredentials } from '@tradetrust-tt/ethers-aws-kms-signer';
|
|
50
51
|
export { CustomDnsResolver, IDNSQueryResponse, IDNSRecord, OpenAttestationDNSTextRecord, OpenAttestationDnsDidRecord, defaultDnsResolvers, getDnsDidRecords, getDocumentStoreRecords, parseDnsDidResults, parseDocumentStoreResults, parseOpenAttestationRecord, queryDns } from '@tradetrust-tt/dnsprove';
|
|
51
52
|
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
53
|
export { DiagnoseError } from '@tradetrust-tt/tradetrust/dist/types/shared/utils';
|
|
53
54
|
export { createResolver, getIdentifier, isValid, openAttestationDidIdentityProof, utils, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
|
|
54
55
|
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';
|
|
56
|
+
export { ErrorMessage, ErrorMessageTypes, ErrorMessages, MessagesDictionary } from './utils/errorMessages/types.js';
|
|
55
57
|
import '@tradetrust-tt/token-registry-v4/contracts';
|
|
56
58
|
import 'ethers';
|
|
57
59
|
import '@typechain/ethers-v5/static/common';
|
|
@@ -69,6 +71,7 @@ import '@tradetrust-tt/tradetrust/dist/types/__generated__/schema.2.0';
|
|
|
69
71
|
import '@tradetrust-tt/tradetrust/dist/types/shared/utils/@types/diagnose';
|
|
70
72
|
import './verify/fragments/document-status/transferableRecords/transferableRecordVerifier.types.js';
|
|
71
73
|
import './verify/fragments/document-integrity/w3cSignatureIntegrity.js';
|
|
74
|
+
import './verify/fragments/document-integrity/ecdsaW3CSignatureIntegrity.js';
|
|
72
75
|
import './verify/fragments/document-status/transferableRecords/transferableRecordVerifier.js';
|
|
73
76
|
import './verify/fragments/document-status/w3cCredentialStatus.js';
|
|
74
77
|
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';
|
package/dist/types/w3c/sign.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
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='BbsBlsSignature2020'] - The cryptographic suite to be used for signing (default is 'BbsBlsSignature2020').
|
|
9
9
|
* @returns {Promise<SigningResult>} A promise that resolves to the result of the signing operation, which includes the signed credential.
|
|
10
10
|
*/
|
|
11
|
-
declare const signW3C: (credential: RawVerifiableCredential, keyPair: PrivateKeyPair, cryptoSuite?:
|
|
11
|
+
declare const signW3C: (credential: RawVerifiableCredential, keyPair: PrivateKeyPair, cryptoSuite?: CryptoSuiteName) => Promise<SigningResult>;
|
|
12
12
|
|
|
13
13
|
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.5",
|
|
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.5",
|
|
125
|
+
"@trustvc/w3c-context": "^1.3.0-alpha.5",
|
|
126
|
+
"@trustvc/w3c-credential-status": "^1.3.0-alpha.5",
|
|
127
|
+
"@trustvc/w3c-issuer": "^1.3.0-alpha.5",
|
|
128
|
+
"@trustvc/w3c-vc": "^1.3.0-alpha.5",
|
|
128
129
|
"ethers": "^5.8.0",
|
|
129
130
|
"ethersV6": "npm:ethers@^6.14.4",
|
|
130
131
|
"js-sha3": "^0.9.3",
|