@trustvc/trustvc 1.0.0-alpha.1 → 1.0.0-alpha.11

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 (184) hide show
  1. package/README.md +138 -0
  2. package/dist/constants.d.mts +3 -0
  3. package/dist/constants.d.ts +3 -0
  4. package/dist/constants.js +5 -0
  5. package/dist/contracts-BsBT1cT2.d.mts +22 -0
  6. package/dist/contracts-BsBT1cT2.d.ts +22 -0
  7. package/dist/contracts-Cbud3a4b.d.mts +22 -0
  8. package/dist/contracts-Cbud3a4b.d.ts +22 -0
  9. package/dist/core/decrypt.d.mts +3 -0
  10. package/dist/core/decrypt.d.ts +3 -0
  11. package/dist/core/decrypt.js +22 -0
  12. package/dist/core/documentBuilder.d.mts +6 -0
  13. package/dist/core/documentBuilder.d.ts +6 -0
  14. package/dist/core/documentBuilder.js +13 -0
  15. package/dist/core/encrypt.d.mts +3 -0
  16. package/dist/core/encrypt.d.ts +3 -0
  17. package/dist/core/encrypt.js +22 -0
  18. package/dist/core/index.d.mts +5 -0
  19. package/dist/core/index.d.ts +5 -0
  20. package/dist/core/index.js +26 -0
  21. package/dist/core/verify.d.mts +6 -0
  22. package/dist/core/verify.d.ts +6 -0
  23. package/dist/core/verify.js +25 -0
  24. package/dist/dnsprove/index.d.mts +1 -0
  25. package/dist/dnsprove/index.d.ts +1 -0
  26. package/dist/dnsprove/index.js +12 -0
  27. package/dist/esm/constants.js +3 -0
  28. package/dist/esm/core/decrypt.js +20 -0
  29. package/dist/esm/core/documentBuilder.js +11 -0
  30. package/dist/esm/core/encrypt.js +20 -0
  31. package/dist/esm/core/index.js +3 -0
  32. package/dist/esm/core/verify.js +23 -0
  33. package/dist/esm/dnsprove/index.js +1 -0
  34. package/dist/esm/index.js +12 -0
  35. package/dist/esm/open-attestation/index.js +5 -0
  36. package/dist/esm/open-attestation/sign.js +15 -0
  37. package/dist/esm/open-attestation/types.js +1 -0
  38. package/dist/esm/open-attestation/utils.js +19 -0
  39. package/dist/esm/open-attestation/verify.js +13 -0
  40. package/dist/esm/open-attestation/wrap.js +33 -0
  41. package/dist/esm/token-registry-v4/contracts.js +1 -0
  42. package/dist/esm/token-registry-v4/index.js +1 -0
  43. package/dist/esm/token-registry-v4/supportInterfaceIds.js +5 -0
  44. package/dist/esm/token-registry-v5/contracts.js +1 -0
  45. package/dist/esm/token-registry-v5/index.js +1 -0
  46. package/dist/esm/token-registry-v5/supportInterfaceIds.js +5 -0
  47. package/dist/esm/utils/fragment/index.js +1 -0
  48. package/dist/esm/utils/index.js +4 -0
  49. package/dist/esm/utils/network/index.js +1 -0
  50. package/dist/esm/utils/stringUtils/index.js +20 -0
  51. package/dist/esm/utils/supportedChains/index.js +1 -0
  52. package/dist/esm/verify/fragments/document-integrity/w3cSignatureIntegrity.js +46 -0
  53. package/dist/esm/verify/fragments/document-status/transferableRecords/transferableRecordVerifier.js +105 -0
  54. package/dist/esm/verify/fragments/document-status/transferableRecords/transferableRecordVerifier.types.js +1 -0
  55. package/dist/esm/verify/fragments/document-status/transferableRecords/utils.js +72 -0
  56. package/dist/esm/verify/fragments/document-status/w3cCredentialStatus.js +52 -0
  57. package/dist/esm/verify/fragments/index.js +5 -0
  58. package/dist/esm/verify/fragments/issuer-identity/w3cIssuerIdentity.js +72 -0
  59. package/dist/esm/verify/index.js +3 -0
  60. package/dist/esm/verify/verify.js +38 -0
  61. package/dist/esm/w3c/context/index.js +1 -0
  62. package/dist/esm/w3c/credential-status/index.js +1 -0
  63. package/dist/esm/w3c/index.js +11 -0
  64. package/dist/esm/w3c/issuer/index.js +1 -0
  65. package/dist/esm/w3c/sign.js +9 -0
  66. package/dist/esm/w3c/types.js +2 -0
  67. package/dist/esm/w3c/vc/index.js +1 -0
  68. package/dist/esm/w3c/verify.js +9 -0
  69. package/dist/index-1ws_BWZW.d.mts +22 -0
  70. package/dist/index-1ws_BWZW.d.ts +22 -0
  71. package/dist/index-CUw8WpjA.d.mts +22 -0
  72. package/dist/index-CjwEVGoM.d.mts +22 -0
  73. package/dist/index-CjwEVGoM.d.ts +22 -0
  74. package/dist/index-ClF4_Nqk.d.mts +22 -0
  75. package/dist/index-ClF4_Nqk.d.ts +22 -0
  76. package/dist/index-DK8Em_TZ.d.ts +22 -0
  77. package/dist/index-DwAYXQn2.d.mts +22 -0
  78. package/dist/index-DwAYXQn2.d.ts +22 -0
  79. package/dist/index.d.mts +46 -0
  80. package/dist/index.d.ts +46 -0
  81. package/dist/index.js +82 -0
  82. package/dist/open-attestation/index.d.mts +13 -0
  83. package/dist/open-attestation/index.d.ts +13 -0
  84. package/dist/open-attestation/index.js +40 -0
  85. package/dist/open-attestation/sign.d.mts +9 -0
  86. package/dist/open-attestation/sign.d.ts +9 -0
  87. package/dist/open-attestation/sign.js +17 -0
  88. package/dist/open-attestation/types.d.mts +9 -0
  89. package/dist/open-attestation/types.d.ts +9 -0
  90. package/dist/open-attestation/types.js +2 -0
  91. package/dist/open-attestation/utils.d.mts +41 -0
  92. package/dist/open-attestation/utils.d.ts +41 -0
  93. package/dist/open-attestation/utils.js +55 -0
  94. package/dist/open-attestation/verify.d.mts +5 -0
  95. package/dist/open-attestation/verify.d.ts +5 -0
  96. package/dist/open-attestation/verify.js +15 -0
  97. package/dist/open-attestation/wrap.d.mts +9 -0
  98. package/dist/open-attestation/wrap.d.ts +9 -0
  99. package/dist/open-attestation/wrap.js +45 -0
  100. package/dist/token-registry-v4/contracts.d.mts +1 -0
  101. package/dist/token-registry-v4/contracts.d.ts +1 -0
  102. package/dist/token-registry-v4/contracts.js +12 -0
  103. package/dist/token-registry-v4/index.d.mts +1 -0
  104. package/dist/token-registry-v4/index.d.ts +1 -0
  105. package/dist/token-registry-v4/index.js +12 -0
  106. package/dist/token-registry-v4/supportInterfaceIds.d.mts +12 -0
  107. package/dist/token-registry-v4/supportInterfaceIds.d.ts +12 -0
  108. package/dist/token-registry-v4/supportInterfaceIds.js +7 -0
  109. package/dist/token-registry-v5/contracts.d.mts +1 -0
  110. package/dist/token-registry-v5/contracts.d.ts +1 -0
  111. package/dist/token-registry-v5/contracts.js +12 -0
  112. package/dist/token-registry-v5/index.d.mts +1 -0
  113. package/dist/token-registry-v5/index.d.ts +1 -0
  114. package/dist/token-registry-v5/index.js +12 -0
  115. package/dist/token-registry-v5/supportInterfaceIds.d.mts +12 -0
  116. package/dist/token-registry-v5/supportInterfaceIds.d.ts +12 -0
  117. package/dist/token-registry-v5/supportInterfaceIds.js +7 -0
  118. package/dist/utils/fragment/index.d.mts +1 -0
  119. package/dist/utils/fragment/index.d.ts +1 -0
  120. package/dist/utils/fragment/index.js +14 -0
  121. package/dist/utils/index.d.mts +4 -0
  122. package/dist/utils/index.d.ts +4 -0
  123. package/dist/utils/index.js +33 -0
  124. package/dist/utils/network/index.d.mts +1 -0
  125. package/dist/utils/network/index.d.ts +1 -0
  126. package/dist/utils/network/index.js +12 -0
  127. package/dist/utils/stringUtils/index.d.mts +9 -0
  128. package/dist/utils/stringUtils/index.d.ts +9 -0
  129. package/dist/utils/stringUtils/index.js +24 -0
  130. package/dist/utils/supportedChains/index.d.mts +1 -0
  131. package/dist/utils/supportedChains/index.d.ts +1 -0
  132. package/dist/utils/supportedChains/index.js +12 -0
  133. package/dist/verify/fragments/document-integrity/w3cSignatureIntegrity.d.mts +5 -0
  134. package/dist/verify/fragments/document-integrity/w3cSignatureIntegrity.d.ts +5 -0
  135. package/dist/verify/fragments/document-integrity/w3cSignatureIntegrity.js +48 -0
  136. package/dist/verify/fragments/document-status/transferableRecords/transferableRecordVerifier.d.mts +7 -0
  137. package/dist/verify/fragments/document-status/transferableRecords/transferableRecordVerifier.d.ts +7 -0
  138. package/dist/verify/fragments/document-status/transferableRecords/transferableRecordVerifier.js +128 -0
  139. package/dist/verify/fragments/document-status/transferableRecords/transferableRecordVerifier.types.d.mts +30 -0
  140. package/dist/verify/fragments/document-status/transferableRecords/transferableRecordVerifier.types.d.ts +30 -0
  141. package/dist/verify/fragments/document-status/transferableRecords/transferableRecordVerifier.types.js +2 -0
  142. package/dist/verify/fragments/document-status/transferableRecords/utils.d.mts +18 -0
  143. package/dist/verify/fragments/document-status/transferableRecords/utils.d.ts +18 -0
  144. package/dist/verify/fragments/document-status/transferableRecords/utils.js +75 -0
  145. package/dist/verify/fragments/document-status/w3cCredentialStatus.d.mts +5 -0
  146. package/dist/verify/fragments/document-status/w3cCredentialStatus.d.ts +5 -0
  147. package/dist/verify/fragments/document-status/w3cCredentialStatus.js +54 -0
  148. package/dist/verify/fragments/index.d.mts +6 -0
  149. package/dist/verify/fragments/index.d.ts +6 -0
  150. package/dist/verify/fragments/index.js +54 -0
  151. package/dist/verify/fragments/issuer-identity/w3cIssuerIdentity.d.mts +5 -0
  152. package/dist/verify/fragments/issuer-identity/w3cIssuerIdentity.d.ts +5 -0
  153. package/dist/verify/fragments/issuer-identity/w3cIssuerIdentity.js +74 -0
  154. package/dist/verify/index.d.mts +9 -0
  155. package/dist/verify/index.d.ts +9 -0
  156. package/dist/verify/index.js +34 -0
  157. package/dist/verify/verify.d.mts +29 -0
  158. package/dist/verify/verify.d.ts +29 -0
  159. package/dist/verify/verify.js +53 -0
  160. package/dist/w3c/context/index.d.mts +1 -0
  161. package/dist/w3c/context/index.d.ts +1 -0
  162. package/dist/w3c/context/index.js +12 -0
  163. package/dist/w3c/credential-status/index.d.mts +1 -0
  164. package/dist/w3c/credential-status/index.d.ts +1 -0
  165. package/dist/w3c/credential-status/index.js +12 -0
  166. package/dist/w3c/index.d.mts +10 -0
  167. package/dist/w3c/index.d.ts +10 -0
  168. package/dist/w3c/index.js +57 -0
  169. package/dist/w3c/issuer/index.d.mts +1 -0
  170. package/dist/w3c/issuer/index.d.ts +1 -0
  171. package/dist/w3c/issuer/index.js +12 -0
  172. package/dist/w3c/sign.d.mts +6 -0
  173. package/dist/w3c/sign.d.ts +6 -0
  174. package/dist/w3c/sign.js +11 -0
  175. package/dist/w3c/types.d.mts +8 -0
  176. package/dist/w3c/types.d.ts +8 -0
  177. package/dist/w3c/types.js +27 -0
  178. package/dist/w3c/vc/index.d.mts +1 -0
  179. package/dist/w3c/vc/index.d.ts +1 -0
  180. package/dist/w3c/vc/index.js +12 -0
  181. package/dist/w3c/verify.d.mts +5 -0
  182. package/dist/w3c/verify.d.ts +5 -0
  183. package/dist/w3c/verify.js +11 -0
  184. package/package.json +101 -8
@@ -0,0 +1,18 @@
1
+ import { ValidTokenRegistryStatus, InvalidTokenRegistryStatus } from '@tradetrust-tt/tt-verify';
2
+ import { providers, errors } from 'ethers';
3
+
4
+ type EthersError = {
5
+ message?: string;
6
+ data?: string;
7
+ method?: string;
8
+ reason?: string;
9
+ code?: errors;
10
+ };
11
+ declare const decodeError: (error: EthersError) => "Document has not been issued under token registry" | "Token registry is not found" | "ENS name is not configured" | "Invalid token registry address" | "Invalid contract arguments";
12
+ declare const isTokenMintedOnRegistry: ({ tokenRegistryAddress, tokenId, provider, }: {
13
+ tokenRegistryAddress: string;
14
+ tokenId: string;
15
+ provider: providers.Provider;
16
+ }) => Promise<ValidTokenRegistryStatus | InvalidTokenRegistryStatus>;
17
+
18
+ export { decodeError, isTokenMintedOnRegistry };
@@ -0,0 +1,75 @@
1
+ 'use strict';
2
+
3
+ var contracts = require('@tradetrust-tt/token-registry-v5/dist/contracts');
4
+ var ttVerify = require('@tradetrust-tt/tt-verify');
5
+ var ethers = require('ethers');
6
+
7
+ var __defProp = Object.defineProperty;
8
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
9
+ const isNonExistentToken = /* @__PURE__ */ __name((error) => {
10
+ const message = error.message;
11
+ if (!message) {
12
+ return error.data && error.data.slice(0, 10) === "0x7e273289";
13
+ }
14
+ return message.includes("owner query for nonexistent token");
15
+ }, "isNonExistentToken");
16
+ const isMissingTokenRegistry = /* @__PURE__ */ __name((error) => {
17
+ return !error.reason && error.method?.toLowerCase() === "ownerOf(uint256)".toLowerCase() && error.code === ethers.errors.CALL_EXCEPTION;
18
+ }, "isMissingTokenRegistry");
19
+ const decodeError = /* @__PURE__ */ __name((error) => {
20
+ const reason = error.reason && Array.isArray(error.reason) ? error.reason[0] : error.reason ?? "";
21
+ switch (true) {
22
+ case isNonExistentToken(error):
23
+ return `Document has not been issued under token registry`;
24
+ case isMissingTokenRegistry(error):
25
+ return `Token registry is not found`;
26
+ case (reason.toLowerCase() === "ENS name not configured".toLowerCase() && error.code === ethers.errors.UNSUPPORTED_OPERATION):
27
+ return "ENS name is not configured";
28
+ case (reason.toLowerCase() === "invalid address".toLowerCase() && error.code === ethers.errors.INVALID_ARGUMENT):
29
+ return `Invalid token registry address`;
30
+ case error.code === ethers.errors.INVALID_ARGUMENT:
31
+ return `Invalid contract arguments`;
32
+ case error.code === ethers.errors.SERVER_ERROR:
33
+ case error.code === ethers.errors.NETWORK_ERROR:
34
+ throw new ttVerify.CodedError(
35
+ "Unable to connect to the network, please try again later",
36
+ ttVerify.OpenAttestationEthereumTokenRegistryStatusCode.SERVER_ERROR,
37
+ ttVerify.OpenAttestationEthereumTokenRegistryStatusCode[ttVerify.OpenAttestationEthereumTokenRegistryStatusCode.SERVER_ERROR]
38
+ );
39
+ default:
40
+ throw error;
41
+ }
42
+ }, "decodeError");
43
+ const isTokenMintedOnRegistry = /* @__PURE__ */ __name(async ({
44
+ tokenRegistryAddress,
45
+ tokenId,
46
+ provider
47
+ }) => {
48
+ try {
49
+ const tokenRegistryContract = contracts.TradeTrustToken__factory.connect(tokenRegistryAddress, provider);
50
+ const minted = await tokenRegistryContract.ownerOf(tokenId).then((owner) => owner !== ethers.constants.AddressZero);
51
+ return minted ? { minted, address: tokenRegistryAddress } : {
52
+ minted,
53
+ address: tokenRegistryAddress,
54
+ reason: {
55
+ code: ttVerify.OpenAttestationEthereumTokenRegistryStatusCode.DOCUMENT_NOT_MINTED,
56
+ codeString: ttVerify.OpenAttestationEthereumTokenRegistryStatusCode[ttVerify.OpenAttestationEthereumTokenRegistryStatusCode.DOCUMENT_NOT_MINTED],
57
+ message: `Document ${tokenId} has not been issued under contract ${tokenRegistryAddress}`
58
+ }
59
+ };
60
+ } catch (error) {
61
+ return {
62
+ minted: false,
63
+ address: tokenRegistryAddress,
64
+ reason: {
65
+ message: decodeError(error),
66
+ // message: (error as Error).message,
67
+ code: ttVerify.OpenAttestationEthereumTokenRegistryStatusCode.DOCUMENT_NOT_MINTED,
68
+ codeString: ttVerify.OpenAttestationEthereumTokenRegistryStatusCode[ttVerify.OpenAttestationEthereumTokenRegistryStatusCode.DOCUMENT_NOT_MINTED]
69
+ }
70
+ };
71
+ }
72
+ }, "isTokenMintedOnRegistry");
73
+
74
+ exports.decodeError = decodeError;
75
+ exports.isTokenMintedOnRegistry = isTokenMintedOnRegistry;
@@ -0,0 +1,5 @@
1
+ import { Verifier, VerificationFragment } from '@tradetrust-tt/tt-verify';
2
+
3
+ declare const w3cCredentialStatus: Verifier<VerificationFragment>;
4
+
5
+ export { w3cCredentialStatus };
@@ -0,0 +1,5 @@
1
+ import { Verifier, VerificationFragment } from '@tradetrust-tt/tt-verify';
2
+
3
+ declare const w3cCredentialStatus: Verifier<VerificationFragment>;
4
+
5
+ export { w3cCredentialStatus };
@@ -0,0 +1,54 @@
1
+ 'use strict';
2
+
3
+ var w3cVc = require('@trustvc/w3c-vc');
4
+
5
+ var __defProp = Object.defineProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ const w3cCredentialStatus = {
8
+ skip: /* @__PURE__ */ __name(async () => {
9
+ return {
10
+ type: "DOCUMENT_STATUS",
11
+ name: "W3CCredentialStatus",
12
+ reason: {
13
+ code: 0,
14
+ codeString: "SKIPPED",
15
+ message: `Document does not have a valid credentialStatus or type.`
16
+ },
17
+ status: "SKIPPED"
18
+ };
19
+ }, "skip"),
20
+ test: /* @__PURE__ */ __name((document) => {
21
+ const doc = document;
22
+ return doc.credentialStatus?.type === "StatusList2021Entry";
23
+ }, "test"),
24
+ verify: /* @__PURE__ */ __name(async (document) => {
25
+ const doc = document;
26
+ const verificationResult = await w3cVc.verifyCredentialStatus(doc.credentialStatus);
27
+ if (verificationResult.error) {
28
+ return {
29
+ type: "DOCUMENT_STATUS",
30
+ name: "W3CCredentialStatus",
31
+ reason: {
32
+ message: verificationResult.error
33
+ },
34
+ status: "ERROR"
35
+ };
36
+ } else if (verificationResult.status === true) {
37
+ return {
38
+ type: "DOCUMENT_STATUS",
39
+ name: "W3CCredentialStatus",
40
+ data: false,
41
+ status: "INVALID"
42
+ };
43
+ } else {
44
+ return {
45
+ type: "DOCUMENT_STATUS",
46
+ name: "W3CCredentialStatus",
47
+ data: true,
48
+ status: "VALID"
49
+ };
50
+ }
51
+ }, "verify")
52
+ };
53
+
54
+ exports.w3cCredentialStatus = w3cCredentialStatus;
@@ -0,0 +1,6 @@
1
+ export { openAttestationDidIdentityProof, openAttestationDidSignedDocumentStatus, openAttestationDnsDidIdentityProof, openAttestationDnsTxtIdentityProof, openAttestationEthereumDocumentStoreStatus, openAttestationEthereumTokenRegistryStatus, openAttestationHash } from '@tradetrust-tt/tt-verify';
2
+ export { w3cSignatureIntegrity } from './document-integrity/w3cSignatureIntegrity.mjs';
3
+ export { credentialStatusTransferableRecordVerifier } from './document-status/transferableRecords/transferableRecordVerifier.mjs';
4
+ export { w3cCredentialStatus } from './document-status/w3cCredentialStatus.mjs';
5
+ export { w3cIssuerIdentity } from './issuer-identity/w3cIssuerIdentity.mjs';
6
+ import './document-status/transferableRecords/transferableRecordVerifier.types.mjs';
@@ -0,0 +1,6 @@
1
+ export { openAttestationDidIdentityProof, openAttestationDidSignedDocumentStatus, openAttestationDnsDidIdentityProof, openAttestationDnsTxtIdentityProof, openAttestationEthereumDocumentStoreStatus, openAttestationEthereumTokenRegistryStatus, openAttestationHash } from '@tradetrust-tt/tt-verify';
2
+ export { w3cSignatureIntegrity } from './document-integrity/w3cSignatureIntegrity.js';
3
+ export { credentialStatusTransferableRecordVerifier } from './document-status/transferableRecords/transferableRecordVerifier.js';
4
+ export { w3cCredentialStatus } from './document-status/w3cCredentialStatus.js';
5
+ export { w3cIssuerIdentity } from './issuer-identity/w3cIssuerIdentity.js';
6
+ import './document-status/transferableRecords/transferableRecordVerifier.types.js';
@@ -0,0 +1,54 @@
1
+ 'use strict';
2
+
3
+ var ttVerify = require('@tradetrust-tt/tt-verify');
4
+ var w3cSignatureIntegrity = require('./document-integrity/w3cSignatureIntegrity');
5
+ var transferableRecordVerifier = require('./document-status/transferableRecords/transferableRecordVerifier');
6
+ var w3cCredentialStatus = require('./document-status/w3cCredentialStatus');
7
+ var w3cIssuerIdentity = require('./issuer-identity/w3cIssuerIdentity');
8
+
9
+
10
+
11
+ Object.defineProperty(exports, "openAttestationDidIdentityProof", {
12
+ enumerable: true,
13
+ get: function () { return ttVerify.openAttestationDidIdentityProof; }
14
+ });
15
+ Object.defineProperty(exports, "openAttestationDidSignedDocumentStatus", {
16
+ enumerable: true,
17
+ get: function () { return ttVerify.openAttestationDidSignedDocumentStatus; }
18
+ });
19
+ Object.defineProperty(exports, "openAttestationDnsDidIdentityProof", {
20
+ enumerable: true,
21
+ get: function () { return ttVerify.openAttestationDnsDidIdentityProof; }
22
+ });
23
+ Object.defineProperty(exports, "openAttestationDnsTxtIdentityProof", {
24
+ enumerable: true,
25
+ get: function () { return ttVerify.openAttestationDnsTxtIdentityProof; }
26
+ });
27
+ Object.defineProperty(exports, "openAttestationEthereumDocumentStoreStatus", {
28
+ enumerable: true,
29
+ get: function () { return ttVerify.openAttestationEthereumDocumentStoreStatus; }
30
+ });
31
+ Object.defineProperty(exports, "openAttestationEthereumTokenRegistryStatus", {
32
+ enumerable: true,
33
+ get: function () { return ttVerify.openAttestationEthereumTokenRegistryStatus; }
34
+ });
35
+ Object.defineProperty(exports, "openAttestationHash", {
36
+ enumerable: true,
37
+ get: function () { return ttVerify.openAttestationHash; }
38
+ });
39
+ Object.defineProperty(exports, "w3cSignatureIntegrity", {
40
+ enumerable: true,
41
+ get: function () { return w3cSignatureIntegrity.w3cSignatureIntegrity; }
42
+ });
43
+ Object.defineProperty(exports, "credentialStatusTransferableRecordVerifier", {
44
+ enumerable: true,
45
+ get: function () { return transferableRecordVerifier.credentialStatusTransferableRecordVerifier; }
46
+ });
47
+ Object.defineProperty(exports, "w3cCredentialStatus", {
48
+ enumerable: true,
49
+ get: function () { return w3cCredentialStatus.w3cCredentialStatus; }
50
+ });
51
+ Object.defineProperty(exports, "w3cIssuerIdentity", {
52
+ enumerable: true,
53
+ get: function () { return w3cIssuerIdentity.w3cIssuerIdentity; }
54
+ });
@@ -0,0 +1,5 @@
1
+ import { Verifier, VerificationFragment } from '@tradetrust-tt/tt-verify';
2
+
3
+ declare const w3cIssuerIdentity: Verifier<VerificationFragment>;
4
+
5
+ export { w3cIssuerIdentity };
@@ -0,0 +1,5 @@
1
+ import { Verifier, VerificationFragment } from '@tradetrust-tt/tt-verify';
2
+
3
+ declare const w3cIssuerIdentity: Verifier<VerificationFragment>;
4
+
5
+ export { w3cIssuerIdentity };
@@ -0,0 +1,74 @@
1
+ 'use strict';
2
+
3
+ var didResolver = require('did-resolver');
4
+ var webDidResolver = require('web-did-resolver');
5
+
6
+ var __defProp = Object.defineProperty;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
+ const checkDidWebResolve = /* @__PURE__ */ __name(async (did) => {
9
+ try {
10
+ const resolver = new didResolver.Resolver({
11
+ ...webDidResolver.getResolver()
12
+ });
13
+ const didDocument = await resolver.resolve(did);
14
+ if (!didDocument || !didDocument.didDocument) {
15
+ throw new Error(`Failed to resolve DID: ${did}`);
16
+ }
17
+ return true;
18
+ } catch {
19
+ return false;
20
+ }
21
+ }, "checkDidWebResolve");
22
+ const w3cIssuerIdentity = {
23
+ skip: /* @__PURE__ */ __name(async () => {
24
+ return {
25
+ type: "ISSUER_IDENTITY",
26
+ name: "W3CIssuerIdentity",
27
+ reason: {
28
+ code: 0,
29
+ codeString: "SKIPPED",
30
+ message: `Document has no issuer field.`
31
+ },
32
+ status: "SKIPPED"
33
+ };
34
+ }, "skip"),
35
+ test: /* @__PURE__ */ __name((document) => {
36
+ const doc = document;
37
+ return Boolean(doc.issuer);
38
+ }, "test"),
39
+ verify: /* @__PURE__ */ __name(async (document) => {
40
+ const doc = document;
41
+ if (doc.proof?.verificationMethod?.split("#")[0] !== doc.issuer) {
42
+ return {
43
+ type: "ISSUER_IDENTITY",
44
+ name: "W3CIssuerIdentity",
45
+ data: false,
46
+ reason: {
47
+ message: `Issuer and verification method do not match.`
48
+ },
49
+ status: "INVALID"
50
+ };
51
+ }
52
+ const resolutionResult = await checkDidWebResolve(doc.issuer);
53
+ if (resolutionResult) {
54
+ return {
55
+ type: "ISSUER_IDENTITY",
56
+ name: "W3CIssuerIdentity",
57
+ data: true,
58
+ status: "VALID"
59
+ };
60
+ } else {
61
+ return {
62
+ type: "ISSUER_IDENTITY",
63
+ name: "W3CIssuerIdentity",
64
+ data: false,
65
+ reason: {
66
+ message: `The DID cannot be resolved.`
67
+ },
68
+ status: "INVALID"
69
+ };
70
+ }
71
+ }, "verify")
72
+ };
73
+
74
+ exports.w3cIssuerIdentity = w3cIssuerIdentity;
@@ -0,0 +1,9 @@
1
+ export { openAttestationVerifiers, verifiers, w3cVerifiers } from './verify.mjs';
2
+ export { i as fragments } from '../index-CUw8WpjA.mjs';
3
+ export { isValid, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
4
+ export { DocumentsToVerify, ErrorVerificationFragment, InvalidVerificationFragment, ProviderDetails, providerType as ProviderType, SkippedVerificationFragment, ValidVerificationFragment, VerificationBuilderOptions, VerificationFragment, VerificationFragmentStatus, VerificationFragmentType, VerifierOptions } from '@tradetrust-tt/tt-verify/dist/types/src/types/core';
5
+ import './fragments/document-status/transferableRecords/transferableRecordVerifier.types.mjs';
6
+ import './fragments/document-integrity/w3cSignatureIntegrity.mjs';
7
+ import './fragments/document-status/transferableRecords/transferableRecordVerifier.mjs';
8
+ import './fragments/document-status/w3cCredentialStatus.mjs';
9
+ import './fragments/issuer-identity/w3cIssuerIdentity.mjs';
@@ -0,0 +1,9 @@
1
+ export { openAttestationVerifiers, verifiers, w3cVerifiers } from './verify.js';
2
+ export { i as fragments } from '../index-DK8Em_TZ.js';
3
+ export { isValid, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
4
+ export { DocumentsToVerify, ErrorVerificationFragment, InvalidVerificationFragment, ProviderDetails, providerType as ProviderType, SkippedVerificationFragment, ValidVerificationFragment, VerificationBuilderOptions, VerificationFragment, VerificationFragmentStatus, VerificationFragmentType, VerifierOptions } from '@tradetrust-tt/tt-verify/dist/types/src/types/core';
5
+ import './fragments/document-status/transferableRecords/transferableRecordVerifier.types.js';
6
+ import './fragments/document-integrity/w3cSignatureIntegrity.js';
7
+ import './fragments/document-status/transferableRecords/transferableRecordVerifier.js';
8
+ import './fragments/document-status/w3cCredentialStatus.js';
9
+ import './fragments/issuer-identity/w3cIssuerIdentity.js';
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+
3
+ var verify = require('./verify');
4
+ var fragments = require('./fragments');
5
+
6
+ function _interopNamespace(e) {
7
+ if (e && e.__esModule) return e;
8
+ var n = Object.create(null);
9
+ if (e) {
10
+ Object.keys(e).forEach(function (k) {
11
+ if (k !== 'default') {
12
+ var d = Object.getOwnPropertyDescriptor(e, k);
13
+ Object.defineProperty(n, k, d.get ? d : {
14
+ enumerable: true,
15
+ get: function () { return e[k]; }
16
+ });
17
+ }
18
+ });
19
+ }
20
+ n.default = e;
21
+ return Object.freeze(n);
22
+ }
23
+
24
+ var fragments__namespace = /*#__PURE__*/_interopNamespace(fragments);
25
+
26
+
27
+
28
+ exports.fragments = fragments__namespace;
29
+ Object.keys(verify).forEach(function (k) {
30
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
31
+ enumerable: true,
32
+ get: function () { return verify[k]; }
33
+ });
34
+ });
@@ -0,0 +1,29 @@
1
+ import { VerifierType } from './fragments/document-status/transferableRecords/transferableRecordVerifier.types.mjs';
2
+ import * as _tradetrust_tt_tt_verify from '@tradetrust-tt/tt-verify';
3
+ export { isValid, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
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, VerifierOptions } from '@tradetrust-tt/tt-verify/dist/types/src/types/core';
6
+
7
+ declare const verifiers: {
8
+ documentIntegrity: {
9
+ openAttestationHash: Verifier<_tradetrust_tt_tt_verify.OpenAttestationHashVerificationFragment>;
10
+ w3cSignatureIntegrity: Verifier<VerificationFragment>;
11
+ };
12
+ documentStatus: {
13
+ openAttestationDidSignedDocumentStatus: Verifier<_tradetrust_tt_tt_verify.OpenAttestationDidSignedDocumentStatusVerificationFragment>;
14
+ openAttestationEthereumDocumentStoreStatus: Verifier<_tradetrust_tt_tt_verify.OpenAttestationEthereumDocumentStoreStatusFragment>;
15
+ openAttestationEthereumTokenRegistryStatus: Verifier<_tradetrust_tt_tt_verify.OpenAttestationEthereumTokenRegistryStatusFragment>;
16
+ w3cCredentialStatus: Verifier<VerificationFragment>;
17
+ credentialStatusTransferableRecordVerifier: VerifierType;
18
+ };
19
+ issuerIdentity: {
20
+ openAttestationDidIdentityProof: Verifier<_tradetrust_tt_tt_verify.OpenAttestationDidIdentityProofVerificationFragment>;
21
+ openAttestationDnsDidIdentityProof: Verifier<_tradetrust_tt_tt_verify.OpenAttestationDnsDidIdentityProofVerificationFragment>;
22
+ openAttestationDnsTxtIdentityProof: Verifier<_tradetrust_tt_tt_verify.OpenAttestationDnsTxtIdentityProofVerificationFragment>;
23
+ w3cIssuerIdentity: Verifier<VerificationFragment>;
24
+ };
25
+ };
26
+ declare const openAttestationVerifiers: (Verifier<_tradetrust_tt_tt_verify.OpenAttestationEthereumTokenRegistryStatusFragment> | Verifier<_tradetrust_tt_tt_verify.OpenAttestationDidIdentityProofVerificationFragment> | Verifier<_tradetrust_tt_tt_verify.OpenAttestationDnsTxtIdentityProofVerificationFragment> | Verifier<_tradetrust_tt_tt_verify.OpenAttestationHashVerificationFragment> | Verifier<_tradetrust_tt_tt_verify.OpenAttestationEthereumDocumentStoreStatusFragment> | Verifier<_tradetrust_tt_tt_verify.OpenAttestationDidSignedDocumentStatusVerificationFragment> | Verifier<_tradetrust_tt_tt_verify.OpenAttestationDnsDidIdentityProofVerificationFragment>)[];
27
+ declare const w3cVerifiers: Verifier<VerificationFragment>[];
28
+
29
+ export { openAttestationVerifiers, verifiers, w3cVerifiers };
@@ -0,0 +1,29 @@
1
+ import { VerifierType } from './fragments/document-status/transferableRecords/transferableRecordVerifier.types.js';
2
+ import * as _tradetrust_tt_tt_verify from '@tradetrust-tt/tt-verify';
3
+ export { isValid, verificationBuilder, verify } from '@tradetrust-tt/tt-verify';
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, VerifierOptions } from '@tradetrust-tt/tt-verify/dist/types/src/types/core';
6
+
7
+ declare const verifiers: {
8
+ documentIntegrity: {
9
+ openAttestationHash: Verifier<_tradetrust_tt_tt_verify.OpenAttestationHashVerificationFragment>;
10
+ w3cSignatureIntegrity: Verifier<VerificationFragment>;
11
+ };
12
+ documentStatus: {
13
+ openAttestationDidSignedDocumentStatus: Verifier<_tradetrust_tt_tt_verify.OpenAttestationDidSignedDocumentStatusVerificationFragment>;
14
+ openAttestationEthereumDocumentStoreStatus: Verifier<_tradetrust_tt_tt_verify.OpenAttestationEthereumDocumentStoreStatusFragment>;
15
+ openAttestationEthereumTokenRegistryStatus: Verifier<_tradetrust_tt_tt_verify.OpenAttestationEthereumTokenRegistryStatusFragment>;
16
+ w3cCredentialStatus: Verifier<VerificationFragment>;
17
+ credentialStatusTransferableRecordVerifier: VerifierType;
18
+ };
19
+ issuerIdentity: {
20
+ openAttestationDidIdentityProof: Verifier<_tradetrust_tt_tt_verify.OpenAttestationDidIdentityProofVerificationFragment>;
21
+ openAttestationDnsDidIdentityProof: Verifier<_tradetrust_tt_tt_verify.OpenAttestationDnsDidIdentityProofVerificationFragment>;
22
+ openAttestationDnsTxtIdentityProof: Verifier<_tradetrust_tt_tt_verify.OpenAttestationDnsTxtIdentityProofVerificationFragment>;
23
+ w3cIssuerIdentity: Verifier<VerificationFragment>;
24
+ };
25
+ };
26
+ declare const openAttestationVerifiers: (Verifier<_tradetrust_tt_tt_verify.OpenAttestationEthereumTokenRegistryStatusFragment> | Verifier<_tradetrust_tt_tt_verify.OpenAttestationDidIdentityProofVerificationFragment> | Verifier<_tradetrust_tt_tt_verify.OpenAttestationDnsTxtIdentityProofVerificationFragment> | Verifier<_tradetrust_tt_tt_verify.OpenAttestationHashVerificationFragment> | Verifier<_tradetrust_tt_tt_verify.OpenAttestationEthereumDocumentStoreStatusFragment> | Verifier<_tradetrust_tt_tt_verify.OpenAttestationDidSignedDocumentStatusVerificationFragment> | Verifier<_tradetrust_tt_tt_verify.OpenAttestationDnsDidIdentityProofVerificationFragment>)[];
27
+ declare const w3cVerifiers: Verifier<VerificationFragment>[];
28
+
29
+ export { openAttestationVerifiers, verifiers, w3cVerifiers };
@@ -0,0 +1,53 @@
1
+ 'use strict';
2
+
3
+ var ttVerify = require('@tradetrust-tt/tt-verify');
4
+ var w3cSignatureIntegrity = require('./fragments/document-integrity/w3cSignatureIntegrity');
5
+ var transferableRecordVerifier = require('./fragments/document-status/transferableRecords/transferableRecordVerifier');
6
+ var w3cCredentialStatus = require('./fragments/document-status/w3cCredentialStatus');
7
+ var w3cIssuerIdentity = require('./fragments/issuer-identity/w3cIssuerIdentity');
8
+
9
+ const verifiers = {
10
+ documentIntegrity: {
11
+ openAttestationHash: ttVerify.openAttestationHash,
12
+ w3cSignatureIntegrity: w3cSignatureIntegrity.w3cSignatureIntegrity
13
+ },
14
+ documentStatus: {
15
+ openAttestationDidSignedDocumentStatus: ttVerify.openAttestationDidSignedDocumentStatus,
16
+ openAttestationEthereumDocumentStoreStatus: ttVerify.openAttestationEthereumDocumentStoreStatus,
17
+ openAttestationEthereumTokenRegistryStatus: ttVerify.openAttestationEthereumTokenRegistryStatus,
18
+ w3cCredentialStatus: w3cCredentialStatus.w3cCredentialStatus,
19
+ credentialStatusTransferableRecordVerifier: transferableRecordVerifier.credentialStatusTransferableRecordVerifier
20
+ },
21
+ issuerIdentity: {
22
+ openAttestationDidIdentityProof: ttVerify.openAttestationDidIdentityProof,
23
+ openAttestationDnsDidIdentityProof: ttVerify.openAttestationDnsDidIdentityProof,
24
+ openAttestationDnsTxtIdentityProof: ttVerify.openAttestationDnsTxtIdentityProof,
25
+ w3cIssuerIdentity: w3cIssuerIdentity.w3cIssuerIdentity
26
+ }
27
+ };
28
+ const openAttestationVerifiers = [
29
+ ...ttVerify.openAttestationVerifiers,
30
+ ttVerify.openAttestationDidIdentityProof
31
+ ];
32
+ const w3cVerifiers = [
33
+ w3cSignatureIntegrity.w3cSignatureIntegrity,
34
+ w3cCredentialStatus.w3cCredentialStatus,
35
+ transferableRecordVerifier.credentialStatusTransferableRecordVerifier,
36
+ w3cIssuerIdentity.w3cIssuerIdentity
37
+ ];
38
+
39
+ Object.defineProperty(exports, "isValid", {
40
+ enumerable: true,
41
+ get: function () { return ttVerify.isValid; }
42
+ });
43
+ Object.defineProperty(exports, "verificationBuilder", {
44
+ enumerable: true,
45
+ get: function () { return ttVerify.verificationBuilder; }
46
+ });
47
+ Object.defineProperty(exports, "verify", {
48
+ enumerable: true,
49
+ get: function () { return ttVerify.verify; }
50
+ });
51
+ exports.openAttestationVerifiers = openAttestationVerifiers;
52
+ exports.verifiers = verifiers;
53
+ exports.w3cVerifiers = w3cVerifiers;
@@ -0,0 +1 @@
1
+ export * from '@trustvc/w3c-context';
@@ -0,0 +1 @@
1
+ export * from '@trustvc/w3c-context';
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var w3cContext = require('@trustvc/w3c-context');
4
+
5
+
6
+
7
+ Object.keys(w3cContext).forEach(function (k) {
8
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
9
+ enumerable: true,
10
+ get: function () { return w3cContext[k]; }
11
+ });
12
+ });
@@ -0,0 +1 @@
1
+ export * from '@trustvc/w3c-credential-status';
@@ -0,0 +1 @@
1
+ export * from '@trustvc/w3c-credential-status';
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var w3cCredentialStatus = require('@trustvc/w3c-credential-status');
4
+
5
+
6
+
7
+ Object.keys(w3cCredentialStatus).forEach(function (k) {
8
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
9
+ enumerable: true,
10
+ get: function () { return w3cCredentialStatus[k]; }
11
+ });
12
+ });
@@ -0,0 +1,10 @@
1
+ export { i as context } from '../index-DwAYXQn2.mjs';
2
+ export { i as credentialStatus } from '../index-CjwEVGoM.mjs';
3
+ export { i as isser } from '../index-ClF4_Nqk.mjs';
4
+ export { signW3C } from './sign.mjs';
5
+ export { RawVerifiableCredential, SignedVerifiableCredential, SigningResult, VerificationResult } from '@trustvc/w3c-vc';
6
+ export { PrivateKeyPair } from '@trustvc/w3c-issuer';
7
+ export { i as vc } from '../index-1ws_BWZW.mjs';
8
+ export { verifyW3CSignature } from './verify.mjs';
9
+ import '@trustvc/w3c-context';
10
+ import '@trustvc/w3c-credential-status';
@@ -0,0 +1,10 @@
1
+ export { i as context } from '../index-DwAYXQn2.js';
2
+ export { i as credentialStatus } from '../index-CjwEVGoM.js';
3
+ export { i as isser } from '../index-ClF4_Nqk.js';
4
+ export { signW3C } from './sign.js';
5
+ export { RawVerifiableCredential, SignedVerifiableCredential, SigningResult, VerificationResult } from '@trustvc/w3c-vc';
6
+ export { PrivateKeyPair } from '@trustvc/w3c-issuer';
7
+ export { i as vc } from '../index-1ws_BWZW.js';
8
+ export { verifyW3CSignature } from './verify.js';
9
+ import '@trustvc/w3c-context';
10
+ import '@trustvc/w3c-credential-status';
@@ -0,0 +1,57 @@
1
+ 'use strict';
2
+
3
+ var context = require('./context');
4
+ var credentialStatus = require('./credential-status');
5
+ var issuer = require('./issuer');
6
+ var sign = require('./sign');
7
+ var types = require('./types');
8
+ var vc = require('./vc');
9
+ var verify = require('./verify');
10
+
11
+ function _interopNamespace(e) {
12
+ if (e && e.__esModule) return e;
13
+ var n = Object.create(null);
14
+ if (e) {
15
+ Object.keys(e).forEach(function (k) {
16
+ if (k !== 'default') {
17
+ var d = Object.getOwnPropertyDescriptor(e, k);
18
+ Object.defineProperty(n, k, d.get ? d : {
19
+ enumerable: true,
20
+ get: function () { return e[k]; }
21
+ });
22
+ }
23
+ });
24
+ }
25
+ n.default = e;
26
+ return Object.freeze(n);
27
+ }
28
+
29
+ var context__namespace = /*#__PURE__*/_interopNamespace(context);
30
+ var credentialStatus__namespace = /*#__PURE__*/_interopNamespace(credentialStatus);
31
+ var issuer__namespace = /*#__PURE__*/_interopNamespace(issuer);
32
+ var vc__namespace = /*#__PURE__*/_interopNamespace(vc);
33
+
34
+
35
+
36
+ exports.context = context__namespace;
37
+ exports.credentialStatus = credentialStatus__namespace;
38
+ exports.isser = issuer__namespace;
39
+ exports.vc = vc__namespace;
40
+ Object.keys(sign).forEach(function (k) {
41
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
42
+ enumerable: true,
43
+ get: function () { return sign[k]; }
44
+ });
45
+ });
46
+ Object.keys(types).forEach(function (k) {
47
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
48
+ enumerable: true,
49
+ get: function () { return types[k]; }
50
+ });
51
+ });
52
+ Object.keys(verify).forEach(function (k) {
53
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
54
+ enumerable: true,
55
+ get: function () { return verify[k]; }
56
+ });
57
+ });
@@ -0,0 +1 @@
1
+ export * from '@trustvc/w3c-issuer';
@@ -0,0 +1 @@
1
+ export * from '@trustvc/w3c-issuer';
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var w3cIssuer = require('@trustvc/w3c-issuer');
4
+
5
+
6
+
7
+ Object.keys(w3cIssuer).forEach(function (k) {
8
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
9
+ enumerable: true,
10
+ get: function () { return w3cIssuer[k]; }
11
+ });
12
+ });
@@ -0,0 +1,6 @@
1
+ import { RawVerifiableCredential, SigningResult } from '@trustvc/w3c-vc';
2
+ import { PrivateKeyPair } from '@trustvc/w3c-issuer';
3
+
4
+ declare const signW3C: (credential: RawVerifiableCredential, keyPair: PrivateKeyPair, cryptoSuite?: string) => Promise<SigningResult>;
5
+
6
+ export { signW3C };