@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,45 @@
1
+ 'use strict';
2
+
3
+ var tradetrust = require('@tradetrust-tt/tradetrust');
4
+
5
+ var __defProp = Object.defineProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ const wrapOADocumentV2 = /* @__PURE__ */ __name(async (document) => {
8
+ return tradetrust.wrapDocument(document);
9
+ }, "wrapOADocumentV2");
10
+ const wrapOADocumentsV2 = /* @__PURE__ */ __name(async (documents) => {
11
+ return tradetrust.wrapDocuments(documents);
12
+ }, "wrapOADocumentsV2");
13
+ async function wrapOADocument(document) {
14
+ if (tradetrust.utils.isRawV2Document(document)) {
15
+ return wrapOADocumentV2(document);
16
+ } else if (tradetrust.utils.isRawV3Document(document)) {
17
+ return tradetrust.__unsafe__use__it__at__your__own__risks__wrapDocument(document);
18
+ } else {
19
+ throw new Error("Unsupported document version");
20
+ }
21
+ }
22
+ __name(wrapOADocument, "wrapOADocument");
23
+ async function wrapOADocuments(documents) {
24
+ if (documents.every((s) => tradetrust.utils.isRawV2Document(s))) {
25
+ return wrapOADocumentsV2(documents);
26
+ } else if (documents.every((s) => tradetrust.utils.isRawV3Document(s))) {
27
+ return tradetrust.__unsafe__use__it__at__your__own__risks__wrapDocuments(documents);
28
+ } else {
29
+ throw new Error("Unsupported documents version");
30
+ }
31
+ }
32
+ __name(wrapOADocuments, "wrapOADocuments");
33
+
34
+ Object.defineProperty(exports, "wrapOADocumentV3", {
35
+ enumerable: true,
36
+ get: function () { return tradetrust.__unsafe__use__it__at__your__own__risks__wrapDocument; }
37
+ });
38
+ Object.defineProperty(exports, "wrapOADocumentsV3", {
39
+ enumerable: true,
40
+ get: function () { return tradetrust.__unsafe__use__it__at__your__own__risks__wrapDocuments; }
41
+ });
42
+ exports.wrapOADocument = wrapOADocument;
43
+ exports.wrapOADocumentV2 = wrapOADocumentV2;
44
+ exports.wrapOADocuments = wrapOADocuments;
45
+ exports.wrapOADocumentsV2 = wrapOADocumentsV2;
@@ -0,0 +1 @@
1
+ export * from '@tradetrust-tt/token-registry-v4/contracts';
@@ -0,0 +1 @@
1
+ export * from '@tradetrust-tt/token-registry-v4/contracts';
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var contracts = require('@tradetrust-tt/token-registry-v4/contracts');
4
+
5
+
6
+
7
+ Object.keys(contracts).forEach(function (k) {
8
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
9
+ enumerable: true,
10
+ get: function () { return contracts[k]; }
11
+ });
12
+ });
@@ -0,0 +1 @@
1
+ export * from '@tradetrust-tt/token-registry-v4';
@@ -0,0 +1 @@
1
+ export * from '@tradetrust-tt/token-registry-v4';
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var tokenRegistryV4 = require('@tradetrust-tt/token-registry-v4');
4
+
5
+
6
+
7
+ 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
+ });
12
+ });
@@ -0,0 +1,12 @@
1
+ declare const supportInterfaceIds: {
2
+ TradeTrustTokenMintable: string;
3
+ TradeTrustTokenBurnable: string;
4
+ TradeTrustTokenRestorable: string;
5
+ TitleEscrow: string;
6
+ TitleEscrowSignable: string;
7
+ TitleEscrowFactory: string;
8
+ AccessControl: string;
9
+ SBT: string;
10
+ };
11
+
12
+ export { supportInterfaceIds };
@@ -0,0 +1,12 @@
1
+ declare const supportInterfaceIds: {
2
+ TradeTrustTokenMintable: string;
3
+ TradeTrustTokenBurnable: string;
4
+ TradeTrustTokenRestorable: string;
5
+ TitleEscrow: string;
6
+ TitleEscrowSignable: string;
7
+ TitleEscrowFactory: string;
8
+ AccessControl: string;
9
+ SBT: string;
10
+ };
11
+
12
+ export { supportInterfaceIds };
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ var tokenRegistryV4 = require('@tradetrust-tt/token-registry-v4');
4
+
5
+ const supportInterfaceIds = tokenRegistryV4.constants.contractInterfaceId;
6
+
7
+ exports.supportInterfaceIds = supportInterfaceIds;
@@ -0,0 +1 @@
1
+ export * from '@tradetrust-tt/token-registry-v5/contracts';
@@ -0,0 +1 @@
1
+ export * from '@tradetrust-tt/token-registry-v5/contracts';
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var contracts = require('@tradetrust-tt/token-registry-v5/contracts');
4
+
5
+
6
+
7
+ Object.keys(contracts).forEach(function (k) {
8
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
9
+ enumerable: true,
10
+ get: function () { return contracts[k]; }
11
+ });
12
+ });
@@ -0,0 +1 @@
1
+ export * from '@tradetrust-tt/token-registry-v5';
@@ -0,0 +1 @@
1
+ export * from '@tradetrust-tt/token-registry-v5';
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var tokenRegistryV5 = require('@tradetrust-tt/token-registry-v5');
4
+
5
+
6
+
7
+ 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
+ });
12
+ });
@@ -0,0 +1,12 @@
1
+ declare const supportInterfaceIds: {
2
+ TradeTrustTokenMintable: string;
3
+ TradeTrustTokenBurnable: string;
4
+ TradeTrustTokenRestorable: string;
5
+ TitleEscrow: string;
6
+ TitleEscrowSignable: string;
7
+ TitleEscrowFactory: string;
8
+ AccessControl: string;
9
+ SBT: string;
10
+ };
11
+
12
+ export { supportInterfaceIds };
@@ -0,0 +1,12 @@
1
+ declare const supportInterfaceIds: {
2
+ TradeTrustTokenMintable: string;
3
+ TradeTrustTokenBurnable: string;
4
+ TradeTrustTokenRestorable: string;
5
+ TitleEscrow: string;
6
+ TitleEscrowSignable: string;
7
+ TitleEscrowFactory: string;
8
+ AccessControl: string;
9
+ SBT: string;
10
+ };
11
+
12
+ export { supportInterfaceIds };
@@ -0,0 +1,7 @@
1
+ 'use strict';
2
+
3
+ var tokenRegistryV5 = require('@tradetrust-tt/token-registry-v5');
4
+
5
+ const supportInterfaceIds = tokenRegistryV5.constants.contractInterfaceId;
6
+
7
+ exports.supportInterfaceIds = supportInterfaceIds;
@@ -0,0 +1 @@
1
+ export { errorMessageHandling, interpretFragments } from '@tradetrust-tt/tradetrust-utils';
@@ -0,0 +1 @@
1
+ export { errorMessageHandling, interpretFragments } from '@tradetrust-tt/tradetrust-utils';
@@ -0,0 +1,14 @@
1
+ 'use strict';
2
+
3
+ var tradetrustUtils = require('@tradetrust-tt/tradetrust-utils');
4
+
5
+
6
+
7
+ Object.defineProperty(exports, "errorMessageHandling", {
8
+ enumerable: true,
9
+ get: function () { return tradetrustUtils.errorMessageHandling; }
10
+ });
11
+ Object.defineProperty(exports, "interpretFragments", {
12
+ enumerable: true,
13
+ get: function () { return tradetrustUtils.interpretFragments; }
14
+ });
@@ -0,0 +1,4 @@
1
+ export { errorMessageHandling, interpretFragments } from '@tradetrust-tt/tradetrust-utils';
2
+ export * from '@tradetrust-tt/tradetrust-utils/constants/network';
3
+ export { generate12ByteNonce, generate32ByteKey, stringToUint8Array } from './stringUtils/index.mjs';
4
+ export * from '@tradetrust-tt/tradetrust-utils/constants/supportedChains';
@@ -0,0 +1,4 @@
1
+ export { errorMessageHandling, interpretFragments } from '@tradetrust-tt/tradetrust-utils';
2
+ export * from '@tradetrust-tt/tradetrust-utils/constants/network';
3
+ export { generate12ByteNonce, generate32ByteKey, stringToUint8Array } from './stringUtils/index.js';
4
+ export * from '@tradetrust-tt/tradetrust-utils/constants/supportedChains';
@@ -0,0 +1,33 @@
1
+ 'use strict';
2
+
3
+ var fragment = require('./fragment');
4
+ var network = require('./network');
5
+ var stringUtils = require('./stringUtils');
6
+ var supportedChains = require('./supportedChains');
7
+
8
+
9
+
10
+ Object.keys(fragment).forEach(function (k) {
11
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
12
+ enumerable: true,
13
+ get: function () { return fragment[k]; }
14
+ });
15
+ });
16
+ Object.keys(network).forEach(function (k) {
17
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
18
+ enumerable: true,
19
+ get: function () { return network[k]; }
20
+ });
21
+ });
22
+ Object.keys(stringUtils).forEach(function (k) {
23
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
24
+ enumerable: true,
25
+ get: function () { return stringUtils[k]; }
26
+ });
27
+ });
28
+ Object.keys(supportedChains).forEach(function (k) {
29
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
30
+ enumerable: true,
31
+ get: function () { return supportedChains[k]; }
32
+ });
33
+ });
@@ -0,0 +1 @@
1
+ export * from '@tradetrust-tt/tradetrust-utils/constants/network';
@@ -0,0 +1 @@
1
+ export * from '@tradetrust-tt/tradetrust-utils/constants/network';
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var network = require('@tradetrust-tt/tradetrust-utils/constants/network');
4
+
5
+
6
+
7
+ Object.keys(network).forEach(function (k) {
8
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
9
+ enumerable: true,
10
+ get: function () { return network[k]; }
11
+ });
12
+ });
@@ -0,0 +1,9 @@
1
+ import '@tradetrust-tt/tradetrust-utils';
2
+ import '@tradetrust-tt/tradetrust-utils/constants/network';
3
+ import '@tradetrust-tt/tradetrust-utils/constants/supportedChains';
4
+
5
+ declare function stringToUint8Array(str: string): Uint8Array;
6
+ declare function generate32ByteKey(input: string): string;
7
+ declare function generate12ByteNonce(input: string): string;
8
+
9
+ export { generate12ByteNonce, generate32ByteKey, stringToUint8Array };
@@ -0,0 +1,9 @@
1
+ import '@tradetrust-tt/tradetrust-utils';
2
+ import '@tradetrust-tt/tradetrust-utils/constants/network';
3
+ import '@tradetrust-tt/tradetrust-utils/constants/supportedChains';
4
+
5
+ declare function stringToUint8Array(str: string): Uint8Array;
6
+ declare function generate32ByteKey(input: string): string;
7
+ declare function generate12ByteNonce(input: string): string;
8
+
9
+ export { generate12ByteNonce, generate32ByteKey, stringToUint8Array };
@@ -0,0 +1,24 @@
1
+ 'use strict';
2
+
3
+ var jsSha3 = require('js-sha3');
4
+
5
+ var __defProp = Object.defineProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ function stringToUint8Array(str) {
8
+ return new Uint8Array(Buffer.from(str, "utf-8"));
9
+ }
10
+ __name(stringToUint8Array, "stringToUint8Array");
11
+ function generate32ByteKey(input) {
12
+ const hash = jsSha3.shake256(input, 128);
13
+ return hash;
14
+ }
15
+ __name(generate32ByteKey, "generate32ByteKey");
16
+ function generate12ByteNonce(input) {
17
+ const nonce = jsSha3.shake256(input, 48);
18
+ return nonce;
19
+ }
20
+ __name(generate12ByteNonce, "generate12ByteNonce");
21
+
22
+ exports.generate12ByteNonce = generate12ByteNonce;
23
+ exports.generate32ByteKey = generate32ByteKey;
24
+ exports.stringToUint8Array = stringToUint8Array;
@@ -0,0 +1 @@
1
+ export * from '@tradetrust-tt/tradetrust-utils/constants/supportedChains';
@@ -0,0 +1 @@
1
+ export * from '@tradetrust-tt/tradetrust-utils/constants/supportedChains';
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ var supportedChains = require('@tradetrust-tt/tradetrust-utils/constants/supportedChains');
4
+
5
+
6
+
7
+ Object.keys(supportedChains).forEach(function (k) {
8
+ if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
9
+ enumerable: true,
10
+ get: function () { return supportedChains[k]; }
11
+ });
12
+ });
@@ -0,0 +1,5 @@
1
+ import { Verifier, VerificationFragment } from '@tradetrust-tt/tt-verify';
2
+
3
+ declare const w3cSignatureIntegrity: Verifier<VerificationFragment>;
4
+
5
+ export { w3cSignatureIntegrity };
@@ -0,0 +1,5 @@
1
+ import { Verifier, VerificationFragment } from '@tradetrust-tt/tt-verify';
2
+
3
+ declare const w3cSignatureIntegrity: Verifier<VerificationFragment>;
4
+
5
+ export { w3cSignatureIntegrity };
@@ -0,0 +1,48 @@
1
+ 'use strict';
2
+
3
+ var __ = require('../../..');
4
+
5
+ var __defProp = Object.defineProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ const w3cSignatureIntegrity = {
8
+ skip: /* @__PURE__ */ __name(async () => {
9
+ return {
10
+ type: "DOCUMENT_INTEGRITY",
11
+ name: "W3CSignatureIntegrity",
12
+ reason: {
13
+ code: 0,
14
+ codeString: "SKIPPED",
15
+ message: `Document either has no proof or proof.type is not 'BbsBlsSignature2020'.`
16
+ },
17
+ status: "SKIPPED"
18
+ };
19
+ }, "skip"),
20
+ test: /* @__PURE__ */ __name((document) => {
21
+ const doc = document;
22
+ return doc.proof?.type === "BbsBlsSignature2020";
23
+ }, "test"),
24
+ verify: /* @__PURE__ */ __name(async (document) => {
25
+ const doc = document;
26
+ const verificationResult = await __.verifyW3CSignature(doc);
27
+ if (verificationResult.verified) {
28
+ return {
29
+ type: "DOCUMENT_INTEGRITY",
30
+ name: "W3CSignatureIntegrity",
31
+ data: true,
32
+ status: "VALID"
33
+ };
34
+ } else {
35
+ return {
36
+ type: "DOCUMENT_INTEGRITY",
37
+ name: "W3CSignatureIntegrity",
38
+ data: false,
39
+ reason: {
40
+ message: verificationResult.error
41
+ },
42
+ status: "INVALID"
43
+ };
44
+ }
45
+ }, "verify")
46
+ };
47
+
48
+ exports.w3cSignatureIntegrity = w3cSignatureIntegrity;
@@ -0,0 +1,7 @@
1
+ import { VerifierType } from './transferableRecordVerifier.types.mjs';
2
+ import '@tradetrust-tt/tt-verify';
3
+
4
+ declare const TRANSFERABLE_RECORDS_TYPE = "TransferableRecords";
5
+ declare const credentialStatusTransferableRecordVerifier: VerifierType;
6
+
7
+ export { TRANSFERABLE_RECORDS_TYPE, credentialStatusTransferableRecordVerifier };
@@ -0,0 +1,7 @@
1
+ import { VerifierType } from './transferableRecordVerifier.types.js';
2
+ import '@tradetrust-tt/tt-verify';
3
+
4
+ declare const TRANSFERABLE_RECORDS_TYPE = "TransferableRecords";
5
+ declare const credentialStatusTransferableRecordVerifier: VerifierType;
6
+
7
+ export { TRANSFERABLE_RECORDS_TYPE, credentialStatusTransferableRecordVerifier };
@@ -0,0 +1,128 @@
1
+ 'use strict';
2
+
3
+ var ttVerify = require('@tradetrust-tt/tt-verify');
4
+ var w3cVC = require('@trustvc/w3c-vc');
5
+ var utils = require('./utils');
6
+
7
+ function _interopNamespace(e) {
8
+ if (e && e.__esModule) return e;
9
+ var n = Object.create(null);
10
+ if (e) {
11
+ Object.keys(e).forEach(function (k) {
12
+ if (k !== 'default') {
13
+ var d = Object.getOwnPropertyDescriptor(e, k);
14
+ Object.defineProperty(n, k, d.get ? d : {
15
+ enumerable: true,
16
+ get: function () { return e[k]; }
17
+ });
18
+ }
19
+ });
20
+ }
21
+ n.default = e;
22
+ return Object.freeze(n);
23
+ }
24
+
25
+ var w3cVC__namespace = /*#__PURE__*/_interopNamespace(w3cVC);
26
+
27
+ var __defProp = Object.defineProperty;
28
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
29
+ const TRANSFERABLE_RECORDS_TYPE = "TransferableRecords";
30
+ const type = "DOCUMENT_STATUS";
31
+ const name = TRANSFERABLE_RECORDS_TYPE;
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
+ }
54
+ const { provider } = options;
55
+ const mintStatus = await utils.isTokenMintedOnRegistry({
56
+ tokenRegistryAddress: credentialStatus?.tokenRegistry,
57
+ tokenId,
58
+ provider
59
+ });
60
+ const result = {
61
+ name,
62
+ type,
63
+ status: "INVALID",
64
+ data: {
65
+ tokenRegistry: credentialStatus.tokenRegistry
66
+ }
67
+ };
68
+ if (ttVerify.ValidTokenRegistryStatus.guard(mintStatus)) {
69
+ result.status = "VALID";
70
+ } else {
71
+ result.reason = mintStatus.reason;
72
+ }
73
+ return result;
74
+ }, "verify");
75
+ const skip = /* @__PURE__ */ __name(async () => {
76
+ return {
77
+ status: "SKIPPED",
78
+ type,
79
+ name,
80
+ reason: {
81
+ code: ttVerify.OpenAttestationEthereumTokenRegistryStatusCode.SKIPPED,
82
+ codeString: ttVerify.OpenAttestationEthereumTokenRegistryStatusCode[ttVerify.OpenAttestationEthereumTokenRegistryStatusCode.SKIPPED],
83
+ message: `Document does not have TransferableRecords status`
84
+ }
85
+ };
86
+ }, "skip");
87
+ const test = /* @__PURE__ */ __name((document) => {
88
+ if (document?.credentialStatus?.type === TRANSFERABLE_RECORDS_TYPE) {
89
+ return true;
90
+ }
91
+ return false;
92
+ }, "test");
93
+ const credentialStatusTransferableRecordVerifier = {
94
+ skip,
95
+ test,
96
+ verify: /* @__PURE__ */ __name(async (...args) => {
97
+ try {
98
+ return await verify(...args);
99
+ } catch (e) {
100
+ if (e instanceof ttVerify.CodedError) {
101
+ const err = {
102
+ name,
103
+ type,
104
+ status: "ERROR",
105
+ reason: {
106
+ code: e.code,
107
+ codeString: e.codeString,
108
+ message: e.message
109
+ }
110
+ };
111
+ return err;
112
+ }
113
+ return {
114
+ name,
115
+ type,
116
+ status: "ERROR",
117
+ reason: {
118
+ code: ttVerify.OpenAttestationEthereumTokenRegistryStatusCode.UNEXPECTED_ERROR,
119
+ codeString: ttVerify.OpenAttestationEthereumTokenRegistryStatusCode[ttVerify.OpenAttestationEthereumTokenRegistryStatusCode.UNEXPECTED_ERROR],
120
+ message: e instanceof Error ? e.message : "An unexpected error occurred"
121
+ }
122
+ };
123
+ }
124
+ }, "verify")
125
+ };
126
+
127
+ exports.TRANSFERABLE_RECORDS_TYPE = TRANSFERABLE_RECORDS_TYPE;
128
+ exports.credentialStatusTransferableRecordVerifier = credentialStatusTransferableRecordVerifier;
@@ -0,0 +1,30 @@
1
+ import { OpenAttestationEthereumTokenRegistryStatusCode, VerificationFragment, ErrorVerificationFragment, Verifier } from '@tradetrust-tt/tt-verify';
2
+
3
+ type TransferableRecordsErrorReason = {
4
+ code: OpenAttestationEthereumTokenRegistryStatusCode;
5
+ codeString: string;
6
+ message: string;
7
+ };
8
+ type TransferableRecordsResultFragment = VerificationFragment & {
9
+ status: 'VALID' | 'INVALID';
10
+ data: {
11
+ tokenRegistry: string;
12
+ };
13
+ reason?: TransferableRecordsErrorReason;
14
+ };
15
+ type TransferableRecordsErrorFragment = Omit<ErrorVerificationFragment<never>, 'data'> & {
16
+ data?: never;
17
+ reason: TransferableRecordsErrorReason;
18
+ };
19
+ type TransferableRecordsVerificationFragment = TransferableRecordsResultFragment | TransferableRecordsErrorFragment;
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
+
30
+ export type { TransferableRecordCredentialStatus, TransferableRecordsErrorFragment, TransferableRecordsErrorReason, TransferableRecordsResultFragment, TransferableRecordsVerificationFragment, VerifierType };
@@ -0,0 +1,30 @@
1
+ import { OpenAttestationEthereumTokenRegistryStatusCode, VerificationFragment, ErrorVerificationFragment, Verifier } from '@tradetrust-tt/tt-verify';
2
+
3
+ type TransferableRecordsErrorReason = {
4
+ code: OpenAttestationEthereumTokenRegistryStatusCode;
5
+ codeString: string;
6
+ message: string;
7
+ };
8
+ type TransferableRecordsResultFragment = VerificationFragment & {
9
+ status: 'VALID' | 'INVALID';
10
+ data: {
11
+ tokenRegistry: string;
12
+ };
13
+ reason?: TransferableRecordsErrorReason;
14
+ };
15
+ type TransferableRecordsErrorFragment = Omit<ErrorVerificationFragment<never>, 'data'> & {
16
+ data?: never;
17
+ reason: TransferableRecordsErrorReason;
18
+ };
19
+ type TransferableRecordsVerificationFragment = TransferableRecordsResultFragment | TransferableRecordsErrorFragment;
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
+
30
+ export type { TransferableRecordCredentialStatus, TransferableRecordsErrorFragment, TransferableRecordsErrorReason, TransferableRecordsResultFragment, TransferableRecordsVerificationFragment, VerifierType };
@@ -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 };