@trustvc/trustvc 1.0.3 → 1.0.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.
Files changed (67) hide show
  1. package/dist/esm/index.js +5 -2
  2. package/dist/esm/open-attestation/types.js +1 -1
  3. package/dist/esm/open-attestation/utils.js +3 -2
  4. package/dist/esm/token-registry-v4/contractAddress.js +5 -0
  5. package/dist/esm/token-registry-v4/index.js +2 -0
  6. package/dist/esm/token-registry-v4/roleHash.js +5 -0
  7. package/dist/esm/token-registry-v5/contractAddress.js +5 -0
  8. package/dist/esm/token-registry-v5/index.js +2 -0
  9. package/dist/esm/token-registry-v5/roleHash.js +5 -0
  10. package/dist/esm/token-registry-v5/typedContractMethod.js +1 -0
  11. package/dist/esm/utils/errorMessages/index.js +1 -0
  12. package/dist/esm/utils/index.js +1 -0
  13. package/dist/esm/verify/fragments/document-status/transferableRecords/transferableRecordVerifier.js +33 -30
  14. package/dist/esm/verify/fragments/document-status/w3cCredentialStatus.js +20 -10
  15. package/dist/esm/verify/verify.js +1 -1
  16. package/dist/index.d.mts +13 -8
  17. package/dist/index.d.ts +13 -8
  18. package/dist/index.js +25 -2
  19. package/dist/open-attestation/index.d.mts +1 -1
  20. package/dist/open-attestation/index.d.ts +1 -1
  21. package/dist/open-attestation/types.js +12 -0
  22. package/dist/open-attestation/utils.d.mts +2 -1
  23. package/dist/open-attestation/utils.d.ts +2 -1
  24. package/dist/open-attestation/utils.js +3 -1
  25. package/dist/token-registry-v4/contractAddress.d.mts +13 -0
  26. package/dist/token-registry-v4/contractAddress.d.ts +13 -0
  27. package/dist/token-registry-v4/contractAddress.js +7 -0
  28. package/dist/token-registry-v4/index.d.mts +2 -0
  29. package/dist/token-registry-v4/index.d.ts +2 -0
  30. package/dist/token-registry-v4/index.js +14 -4
  31. package/dist/token-registry-v4/roleHash.d.mts +11 -0
  32. package/dist/token-registry-v4/roleHash.d.ts +11 -0
  33. package/dist/token-registry-v4/roleHash.js +7 -0
  34. package/dist/token-registry-v5/contractAddress.d.mts +13 -0
  35. package/dist/token-registry-v5/contractAddress.d.ts +13 -0
  36. package/dist/token-registry-v5/contractAddress.js +7 -0
  37. package/dist/token-registry-v5/index.d.mts +2 -0
  38. package/dist/token-registry-v5/index.d.ts +2 -0
  39. package/dist/token-registry-v5/index.js +14 -4
  40. package/dist/token-registry-v5/roleHash.d.mts +11 -0
  41. package/dist/token-registry-v5/roleHash.d.ts +11 -0
  42. package/dist/token-registry-v5/roleHash.js +7 -0
  43. package/dist/token-registry-v5/typedContractMethod.d.mts +9 -0
  44. package/dist/token-registry-v5/typedContractMethod.d.ts +9 -0
  45. package/dist/token-registry-v5/typedContractMethod.js +10 -0
  46. package/dist/utils/errorMessages/index.d.mts +1 -0
  47. package/dist/utils/errorMessages/index.d.ts +1 -0
  48. package/dist/utils/errorMessages/index.js +10 -0
  49. package/dist/utils/index.d.mts +1 -1
  50. package/dist/utils/index.d.ts +1 -1
  51. package/dist/utils/index.js +7 -0
  52. package/dist/verify/fragments/document-status/transferableRecords/transferableRecordVerifier.js +33 -30
  53. package/dist/verify/fragments/document-status/transferableRecords/transferableRecordVerifier.types.d.mts +1 -9
  54. package/dist/verify/fragments/document-status/transferableRecords/transferableRecordVerifier.types.d.ts +1 -9
  55. package/dist/verify/fragments/document-status/w3cCredentialStatus.js +19 -9
  56. package/dist/verify/index.d.mts +2 -2
  57. package/dist/verify/index.d.ts +2 -2
  58. package/dist/verify/verify.d.mts +2 -2
  59. package/dist/verify/verify.d.ts +2 -2
  60. package/dist/verify/verify.js +4 -0
  61. package/dist/w3c/types.d.mts +0 -6
  62. package/dist/w3c/types.d.ts +0 -6
  63. package/package.json +7 -7
  64. package/dist/contracts-BsBT1cT2.d.mts +0 -22
  65. package/dist/contracts-BsBT1cT2.d.ts +0 -22
  66. package/dist/contracts-Cbud3a4b.d.mts +0 -22
  67. package/dist/contracts-Cbud3a4b.d.ts +0 -22
package/dist/esm/index.js CHANGED
@@ -1,9 +1,12 @@
1
1
  export { supportInterfaceIds as v4SupportInterfaceIds } from './token-registry-v4/supportInterfaceIds';
2
2
  export { supportInterfaceIds as v5SupportInterfaceIds } from './token-registry-v5/supportInterfaceIds';
3
- import * as contracts from './token-registry-v4/contracts';
3
+ export { v4ContractAddress, v4RoleHash } from './token-registry-v4';
4
+ export { v5ContractAddress, v5RoleHash } from './token-registry-v5';
5
+ import * as contracts from '@tradetrust-tt/token-registry-v4/contracts';
4
6
  export { contracts as v4Contracts };
5
- import * as contracts$1 from './token-registry-v5/contracts';
7
+ import * as contracts$1 from '@tradetrust-tt/token-registry-v5/contracts';
6
8
  export { contracts$1 as v5Contracts };
9
+ export { TypedContractMethod } from './token-registry-v5/typedContractMethod';
7
10
  export * from './core';
8
11
  export * from './open-attestation';
9
12
  export * from './verify';
@@ -1 +1 @@
1
-
1
+ export { v2, v3 } from '@tradetrust-tt/tradetrust';
@@ -13,7 +13,8 @@ const {
13
13
  isObfuscated,
14
14
  getDocumentData,
15
15
  getIssuerAddress,
16
- diagnose
16
+ diagnose,
17
+ getTemplateURL
17
18
  } = utils;
18
19
 
19
- export { diagnose, getAssetId, getDocumentData, getIssuerAddress, isObfuscated, isRawV2Document, isRawV3Document, isSignedWrappedV2Document, isSignedWrappedV3Document, isTransferableAsset, isWrappedV2Document, isWrappedV3Document };
20
+ export { diagnose, getAssetId, getDocumentData, getIssuerAddress, getTemplateURL, isObfuscated, isRawV2Document, isRawV3Document, isSignedWrappedV2Document, isSignedWrappedV3Document, isTransferableAsset, isWrappedV2Document, isWrappedV3Document };
@@ -0,0 +1,5 @@
1
+ import { constants } from '@tradetrust-tt/token-registry-v4';
2
+
3
+ const contractAddress = constants.contractAddress;
4
+
5
+ export { contractAddress };
@@ -1 +1,3 @@
1
+ export { roleHash as v4RoleHash } from './roleHash';
2
+ export { contractAddress as v4ContractAddress } from './contractAddress';
1
3
  export * from '@tradetrust-tt/token-registry-v4';
@@ -0,0 +1,5 @@
1
+ import { constants } from '@tradetrust-tt/token-registry-v4';
2
+
3
+ const roleHash = constants.roleHash;
4
+
5
+ export { roleHash };
@@ -0,0 +1,5 @@
1
+ import { constants } from '@tradetrust-tt/token-registry-v5';
2
+
3
+ const contractAddress = constants.contractAddress;
4
+
5
+ export { contractAddress };
@@ -1 +1,3 @@
1
+ export { roleHash as v5RoleHash } from './roleHash';
2
+ export { contractAddress as v5ContractAddress } from './contractAddress';
1
3
  export * from '@tradetrust-tt/token-registry-v5';
@@ -0,0 +1,5 @@
1
+ import { constants } from '@tradetrust-tt/token-registry-v5';
2
+
3
+ const roleHash = constants.roleHash;
4
+
5
+ export { roleHash };
@@ -0,0 +1 @@
1
+ export { TypedContractMethod } from '@tradetrust-tt/token-registry-v5/dist/contracts/common';
@@ -0,0 +1 @@
1
+ export { CONSTANTS as errorMessages } from '@tradetrust-tt/tradetrust-utils';
@@ -2,3 +2,4 @@ export * from './fragment';
2
2
  export * from './network';
3
3
  export * from './stringUtils';
4
4
  export * from './supportedChains';
5
+ export * from './errorMessages';
@@ -8,45 +8,46 @@ const TRANSFERABLE_RECORDS_TYPE = "TransferableRecords";
8
8
  const type = "DOCUMENT_STATUS";
9
9
  const name = TRANSFERABLE_RECORDS_TYPE;
10
10
  const verify = /* @__PURE__ */ __name(async (document, options) => {
11
- let signedDocument;
12
- let tokenId;
13
- if (w3cVC.isSignedDocument(document)) {
14
- signedDocument = document;
15
- tokenId = "0x" + signedDocument?.credentialStatus?.tokenId;
16
- }
17
- const credentialStatus = signedDocument?.credentialStatus;
18
- if (!credentialStatus?.tokenRegistry) {
19
- throw new CodedError(
20
- "Document's credentialStatus does not have tokenRegistry",
21
- OpenAttestationEthereumTokenRegistryStatusCode.UNRECOGNIZED_DOCUMENT,
22
- OpenAttestationEthereumTokenRegistryStatusCode[OpenAttestationEthereumTokenRegistryStatusCode.UNRECOGNIZED_DOCUMENT]
23
- );
24
- }
25
- if (!credentialStatus?.tokenNetwork || !credentialStatus?.tokenNetwork?.chainId) {
26
- throw new CodedError(
27
- "Document's credentialStatus does not have tokenNetwork.chainId",
28
- OpenAttestationEthereumTokenRegistryStatusCode.UNRECOGNIZED_DOCUMENT,
29
- OpenAttestationEthereumTokenRegistryStatusCode[OpenAttestationEthereumTokenRegistryStatusCode.UNRECOGNIZED_DOCUMENT]
30
- );
31
- }
11
+ const signedDocument = document;
12
+ const credentialStatuses = Array.isArray(signedDocument?.credentialStatus) ? signedDocument?.credentialStatus : [signedDocument?.credentialStatus];
32
13
  const { provider } = options;
33
- const mintStatus = await isTokenMintedOnRegistry({
34
- tokenRegistryAddress: credentialStatus?.tokenRegistry,
35
- tokenId,
36
- provider
37
- });
14
+ const verificationResult = await Promise.all(
15
+ credentialStatuses.map(async (credentialStatus) => {
16
+ const tokenId = "0x" + credentialStatus.tokenId;
17
+ if (!credentialStatus?.tokenRegistry) {
18
+ throw new CodedError(
19
+ "Document's credentialStatus does not have tokenRegistry",
20
+ OpenAttestationEthereumTokenRegistryStatusCode.UNRECOGNIZED_DOCUMENT,
21
+ OpenAttestationEthereumTokenRegistryStatusCode[OpenAttestationEthereumTokenRegistryStatusCode.UNRECOGNIZED_DOCUMENT]
22
+ );
23
+ }
24
+ if (!credentialStatus?.tokenNetwork || !credentialStatus?.tokenNetwork?.chainId) {
25
+ throw new CodedError(
26
+ "Document's credentialStatus does not have tokenNetwork.chainId",
27
+ OpenAttestationEthereumTokenRegistryStatusCode.UNRECOGNIZED_DOCUMENT,
28
+ OpenAttestationEthereumTokenRegistryStatusCode[OpenAttestationEthereumTokenRegistryStatusCode.UNRECOGNIZED_DOCUMENT]
29
+ );
30
+ }
31
+ const mintStatus = await isTokenMintedOnRegistry({
32
+ tokenRegistryAddress: credentialStatus?.tokenRegistry,
33
+ tokenId,
34
+ provider
35
+ });
36
+ return mintStatus;
37
+ })
38
+ );
38
39
  const result = {
39
40
  name,
40
41
  type,
41
42
  status: "INVALID",
42
43
  data: {
43
- tokenRegistry: credentialStatus.tokenRegistry
44
+ tokenRegistry: credentialStatuses?.[0]?.tokenRegistry
44
45
  }
45
46
  };
46
- if (ValidTokenRegistryStatus.guard(mintStatus)) {
47
+ if (verificationResult.every(ValidTokenRegistryStatus.guard)) {
47
48
  result.status = "VALID";
48
49
  } else {
49
- result.reason = mintStatus.reason;
50
+ result.reason = verificationResult?.[0]?.reason;
50
51
  }
51
52
  return result;
52
53
  }, "verify");
@@ -63,7 +64,9 @@ const skip = /* @__PURE__ */ __name(async () => {
63
64
  };
64
65
  }, "skip");
65
66
  const test = /* @__PURE__ */ __name((document) => {
66
- if (document?.credentialStatus?.type === TRANSFERABLE_RECORDS_TYPE) {
67
+ const doc = document;
68
+ const credentialStatuses = Array.isArray(doc?.credentialStatus) ? doc?.credentialStatus : [doc?.credentialStatus];
69
+ if (w3cVC.isSignedDocument(document) && credentialStatuses.every((cs) => cs?.type === TRANSFERABLE_RECORDS_TYPE)) {
67
70
  return true;
68
71
  }
69
72
  return false;
@@ -1,4 +1,4 @@
1
- import { verifyCredentialStatus } from '@trustvc/w3c-vc';
1
+ import { isSignedDocument, verifyCredentialStatus } from '@trustvc/w3c-vc';
2
2
 
3
3
  var __defProp = Object.defineProperty;
4
4
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
@@ -17,33 +17,43 @@ const w3cCredentialStatus = {
17
17
  }, "skip"),
18
18
  test: /* @__PURE__ */ __name((document) => {
19
19
  const doc = document;
20
- return doc.credentialStatus?.type === "StatusList2021Entry";
20
+ const credentialStatuses = Array.isArray(doc?.credentialStatus) ? doc?.credentialStatus : [doc?.credentialStatus];
21
+ const test = /* @__PURE__ */ __name((credentialStatus) => ["BitstringStatusListEntry", "StatusList2021Entry"].includes(credentialStatus?.type), "test");
22
+ if (isSignedDocument(document) && credentialStatuses.every(test)) {
23
+ return true;
24
+ } else {
25
+ return false;
26
+ }
21
27
  }, "test"),
22
28
  verify: /* @__PURE__ */ __name(async (document) => {
23
29
  const doc = document;
24
- const verificationResult = await verifyCredentialStatus(doc.credentialStatus);
25
- if (verificationResult.error) {
30
+ const credentialStatuses = Array.isArray(doc.credentialStatus) ? doc.credentialStatus : [doc.credentialStatus];
31
+ const verificationResult = await Promise.all(
32
+ credentialStatuses.map((cs) => verifyCredentialStatus(cs, cs?.type))
33
+ );
34
+ if (verificationResult.some((r) => r.error)) {
26
35
  return {
27
36
  type: "DOCUMENT_STATUS",
28
37
  name: "W3CCredentialStatus",
29
38
  reason: {
30
- message: verificationResult.error
39
+ message: verificationResult.map((r) => r.error).join(", ")
31
40
  },
41
+ data: verificationResult,
32
42
  status: "ERROR"
33
43
  };
34
- } else if (verificationResult.status === true) {
44
+ } else if (verificationResult.every((r) => r.status === false)) {
35
45
  return {
36
46
  type: "DOCUMENT_STATUS",
37
47
  name: "W3CCredentialStatus",
38
- data: false,
39
- status: "INVALID"
48
+ data: verificationResult,
49
+ status: "VALID"
40
50
  };
41
51
  } else {
42
52
  return {
43
53
  type: "DOCUMENT_STATUS",
44
54
  name: "W3CCredentialStatus",
45
- data: true,
46
- status: "VALID"
55
+ data: verificationResult,
56
+ status: "INVALID"
47
57
  };
48
58
  }
49
59
  }, "verify")
@@ -1,5 +1,5 @@
1
1
  import { openAttestationVerifiers as openAttestationVerifiers$1, openAttestationDidIdentityProof, openAttestationHash, openAttestationDidSignedDocumentStatus, openAttestationEthereumDocumentStoreStatus, openAttestationEthereumTokenRegistryStatus, openAttestationDnsDidIdentityProof, openAttestationDnsTxtIdentityProof } from '@tradetrust-tt/tt-verify';
2
- export { createResolver, getIdentifier, isValid, utils, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
2
+ export { createResolver, getIdentifier, isValid, openAttestationDidIdentityProof, utils, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
3
3
  import { w3cSignatureIntegrity } from './fragments/document-integrity/w3cSignatureIntegrity';
4
4
  import { credentialStatusTransferableRecordVerifier } from './fragments/document-status/transferableRecords/transferableRecordVerifier';
5
5
  import { w3cCredentialStatus } from './fragments/document-status/w3cCredentialStatus';
package/dist/index.d.mts CHANGED
@@ -1,13 +1,20 @@
1
1
  export { supportInterfaceIds as v4SupportInterfaceIds } from './token-registry-v4/supportInterfaceIds.mjs';
2
2
  export { supportInterfaceIds as v5SupportInterfaceIds } from './token-registry-v5/supportInterfaceIds.mjs';
3
- export { c as v4Contracts } from './contracts-BsBT1cT2.mjs';
4
- export { c as v5Contracts } from './contracts-Cbud3a4b.mjs';
3
+ export { roleHash as v4RoleHash } from './token-registry-v4/roleHash.mjs';
4
+ export { contractAddress as v4ContractAddress } from './token-registry-v4/contractAddress.mjs';
5
+ export { roleHash as v5RoleHash } from './token-registry-v5/roleHash.mjs';
6
+ export { contractAddress as v5ContractAddress } from './token-registry-v5/contractAddress.mjs';
7
+ import * as contracts from '@tradetrust-tt/token-registry-v4/contracts';
8
+ export { contracts as v4Contracts };
9
+ import * as contracts$1 from '@tradetrust-tt/token-registry-v5/contracts';
10
+ export { contracts$1 as v5Contracts };
11
+ export { TypedContractMethod } from '@tradetrust-tt/token-registry-v5/dist/contracts/common';
5
12
  export { decrypt } from './core/decrypt.mjs';
6
13
  export { encrypt } from './core/encrypt.mjs';
7
14
  export { verifyDocument } from './core/verify.mjs';
8
15
  export { signOA } from './open-attestation/sign.mjs';
9
16
  export { KeyPair } from './open-attestation/types.mjs';
10
- export { diagnose, getAssetId, getDocumentData, getIssuerAddress, isObfuscated, isRawV2Document, isRawV3Document, isSignedWrappedV2Document, isSignedWrappedV3Document, isTransferableAsset, isWrappedV2Document, isWrappedV3Document } from './open-attestation/utils.mjs';
17
+ export { diagnose, getAssetId, getDocumentData, getIssuerAddress, getTemplateURL, isObfuscated, isRawV2Document, isRawV3Document, isSignedWrappedV2Document, isSignedWrappedV3Document, isTransferableAsset, isWrappedV2Document, isWrappedV3Document } from './open-attestation/utils.mjs';
11
18
  export { verifyOASignature } from './open-attestation/verify.mjs';
12
19
  export { wrapOADocument, wrapOADocumentV2, wrapOADocuments, wrapOADocumentsV2 } from './open-attestation/wrap.mjs';
13
20
  export { openAttestationVerifiers, verifiers, w3cVerifiers } from './verify/verify.mjs';
@@ -20,17 +27,15 @@ export { RawVerifiableCredential, SignedVerifiableCredential, SigningResult, Ver
20
27
  export { PrivateKeyPair } from '@trustvc/w3c-issuer';
21
28
  export { i as vc } from './index-1ws_BWZW.mjs';
22
29
  export { verifyW3CSignature } from './w3c/verify.mjs';
23
- export { errorMessageHandling, interpretFragments } from '@tradetrust-tt/tradetrust-utils';
30
+ export { errorMessageHandling, CONSTANTS as errorMessages, interpretFragments } from '@tradetrust-tt/tradetrust-utils';
24
31
  export * from '@tradetrust-tt/tradetrust-utils/constants/network';
25
32
  export { generate12ByteNonce, generate32ByteKey, stringToUint8Array } from './utils/stringUtils/index.mjs';
26
33
  export * from '@tradetrust-tt/tradetrust-utils/constants/supportedChains';
27
34
  export * from '@tradetrust-tt/dnsprove';
28
35
  export { OpenAttestationDocument, SUPPORTED_SIGNING_ALGORITHM, SchemaId, SignedWrappedDocument, WrappedDocument, getData as getDataV2, isSchemaValidationError, obfuscateDocument, v2, v3, validateSchema, __unsafe__use__it__at__your__own__risks__wrapDocument as wrapOADocumentV3, __unsafe__use__it__at__your__own__risks__wrapDocuments as wrapOADocumentsV3 } from '@tradetrust-tt/tradetrust';
29
36
  export { DiagnoseError } from '@tradetrust-tt/tradetrust/dist/types/shared/utils';
30
- export { createResolver, getIdentifier, isValid, utils, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
31
- export { DocumentsToVerify, ErrorVerificationFragment, InvalidVerificationFragment, ProviderDetails, providerType as ProviderType, SkippedVerificationFragment, ValidVerificationFragment, VerificationBuilderOptions, VerificationFragment, VerificationFragmentStatus, VerificationFragmentType, Verifier, VerifierOptions } from '@tradetrust-tt/tt-verify/dist/types/src/types/core';
32
- import '@tradetrust-tt/token-registry-v4/contracts';
33
- import '@tradetrust-tt/token-registry-v5/contracts';
37
+ export { createResolver, getIdentifier, isValid, openAttestationDidIdentityProof, utils, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
38
+ 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';
34
39
  import '@ethersproject/abstract-signer';
35
40
  import '@tradetrust-tt/tradetrust/dist/types/3.0/types';
36
41
  import '@tradetrust-tt/tradetrust/dist/types/__generated__/schema.3.0';
package/dist/index.d.ts CHANGED
@@ -1,13 +1,20 @@
1
1
  export { supportInterfaceIds as v4SupportInterfaceIds } from './token-registry-v4/supportInterfaceIds.js';
2
2
  export { supportInterfaceIds as v5SupportInterfaceIds } from './token-registry-v5/supportInterfaceIds.js';
3
- export { c as v4Contracts } from './contracts-BsBT1cT2.js';
4
- export { c as v5Contracts } from './contracts-Cbud3a4b.js';
3
+ export { roleHash as v4RoleHash } from './token-registry-v4/roleHash.js';
4
+ export { contractAddress as v4ContractAddress } from './token-registry-v4/contractAddress.js';
5
+ export { roleHash as v5RoleHash } from './token-registry-v5/roleHash.js';
6
+ export { contractAddress as v5ContractAddress } from './token-registry-v5/contractAddress.js';
7
+ import * as contracts from '@tradetrust-tt/token-registry-v4/contracts';
8
+ export { contracts as v4Contracts };
9
+ import * as contracts$1 from '@tradetrust-tt/token-registry-v5/contracts';
10
+ export { contracts$1 as v5Contracts };
11
+ export { TypedContractMethod } from '@tradetrust-tt/token-registry-v5/dist/contracts/common';
5
12
  export { decrypt } from './core/decrypt.js';
6
13
  export { encrypt } from './core/encrypt.js';
7
14
  export { verifyDocument } from './core/verify.js';
8
15
  export { signOA } from './open-attestation/sign.js';
9
16
  export { KeyPair } from './open-attestation/types.js';
10
- export { diagnose, getAssetId, getDocumentData, getIssuerAddress, isObfuscated, isRawV2Document, isRawV3Document, isSignedWrappedV2Document, isSignedWrappedV3Document, isTransferableAsset, isWrappedV2Document, isWrappedV3Document } from './open-attestation/utils.js';
17
+ export { diagnose, getAssetId, getDocumentData, getIssuerAddress, getTemplateURL, isObfuscated, isRawV2Document, isRawV3Document, isSignedWrappedV2Document, isSignedWrappedV3Document, isTransferableAsset, isWrappedV2Document, isWrappedV3Document } from './open-attestation/utils.js';
11
18
  export { verifyOASignature } from './open-attestation/verify.js';
12
19
  export { wrapOADocument, wrapOADocumentV2, wrapOADocuments, wrapOADocumentsV2 } from './open-attestation/wrap.js';
13
20
  export { openAttestationVerifiers, verifiers, w3cVerifiers } from './verify/verify.js';
@@ -20,17 +27,15 @@ export { RawVerifiableCredential, SignedVerifiableCredential, SigningResult, Ver
20
27
  export { PrivateKeyPair } from '@trustvc/w3c-issuer';
21
28
  export { i as vc } from './index-1ws_BWZW.js';
22
29
  export { verifyW3CSignature } from './w3c/verify.js';
23
- export { errorMessageHandling, interpretFragments } from '@tradetrust-tt/tradetrust-utils';
30
+ export { errorMessageHandling, CONSTANTS as errorMessages, interpretFragments } from '@tradetrust-tt/tradetrust-utils';
24
31
  export * from '@tradetrust-tt/tradetrust-utils/constants/network';
25
32
  export { generate12ByteNonce, generate32ByteKey, stringToUint8Array } from './utils/stringUtils/index.js';
26
33
  export * from '@tradetrust-tt/tradetrust-utils/constants/supportedChains';
27
34
  export * from '@tradetrust-tt/dnsprove';
28
35
  export { OpenAttestationDocument, SUPPORTED_SIGNING_ALGORITHM, SchemaId, SignedWrappedDocument, WrappedDocument, getData as getDataV2, isSchemaValidationError, obfuscateDocument, v2, v3, validateSchema, __unsafe__use__it__at__your__own__risks__wrapDocument as wrapOADocumentV3, __unsafe__use__it__at__your__own__risks__wrapDocuments as wrapOADocumentsV3 } from '@tradetrust-tt/tradetrust';
29
36
  export { DiagnoseError } from '@tradetrust-tt/tradetrust/dist/types/shared/utils';
30
- export { createResolver, getIdentifier, isValid, utils, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
31
- export { DocumentsToVerify, ErrorVerificationFragment, InvalidVerificationFragment, ProviderDetails, providerType as ProviderType, SkippedVerificationFragment, ValidVerificationFragment, VerificationBuilderOptions, VerificationFragment, VerificationFragmentStatus, VerificationFragmentType, Verifier, VerifierOptions } from '@tradetrust-tt/tt-verify/dist/types/src/types/core';
32
- import '@tradetrust-tt/token-registry-v4/contracts';
33
- import '@tradetrust-tt/token-registry-v5/contracts';
37
+ export { createResolver, getIdentifier, isValid, openAttestationDidIdentityProof, utils, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
38
+ 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';
34
39
  import '@ethersproject/abstract-signer';
35
40
  import '@tradetrust-tt/tradetrust/dist/types/3.0/types';
36
41
  import '@tradetrust-tt/tradetrust/dist/types/__generated__/schema.3.0';
package/dist/index.js CHANGED
@@ -2,8 +2,11 @@
2
2
 
3
3
  var supportInterfaceIds = require('./token-registry-v4/supportInterfaceIds');
4
4
  var supportInterfaceIds$1 = require('./token-registry-v5/supportInterfaceIds');
5
- var contracts = require('./token-registry-v4/contracts');
6
- var contracts$1 = require('./token-registry-v5/contracts');
5
+ var tokenRegistryV4 = require('./token-registry-v4');
6
+ var tokenRegistryV5 = require('./token-registry-v5');
7
+ var contracts = require('@tradetrust-tt/token-registry-v4/contracts');
8
+ var contracts$1 = require('@tradetrust-tt/token-registry-v5/contracts');
9
+ var typedContractMethod = require('./token-registry-v5/typedContractMethod');
7
10
  var core = require('./core');
8
11
  var openAttestation = require('./open-attestation');
9
12
  var verify = require('./verify');
@@ -42,8 +45,28 @@ Object.defineProperty(exports, "v5SupportInterfaceIds", {
42
45
  enumerable: true,
43
46
  get: function () { return supportInterfaceIds$1.supportInterfaceIds; }
44
47
  });
48
+ Object.defineProperty(exports, "v4ContractAddress", {
49
+ enumerable: true,
50
+ get: function () { return tokenRegistryV4.v4ContractAddress; }
51
+ });
52
+ Object.defineProperty(exports, "v4RoleHash", {
53
+ enumerable: true,
54
+ get: function () { return tokenRegistryV4.v4RoleHash; }
55
+ });
56
+ Object.defineProperty(exports, "v5ContractAddress", {
57
+ enumerable: true,
58
+ get: function () { return tokenRegistryV5.v5ContractAddress; }
59
+ });
60
+ Object.defineProperty(exports, "v5RoleHash", {
61
+ enumerable: true,
62
+ get: function () { return tokenRegistryV5.v5RoleHash; }
63
+ });
45
64
  exports.v4Contracts = contracts__namespace;
46
65
  exports.v5Contracts = contracts__namespace$1;
66
+ Object.defineProperty(exports, "TypedContractMethod", {
67
+ enumerable: true,
68
+ get: function () { return typedContractMethod.TypedContractMethod; }
69
+ });
47
70
  Object.keys(core).forEach(function (k) {
48
71
  if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
49
72
  enumerable: true,
@@ -1,6 +1,6 @@
1
1
  export { signOA } from './sign.mjs';
2
2
  export { KeyPair } from './types.mjs';
3
- export { diagnose, getAssetId, getDocumentData, getIssuerAddress, isObfuscated, isRawV2Document, isRawV3Document, isSignedWrappedV2Document, isSignedWrappedV3Document, isTransferableAsset, isWrappedV2Document, isWrappedV3Document } from './utils.mjs';
3
+ export { diagnose, getAssetId, getDocumentData, getIssuerAddress, getTemplateURL, isObfuscated, isRawV2Document, isRawV3Document, isSignedWrappedV2Document, isSignedWrappedV3Document, isTransferableAsset, isWrappedV2Document, isWrappedV3Document } from './utils.mjs';
4
4
  export { verifyOASignature } from './verify.mjs';
5
5
  export { wrapOADocument, wrapOADocumentV2, wrapOADocuments, wrapOADocumentsV2 } from './wrap.mjs';
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';
@@ -1,6 +1,6 @@
1
1
  export { signOA } from './sign.js';
2
2
  export { KeyPair } from './types.js';
3
- export { diagnose, getAssetId, getDocumentData, getIssuerAddress, isObfuscated, isRawV2Document, isRawV3Document, isSignedWrappedV2Document, isSignedWrappedV3Document, isTransferableAsset, isWrappedV2Document, isWrappedV3Document } from './utils.js';
3
+ export { diagnose, getAssetId, getDocumentData, getIssuerAddress, getTemplateURL, isObfuscated, 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';
@@ -1,2 +1,14 @@
1
1
  'use strict';
2
2
 
3
+ var tradetrust = require('@tradetrust-tt/tradetrust');
4
+
5
+
6
+
7
+ Object.defineProperty(exports, "v2", {
8
+ enumerable: true,
9
+ get: function () { return tradetrust.v2; }
10
+ });
11
+ Object.defineProperty(exports, "v3", {
12
+ enumerable: true,
13
+ get: function () { return tradetrust.v3; }
14
+ });
@@ -37,5 +37,6 @@ declare const diagnose: ({ version, kind, document, debug, mode, }: {
37
37
  debug?: boolean;
38
38
  mode: _tradetrust_tt_tradetrust_dist_types_shared_utils__types_diagnose.Mode;
39
39
  }) => utils.DiagnoseError[];
40
+ declare const getTemplateURL: (document: any) => string | undefined;
40
41
 
41
- export { diagnose, getAssetId, getDocumentData, getIssuerAddress, isObfuscated, isRawV2Document, isRawV3Document, isSignedWrappedV2Document, isSignedWrappedV3Document, isTransferableAsset, isWrappedV2Document, isWrappedV3Document };
42
+ export { diagnose, getAssetId, getDocumentData, getIssuerAddress, getTemplateURL, isObfuscated, isRawV2Document, isRawV3Document, isSignedWrappedV2Document, isSignedWrappedV3Document, isTransferableAsset, isWrappedV2Document, isWrappedV3Document };
@@ -37,5 +37,6 @@ declare const diagnose: ({ version, kind, document, debug, mode, }: {
37
37
  debug?: boolean;
38
38
  mode: _tradetrust_tt_tradetrust_dist_types_shared_utils__types_diagnose.Mode;
39
39
  }) => utils.DiagnoseError[];
40
+ declare const getTemplateURL: (document: any) => string | undefined;
40
41
 
41
- export { diagnose, getAssetId, getDocumentData, getIssuerAddress, isObfuscated, isRawV2Document, isRawV3Document, isSignedWrappedV2Document, isSignedWrappedV3Document, isTransferableAsset, isWrappedV2Document, isWrappedV3Document };
42
+ export { diagnose, getAssetId, getDocumentData, getIssuerAddress, getTemplateURL, isObfuscated, isRawV2Document, isRawV3Document, isSignedWrappedV2Document, isSignedWrappedV3Document, isTransferableAsset, isWrappedV2Document, isWrappedV3Document };
@@ -14,7 +14,8 @@ const {
14
14
  isObfuscated,
15
15
  getDocumentData,
16
16
  getIssuerAddress,
17
- diagnose
17
+ diagnose,
18
+ getTemplateURL
18
19
  } = tradetrust.utils;
19
20
 
20
21
  Object.defineProperty(exports, "SUPPORTED_SIGNING_ALGORITHM", {
@@ -45,6 +46,7 @@ exports.diagnose = diagnose;
45
46
  exports.getAssetId = getAssetId;
46
47
  exports.getDocumentData = getDocumentData;
47
48
  exports.getIssuerAddress = getIssuerAddress;
49
+ exports.getTemplateURL = getTemplateURL;
48
50
  exports.isObfuscated = isObfuscated;
49
51
  exports.isRawV2Document = isRawV2Document;
50
52
  exports.isRawV3Document = isRawV3Document;
@@ -0,0 +1,13 @@
1
+ declare const contractAddress: {
2
+ TitleEscrowFactory: {
3
+ [x: number]: string;
4
+ };
5
+ Deployer: {
6
+ [x: number]: string;
7
+ };
8
+ TokenImplementation: {
9
+ [x: number]: string;
10
+ };
11
+ };
12
+
13
+ export { contractAddress };
@@ -0,0 +1,13 @@
1
+ declare const contractAddress: {
2
+ TitleEscrowFactory: {
3
+ [x: number]: string;
4
+ };
5
+ Deployer: {
6
+ [x: number]: string;
7
+ };
8
+ TokenImplementation: {
9
+ [x: number]: string;
10
+ };
11
+ };
12
+
13
+ export { contractAddress };
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ var tokenRegistryV4 = require('@tradetrust-tt/token-registry-v4');
4
+
5
+ const contractAddress = tokenRegistryV4.constants.contractAddress;
6
+
7
+ exports.contractAddress = contractAddress;
@@ -1 +1,3 @@
1
+ export { roleHash as v4RoleHash } from './roleHash.mjs';
2
+ export { contractAddress as v4ContractAddress } from './contractAddress.mjs';
1
3
  export * from '@tradetrust-tt/token-registry-v4';
@@ -1 +1,3 @@
1
+ export { roleHash as v4RoleHash } from './roleHash.js';
2
+ export { contractAddress as v4ContractAddress } from './contractAddress.js';
1
3
  export * from '@tradetrust-tt/token-registry-v4';
@@ -1,12 +1,22 @@
1
1
  'use strict';
2
2
 
3
+ var roleHash = require('./roleHash');
4
+ var contractAddress = require('./contractAddress');
3
5
  var tokenRegistryV4 = require('@tradetrust-tt/token-registry-v4');
4
6
 
5
7
 
6
8
 
9
+ Object.defineProperty(exports, "v4RoleHash", {
10
+ enumerable: true,
11
+ get: function () { return roleHash.roleHash; }
12
+ });
13
+ Object.defineProperty(exports, "v4ContractAddress", {
14
+ enumerable: true,
15
+ get: function () { return contractAddress.contractAddress; }
16
+ });
7
17
  Object.keys(tokenRegistryV4).forEach(function (k) {
8
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
9
- enumerable: true,
10
- get: function () { return tokenRegistryV4[k]; }
11
- });
18
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
19
+ enumerable: true,
20
+ get: function () { return tokenRegistryV4[k]; }
21
+ });
12
22
  });
@@ -0,0 +1,11 @@
1
+ declare const roleHash: {
2
+ DefaultAdmin: string;
3
+ MinterRole: string;
4
+ AccepterRole: string;
5
+ RestorerRole: string;
6
+ MinterAdminRole: string;
7
+ AccepterAdminRole: string;
8
+ RestorerAdminRole: string;
9
+ };
10
+
11
+ export { roleHash };
@@ -0,0 +1,11 @@
1
+ declare const roleHash: {
2
+ DefaultAdmin: string;
3
+ MinterRole: string;
4
+ AccepterRole: string;
5
+ RestorerRole: string;
6
+ MinterAdminRole: string;
7
+ AccepterAdminRole: string;
8
+ RestorerAdminRole: string;
9
+ };
10
+
11
+ export { roleHash };
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ var tokenRegistryV4 = require('@tradetrust-tt/token-registry-v4');
4
+
5
+ const roleHash = tokenRegistryV4.constants.roleHash;
6
+
7
+ exports.roleHash = roleHash;
@@ -0,0 +1,13 @@
1
+ declare const contractAddress: {
2
+ TitleEscrowFactory: {
3
+ [x: number]: string;
4
+ };
5
+ Deployer: {
6
+ [x: number]: string;
7
+ };
8
+ TokenImplementation: {
9
+ [x: number]: string;
10
+ };
11
+ };
12
+
13
+ export { contractAddress };
@@ -0,0 +1,13 @@
1
+ declare const contractAddress: {
2
+ TitleEscrowFactory: {
3
+ [x: number]: string;
4
+ };
5
+ Deployer: {
6
+ [x: number]: string;
7
+ };
8
+ TokenImplementation: {
9
+ [x: number]: string;
10
+ };
11
+ };
12
+
13
+ export { contractAddress };
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ var tokenRegistryV5 = require('@tradetrust-tt/token-registry-v5');
4
+
5
+ const contractAddress = tokenRegistryV5.constants.contractAddress;
6
+
7
+ exports.contractAddress = contractAddress;
@@ -1 +1,3 @@
1
+ export { roleHash as v5RoleHash } from './roleHash.mjs';
2
+ export { contractAddress as v5ContractAddress } from './contractAddress.mjs';
1
3
  export * from '@tradetrust-tt/token-registry-v5';
@@ -1 +1,3 @@
1
+ export { roleHash as v5RoleHash } from './roleHash.js';
2
+ export { contractAddress as v5ContractAddress } from './contractAddress.js';
1
3
  export * from '@tradetrust-tt/token-registry-v5';
@@ -1,12 +1,22 @@
1
1
  'use strict';
2
2
 
3
+ var roleHash = require('./roleHash');
4
+ var contractAddress = require('./contractAddress');
3
5
  var tokenRegistryV5 = require('@tradetrust-tt/token-registry-v5');
4
6
 
5
7
 
6
8
 
9
+ Object.defineProperty(exports, "v5RoleHash", {
10
+ enumerable: true,
11
+ get: function () { return roleHash.roleHash; }
12
+ });
13
+ Object.defineProperty(exports, "v5ContractAddress", {
14
+ enumerable: true,
15
+ get: function () { return contractAddress.contractAddress; }
16
+ });
7
17
  Object.keys(tokenRegistryV5).forEach(function (k) {
8
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
9
- enumerable: true,
10
- get: function () { return tokenRegistryV5[k]; }
11
- });
18
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
19
+ enumerable: true,
20
+ get: function () { return tokenRegistryV5[k]; }
21
+ });
12
22
  });
@@ -0,0 +1,11 @@
1
+ declare const roleHash: {
2
+ DefaultAdmin: any;
3
+ MinterRole: any;
4
+ AccepterRole: any;
5
+ RestorerRole: any;
6
+ MinterAdminRole: any;
7
+ AccepterAdminRole: any;
8
+ RestorerAdminRole: any;
9
+ };
10
+
11
+ export { roleHash };
@@ -0,0 +1,11 @@
1
+ declare const roleHash: {
2
+ DefaultAdmin: any;
3
+ MinterRole: any;
4
+ AccepterRole: any;
5
+ RestorerRole: any;
6
+ MinterAdminRole: any;
7
+ AccepterAdminRole: any;
8
+ RestorerAdminRole: any;
9
+ };
10
+
11
+ export { roleHash };
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ var tokenRegistryV5 = require('@tradetrust-tt/token-registry-v5');
4
+
5
+ const roleHash = tokenRegistryV5.constants.roleHash;
6
+
7
+ exports.roleHash = roleHash;
@@ -0,0 +1,9 @@
1
+ export { TypedContractMethod } from '@tradetrust-tt/token-registry-v5/dist/contracts/common';
2
+ import '@trustvc/w3c-vc';
3
+ import '@trustvc/w3c-issuer';
4
+ import '@tradetrust-tt/tradetrust-utils';
5
+ import '@tradetrust-tt/tradetrust-utils/constants/network';
6
+ import '@tradetrust-tt/tradetrust-utils/constants/supportedChains';
7
+ import '@tradetrust-tt/dnsprove';
8
+ import '@tradetrust-tt/token-registry-v4/contracts';
9
+ import '@tradetrust-tt/token-registry-v5/contracts';
@@ -0,0 +1,9 @@
1
+ export { TypedContractMethod } from '@tradetrust-tt/token-registry-v5/dist/contracts/common';
2
+ import '@trustvc/w3c-vc';
3
+ import '@trustvc/w3c-issuer';
4
+ import '@tradetrust-tt/tradetrust-utils';
5
+ import '@tradetrust-tt/tradetrust-utils/constants/network';
6
+ import '@tradetrust-tt/tradetrust-utils/constants/supportedChains';
7
+ import '@tradetrust-tt/dnsprove';
8
+ import '@tradetrust-tt/token-registry-v4/contracts';
9
+ import '@tradetrust-tt/token-registry-v5/contracts';
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ var common = require('@tradetrust-tt/token-registry-v5/dist/contracts/common');
4
+
5
+
6
+
7
+ Object.defineProperty(exports, "TypedContractMethod", {
8
+ enumerable: true,
9
+ get: function () { return common.TypedContractMethod; }
10
+ });
@@ -0,0 +1 @@
1
+ export { CONSTANTS as errorMessages } from '@tradetrust-tt/tradetrust-utils';
@@ -0,0 +1 @@
1
+ export { CONSTANTS as errorMessages } from '@tradetrust-tt/tradetrust-utils';
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ var tradetrustUtils = require('@tradetrust-tt/tradetrust-utils');
4
+
5
+
6
+
7
+ Object.defineProperty(exports, "errorMessages", {
8
+ enumerable: true,
9
+ get: function () { return tradetrustUtils.CONSTANTS; }
10
+ });
@@ -1,4 +1,4 @@
1
- export { errorMessageHandling, interpretFragments } from '@tradetrust-tt/tradetrust-utils';
1
+ export { errorMessageHandling, CONSTANTS as errorMessages, interpretFragments } from '@tradetrust-tt/tradetrust-utils';
2
2
  export * from '@tradetrust-tt/tradetrust-utils/constants/network';
3
3
  export { generate12ByteNonce, generate32ByteKey, stringToUint8Array } from './stringUtils/index.mjs';
4
4
  export * from '@tradetrust-tt/tradetrust-utils/constants/supportedChains';
@@ -1,4 +1,4 @@
1
- export { errorMessageHandling, interpretFragments } from '@tradetrust-tt/tradetrust-utils';
1
+ export { errorMessageHandling, CONSTANTS as errorMessages, interpretFragments } from '@tradetrust-tt/tradetrust-utils';
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';
@@ -4,6 +4,7 @@ var fragment = require('./fragment');
4
4
  var network = require('./network');
5
5
  var stringUtils = require('./stringUtils');
6
6
  var supportedChains = require('./supportedChains');
7
+ var errorMessages = require('./errorMessages');
7
8
 
8
9
 
9
10
 
@@ -31,3 +32,9 @@ Object.keys(supportedChains).forEach(function (k) {
31
32
  get: function () { return supportedChains[k]; }
32
33
  });
33
34
  });
35
+ Object.keys(errorMessages).forEach(function (k) {
36
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
37
+ enumerable: true,
38
+ get: function () { return errorMessages[k]; }
39
+ });
40
+ });
@@ -30,45 +30,46 @@ const TRANSFERABLE_RECORDS_TYPE = "TransferableRecords";
30
30
  const type = "DOCUMENT_STATUS";
31
31
  const name = TRANSFERABLE_RECORDS_TYPE;
32
32
  const verify = /* @__PURE__ */ __name(async (document, options) => {
33
- let signedDocument;
34
- let tokenId;
35
- if (w3cVC__namespace.isSignedDocument(document)) {
36
- signedDocument = document;
37
- tokenId = "0x" + signedDocument?.credentialStatus?.tokenId;
38
- }
39
- const credentialStatus = signedDocument?.credentialStatus;
40
- if (!credentialStatus?.tokenRegistry) {
41
- throw new ttVerify.CodedError(
42
- "Document's credentialStatus does not have tokenRegistry",
43
- ttVerify.OpenAttestationEthereumTokenRegistryStatusCode.UNRECOGNIZED_DOCUMENT,
44
- ttVerify.OpenAttestationEthereumTokenRegistryStatusCode[ttVerify.OpenAttestationEthereumTokenRegistryStatusCode.UNRECOGNIZED_DOCUMENT]
45
- );
46
- }
47
- if (!credentialStatus?.tokenNetwork || !credentialStatus?.tokenNetwork?.chainId) {
48
- throw new ttVerify.CodedError(
49
- "Document's credentialStatus does not have tokenNetwork.chainId",
50
- ttVerify.OpenAttestationEthereumTokenRegistryStatusCode.UNRECOGNIZED_DOCUMENT,
51
- ttVerify.OpenAttestationEthereumTokenRegistryStatusCode[ttVerify.OpenAttestationEthereumTokenRegistryStatusCode.UNRECOGNIZED_DOCUMENT]
52
- );
53
- }
33
+ const signedDocument = document;
34
+ const credentialStatuses = Array.isArray(signedDocument?.credentialStatus) ? signedDocument?.credentialStatus : [signedDocument?.credentialStatus];
54
35
  const { provider } = options;
55
- const mintStatus = await utils.isTokenMintedOnRegistry({
56
- tokenRegistryAddress: credentialStatus?.tokenRegistry,
57
- tokenId,
58
- provider
59
- });
36
+ const verificationResult = await Promise.all(
37
+ credentialStatuses.map(async (credentialStatus) => {
38
+ const tokenId = "0x" + credentialStatus.tokenId;
39
+ if (!credentialStatus?.tokenRegistry) {
40
+ throw new ttVerify.CodedError(
41
+ "Document's credentialStatus does not have tokenRegistry",
42
+ ttVerify.OpenAttestationEthereumTokenRegistryStatusCode.UNRECOGNIZED_DOCUMENT,
43
+ ttVerify.OpenAttestationEthereumTokenRegistryStatusCode[ttVerify.OpenAttestationEthereumTokenRegistryStatusCode.UNRECOGNIZED_DOCUMENT]
44
+ );
45
+ }
46
+ if (!credentialStatus?.tokenNetwork || !credentialStatus?.tokenNetwork?.chainId) {
47
+ throw new ttVerify.CodedError(
48
+ "Document's credentialStatus does not have tokenNetwork.chainId",
49
+ ttVerify.OpenAttestationEthereumTokenRegistryStatusCode.UNRECOGNIZED_DOCUMENT,
50
+ ttVerify.OpenAttestationEthereumTokenRegistryStatusCode[ttVerify.OpenAttestationEthereumTokenRegistryStatusCode.UNRECOGNIZED_DOCUMENT]
51
+ );
52
+ }
53
+ const mintStatus = await utils.isTokenMintedOnRegistry({
54
+ tokenRegistryAddress: credentialStatus?.tokenRegistry,
55
+ tokenId,
56
+ provider
57
+ });
58
+ return mintStatus;
59
+ })
60
+ );
60
61
  const result = {
61
62
  name,
62
63
  type,
63
64
  status: "INVALID",
64
65
  data: {
65
- tokenRegistry: credentialStatus.tokenRegistry
66
+ tokenRegistry: credentialStatuses?.[0]?.tokenRegistry
66
67
  }
67
68
  };
68
- if (ttVerify.ValidTokenRegistryStatus.guard(mintStatus)) {
69
+ if (verificationResult.every(ttVerify.ValidTokenRegistryStatus.guard)) {
69
70
  result.status = "VALID";
70
71
  } else {
71
- result.reason = mintStatus.reason;
72
+ result.reason = verificationResult?.[0]?.reason;
72
73
  }
73
74
  return result;
74
75
  }, "verify");
@@ -85,7 +86,9 @@ const skip = /* @__PURE__ */ __name(async () => {
85
86
  };
86
87
  }, "skip");
87
88
  const test = /* @__PURE__ */ __name((document) => {
88
- if (document?.credentialStatus?.type === TRANSFERABLE_RECORDS_TYPE) {
89
+ const doc = document;
90
+ const credentialStatuses = Array.isArray(doc?.credentialStatus) ? doc?.credentialStatus : [doc?.credentialStatus];
91
+ if (w3cVC__namespace.isSignedDocument(document) && credentialStatuses.every((cs) => cs?.type === TRANSFERABLE_RECORDS_TYPE)) {
89
92
  return true;
90
93
  }
91
94
  return false;
@@ -18,13 +18,5 @@ type TransferableRecordsErrorFragment = Omit<ErrorVerificationFragment<never>, '
18
18
  };
19
19
  type TransferableRecordsVerificationFragment = TransferableRecordsResultFragment | TransferableRecordsErrorFragment;
20
20
  type VerifierType = Verifier<TransferableRecordsVerificationFragment>;
21
- type TransferableRecordCredentialStatus = {
22
- type: 'TransferableRecords';
23
- tokenRegistry: string;
24
- tokenNetwork: {
25
- chainId: number;
26
- name: string;
27
- };
28
- };
29
21
 
30
- export type { TransferableRecordCredentialStatus, TransferableRecordsErrorFragment, TransferableRecordsErrorReason, TransferableRecordsResultFragment, TransferableRecordsVerificationFragment, VerifierType };
22
+ export type { TransferableRecordsErrorFragment, TransferableRecordsErrorReason, TransferableRecordsResultFragment, TransferableRecordsVerificationFragment, VerifierType };
@@ -18,13 +18,5 @@ type TransferableRecordsErrorFragment = Omit<ErrorVerificationFragment<never>, '
18
18
  };
19
19
  type TransferableRecordsVerificationFragment = TransferableRecordsResultFragment | TransferableRecordsErrorFragment;
20
20
  type VerifierType = Verifier<TransferableRecordsVerificationFragment>;
21
- type TransferableRecordCredentialStatus = {
22
- type: 'TransferableRecords';
23
- tokenRegistry: string;
24
- tokenNetwork: {
25
- chainId: number;
26
- name: string;
27
- };
28
- };
29
21
 
30
- export type { TransferableRecordCredentialStatus, TransferableRecordsErrorFragment, TransferableRecordsErrorReason, TransferableRecordsResultFragment, TransferableRecordsVerificationFragment, VerifierType };
22
+ export type { TransferableRecordsErrorFragment, TransferableRecordsErrorReason, TransferableRecordsResultFragment, TransferableRecordsVerificationFragment, VerifierType };
@@ -19,33 +19,43 @@ const w3cCredentialStatus = {
19
19
  }, "skip"),
20
20
  test: /* @__PURE__ */ __name((document) => {
21
21
  const doc = document;
22
- return doc.credentialStatus?.type === "StatusList2021Entry";
22
+ const credentialStatuses = Array.isArray(doc?.credentialStatus) ? doc?.credentialStatus : [doc?.credentialStatus];
23
+ const test = /* @__PURE__ */ __name((credentialStatus) => ["BitstringStatusListEntry", "StatusList2021Entry"].includes(credentialStatus?.type), "test");
24
+ if (w3cVc.isSignedDocument(document) && credentialStatuses.every(test)) {
25
+ return true;
26
+ } else {
27
+ return false;
28
+ }
23
29
  }, "test"),
24
30
  verify: /* @__PURE__ */ __name(async (document) => {
25
31
  const doc = document;
26
- const verificationResult = await w3cVc.verifyCredentialStatus(doc.credentialStatus);
27
- if (verificationResult.error) {
32
+ const credentialStatuses = Array.isArray(doc.credentialStatus) ? doc.credentialStatus : [doc.credentialStatus];
33
+ const verificationResult = await Promise.all(
34
+ credentialStatuses.map((cs) => w3cVc.verifyCredentialStatus(cs, cs?.type))
35
+ );
36
+ if (verificationResult.some((r) => r.error)) {
28
37
  return {
29
38
  type: "DOCUMENT_STATUS",
30
39
  name: "W3CCredentialStatus",
31
40
  reason: {
32
- message: verificationResult.error
41
+ message: verificationResult.map((r) => r.error).join(", ")
33
42
  },
43
+ data: verificationResult,
34
44
  status: "ERROR"
35
45
  };
36
- } else if (verificationResult.status === true) {
46
+ } else if (verificationResult.every((r) => r.status === false)) {
37
47
  return {
38
48
  type: "DOCUMENT_STATUS",
39
49
  name: "W3CCredentialStatus",
40
- data: false,
41
- status: "INVALID"
50
+ data: verificationResult,
51
+ status: "VALID"
42
52
  };
43
53
  } else {
44
54
  return {
45
55
  type: "DOCUMENT_STATUS",
46
56
  name: "W3CCredentialStatus",
47
- data: true,
48
- status: "VALID"
57
+ data: verificationResult,
58
+ status: "INVALID"
49
59
  };
50
60
  }
51
61
  }, "verify")
@@ -1,7 +1,7 @@
1
1
  export { openAttestationVerifiers, verifiers, w3cVerifiers } from './verify.mjs';
2
2
  export { i as fragments } from '../index-CUw8WpjA.mjs';
3
- export { createResolver, getIdentifier, isValid, utils, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
4
- export { DocumentsToVerify, ErrorVerificationFragment, InvalidVerificationFragment, ProviderDetails, providerType as ProviderType, SkippedVerificationFragment, ValidVerificationFragment, VerificationBuilderOptions, VerificationFragment, VerificationFragmentStatus, VerificationFragmentType, Verifier, VerifierOptions } from '@tradetrust-tt/tt-verify/dist/types/src/types/core';
3
+ export { createResolver, getIdentifier, isValid, openAttestationDidIdentityProof, utils, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
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.mjs';
6
6
  import './fragments/document-integrity/w3cSignatureIntegrity.mjs';
7
7
  import './fragments/document-status/transferableRecords/transferableRecordVerifier.mjs';
@@ -1,7 +1,7 @@
1
1
  export { openAttestationVerifiers, verifiers, w3cVerifiers } from './verify.js';
2
2
  export { i as fragments } from '../index-DK8Em_TZ.js';
3
- export { createResolver, getIdentifier, isValid, utils, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
4
- export { DocumentsToVerify, ErrorVerificationFragment, InvalidVerificationFragment, ProviderDetails, providerType as ProviderType, SkippedVerificationFragment, ValidVerificationFragment, VerificationBuilderOptions, VerificationFragment, VerificationFragmentStatus, VerificationFragmentType, Verifier, VerifierOptions } from '@tradetrust-tt/tt-verify/dist/types/src/types/core';
3
+ export { createResolver, getIdentifier, isValid, openAttestationDidIdentityProof, utils, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
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
7
  import './fragments/document-status/transferableRecords/transferableRecordVerifier.js';
@@ -1,8 +1,8 @@
1
1
  import { VerifierType } from './fragments/document-status/transferableRecords/transferableRecordVerifier.types.mjs';
2
2
  import * as _tradetrust_tt_tt_verify from '@tradetrust-tt/tt-verify';
3
- export { createResolver, getIdentifier, isValid, utils, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
3
+ export { createResolver, getIdentifier, isValid, openAttestationDidIdentityProof, utils, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
4
4
  import { Verifier, VerificationFragment } from '@tradetrust-tt/tt-verify/dist/types/src/types/core';
5
- export { DocumentsToVerify, ErrorVerificationFragment, InvalidVerificationFragment, ProviderDetails, providerType as ProviderType, SkippedVerificationFragment, ValidVerificationFragment, VerificationBuilderOptions, VerificationFragment, VerificationFragmentStatus, VerificationFragmentType, Verifier, VerifierOptions } from '@tradetrust-tt/tt-verify/dist/types/src/types/core';
5
+ export { DocumentsToVerify, ErrorVerificationFragment, InvalidVerificationFragment, ProviderDetails, providerType as ProviderType, SkippedVerificationFragment, ValidVerificationFragment, VerificationBuilderOptions, VerificationFragment, VerificationFragmentStatus, VerificationFragmentType, VerificationFragmentWithData, Verifier, VerifierOptions } from '@tradetrust-tt/tt-verify/dist/types/src/types/core';
6
6
 
7
7
  declare const verifiers: {
8
8
  documentIntegrity: {
@@ -1,8 +1,8 @@
1
1
  import { VerifierType } from './fragments/document-status/transferableRecords/transferableRecordVerifier.types.js';
2
2
  import * as _tradetrust_tt_tt_verify from '@tradetrust-tt/tt-verify';
3
- export { createResolver, getIdentifier, isValid, utils, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
3
+ export { createResolver, getIdentifier, isValid, openAttestationDidIdentityProof, utils, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
4
4
  import { Verifier, VerificationFragment } from '@tradetrust-tt/tt-verify/dist/types/src/types/core';
5
- export { DocumentsToVerify, ErrorVerificationFragment, InvalidVerificationFragment, ProviderDetails, providerType as ProviderType, SkippedVerificationFragment, ValidVerificationFragment, VerificationBuilderOptions, VerificationFragment, VerificationFragmentStatus, VerificationFragmentType, Verifier, VerifierOptions } from '@tradetrust-tt/tt-verify/dist/types/src/types/core';
5
+ export { DocumentsToVerify, ErrorVerificationFragment, InvalidVerificationFragment, ProviderDetails, providerType as ProviderType, SkippedVerificationFragment, ValidVerificationFragment, VerificationBuilderOptions, VerificationFragment, VerificationFragmentStatus, VerificationFragmentType, VerificationFragmentWithData, Verifier, VerifierOptions } from '@tradetrust-tt/tt-verify/dist/types/src/types/core';
6
6
 
7
7
  declare const verifiers: {
8
8
  documentIntegrity: {
@@ -48,6 +48,10 @@ Object.defineProperty(exports, "isValid", {
48
48
  enumerable: true,
49
49
  get: function () { return ttVerify.isValid; }
50
50
  });
51
+ Object.defineProperty(exports, "openAttestationDidIdentityProof", {
52
+ enumerable: true,
53
+ get: function () { return ttVerify.openAttestationDidIdentityProof; }
54
+ });
51
55
  Object.defineProperty(exports, "utils", {
52
56
  enumerable: true,
53
57
  get: function () { return ttVerify.utils; }
@@ -1,8 +1,2 @@
1
1
  export { RawVerifiableCredential, SignedVerifiableCredential, SigningResult, VerificationResult } from '@trustvc/w3c-vc';
2
2
  export { PrivateKeyPair } from '@trustvc/w3c-issuer';
3
- import '@tradetrust-tt/tradetrust-utils';
4
- import '@tradetrust-tt/tradetrust-utils/constants/network';
5
- import '@tradetrust-tt/tradetrust-utils/constants/supportedChains';
6
- import '@tradetrust-tt/dnsprove';
7
- import '@tradetrust-tt/token-registry-v4';
8
- import '@tradetrust-tt/token-registry-v5';
@@ -1,8 +1,2 @@
1
1
  export { RawVerifiableCredential, SignedVerifiableCredential, SigningResult, VerificationResult } from '@trustvc/w3c-vc';
2
2
  export { PrivateKeyPair } from '@trustvc/w3c-issuer';
3
- import '@tradetrust-tt/tradetrust-utils';
4
- import '@tradetrust-tt/tradetrust-utils/constants/network';
5
- import '@tradetrust-tt/tradetrust-utils/constants/supportedChains';
6
- import '@tradetrust-tt/dnsprove';
7
- import '@tradetrust-tt/token-registry-v4';
8
- import '@tradetrust-tt/token-registry-v5';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trustvc/trustvc",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "TrustVC library",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -109,16 +109,16 @@
109
109
  }
110
110
  },
111
111
  "dependencies": {
112
- "@tradetrust-tt/dnsprove": "^2.15.0",
112
+ "@tradetrust-tt/dnsprove": "^2.16.0",
113
113
  "@tradetrust-tt/token-registry-v4": "npm:@tradetrust-tt/token-registry@^4.15.0",
114
114
  "@tradetrust-tt/token-registry-v5": "npm:@tradetrust-tt/token-registry@^5.1.0",
115
115
  "@tradetrust-tt/tradetrust": "^6.10.0",
116
116
  "@tradetrust-tt/tradetrust-utils": "^2.1.1",
117
- "@tradetrust-tt/tt-verify": "^9.2.0",
118
- "@trustvc/w3c-context": "^1.0.0",
119
- "@trustvc/w3c-credential-status": "^1.0.0",
120
- "@trustvc/w3c-issuer": "^1.0.0",
121
- "@trustvc/w3c-vc": "^1.0.1",
117
+ "@tradetrust-tt/tt-verify": "^9.3.0",
118
+ "@trustvc/w3c-context": "^1.2.1",
119
+ "@trustvc/w3c-credential-status": "^1.2.1",
120
+ "@trustvc/w3c-issuer": "^1.2.1",
121
+ "@trustvc/w3c-vc": "^1.2.3",
122
122
  "did-resolver": "^4.1.0",
123
123
  "ethers": "^5.7.2",
124
124
  "js-sha3": "^0.9.3",
@@ -1,22 +0,0 @@
1
- import * as contracts$1 from '@tradetrust-tt/token-registry-v4/contracts';
2
-
3
- function _mergeNamespaces(n, m) {
4
- m.forEach(function (e) {
5
- e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
6
- if (k !== 'default' && !(k in n)) {
7
- var d = Object.getOwnPropertyDescriptor(e, k);
8
- Object.defineProperty(n, k, d.get ? d : {
9
- enumerable: true,
10
- get: function () { return e[k]; }
11
- });
12
- }
13
- });
14
- });
15
- return Object.freeze(n);
16
- }
17
-
18
- var contracts = /*#__PURE__*/_mergeNamespaces({
19
- __proto__: null
20
- }, [contracts$1]);
21
-
22
- export { contracts as c };
@@ -1,22 +0,0 @@
1
- import * as contracts$1 from '@tradetrust-tt/token-registry-v4/contracts';
2
-
3
- function _mergeNamespaces(n, m) {
4
- m.forEach(function (e) {
5
- e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
6
- if (k !== 'default' && !(k in n)) {
7
- var d = Object.getOwnPropertyDescriptor(e, k);
8
- Object.defineProperty(n, k, d.get ? d : {
9
- enumerable: true,
10
- get: function () { return e[k]; }
11
- });
12
- }
13
- });
14
- });
15
- return Object.freeze(n);
16
- }
17
-
18
- var contracts = /*#__PURE__*/_mergeNamespaces({
19
- __proto__: null
20
- }, [contracts$1]);
21
-
22
- export { contracts as c };
@@ -1,22 +0,0 @@
1
- import * as contracts$1 from '@tradetrust-tt/token-registry-v5/contracts';
2
-
3
- function _mergeNamespaces(n, m) {
4
- m.forEach(function (e) {
5
- e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
6
- if (k !== 'default' && !(k in n)) {
7
- var d = Object.getOwnPropertyDescriptor(e, k);
8
- Object.defineProperty(n, k, d.get ? d : {
9
- enumerable: true,
10
- get: function () { return e[k]; }
11
- });
12
- }
13
- });
14
- });
15
- return Object.freeze(n);
16
- }
17
-
18
- var contracts = /*#__PURE__*/_mergeNamespaces({
19
- __proto__: null
20
- }, [contracts$1]);
21
-
22
- export { contracts as c };
@@ -1,22 +0,0 @@
1
- import * as contracts$1 from '@tradetrust-tt/token-registry-v5/contracts';
2
-
3
- function _mergeNamespaces(n, m) {
4
- m.forEach(function (e) {
5
- e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
6
- if (k !== 'default' && !(k in n)) {
7
- var d = Object.getOwnPropertyDescriptor(e, k);
8
- Object.defineProperty(n, k, d.get ? d : {
9
- enumerable: true,
10
- get: function () { return e[k]; }
11
- });
12
- }
13
- });
14
- });
15
- return Object.freeze(n);
16
- }
17
-
18
- var contracts = /*#__PURE__*/_mergeNamespaces({
19
- __proto__: null
20
- }, [contracts$1]);
21
-
22
- export { contracts as c };