@degenerate/generic 0.2.6 → 0.3.2

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 (162) hide show
  1. package/dist/application/audit-log/additional-ids/create-audit-log-additional-ids-with-query.d.ts.map +1 -1
  2. package/dist/application/audit-log/additional-ids/create-multiple-path-alai.d.ts.map +1 -1
  3. package/dist/application/audit-log/additional-ids/create-query-audit-log-for-alai.d.ts.map +1 -1
  4. package/dist/application/audit-log/create-application-audit-log.d.ts.map +1 -1
  5. package/dist/application/audit-log/create-application-audit-log.js +1 -1
  6. package/dist/application/database/firestore/generics/add-items-to-database.d.ts.map +1 -1
  7. package/dist/application/database/firestore/generics/add-items-to-database.js +2 -2
  8. package/dist/application/database/firestore/generics/add-or-update-items-to-database.d.ts.map +1 -1
  9. package/dist/application/database/firestore/generics/add-or-update-items-to-database.js +3 -3
  10. package/dist/application/database/firestore/generics/create-database-change-information.d.ts.map +1 -1
  11. package/dist/application/database/firestore/generics/delete-items-on-database.d.ts.map +1 -1
  12. package/dist/application/database/firestore/generics/delete-items-on-database.js +2 -2
  13. package/dist/application/database/firestore/generics/get-item-from-database.d.ts.map +1 -1
  14. package/dist/application/database/firestore/generics/get-item-from-database.js +2 -2
  15. package/dist/application/database/firestore/generics/get-items-different-path-on-database.d.ts.map +1 -1
  16. package/dist/application/database/firestore/generics/get-items-different-path-on-database.js +2 -2
  17. package/dist/application/database/firestore/generics/get-items-from-database.d.ts.map +1 -1
  18. package/dist/application/database/firestore/generics/get-items-from-database.js +1 -1
  19. package/dist/application/database/firestore/generics/update-items-on-database.d.ts.map +1 -1
  20. package/dist/application/database/firestore/generics/update-items-on-database.js +2 -2
  21. package/dist/application/database/firestore/generics/update-items-properties-on-database.d.ts.map +1 -1
  22. package/dist/application/database/firestore/generics/update-items-properties-on-database.js +2 -2
  23. package/dist/authorization/index.d.ts +1 -0
  24. package/dist/authorization/index.d.ts.map +1 -1
  25. package/dist/authorization/index.js +1 -0
  26. package/dist/authorization/jwt/keys/create-public-key-pem.d.ts.map +1 -1
  27. package/dist/authorization/jwt/keys/create-secret-key-pem.d.ts.map +1 -1
  28. package/dist/authorization/jwt/sign/create-authorization-issuer.d.ts.map +1 -1
  29. package/dist/authorization/jwt/sign/create-authorization-subject.d.ts.map +1 -1
  30. package/dist/authorization/jwt/sign/create-jwt-options.d.ts +7 -1
  31. package/dist/authorization/jwt/sign/create-jwt-options.d.ts.map +1 -1
  32. package/dist/authorization/jwt/sign/create-jwt-signed-token.d.ts.map +1 -1
  33. package/dist/authorization/jwt/transform/transform-token-payload-to-safe-payload.d.ts.map +1 -1
  34. package/dist/authorization/jwt/verify/get-decoded-jwt-header.d.ts.map +1 -1
  35. package/dist/authorization/jwt/verify/get-decoded-jwt-signed-token-payload.d.ts.map +1 -1
  36. package/dist/authorization/jwt/verify/verify-jwt-signed-token.d.ts.map +1 -1
  37. package/dist/authorization/safe/request/decode-bearer-token.d.ts.map +1 -1
  38. package/dist/authorization/safe/request/decode-safe-request.d.ts.map +1 -1
  39. package/dist/authorization/safe/request/determine-issuer-from-request.d.ts.map +1 -1
  40. package/dist/authorization/safe/request/issuer/determine-issuer-from-bearer-token.d.ts.map +1 -1
  41. package/dist/authorization/safe/request/verify-jwt-bearer-token-for-audience.d.ts +31 -0
  42. package/dist/authorization/safe/request/verify-jwt-bearer-token-for-audience.d.ts.map +1 -0
  43. package/dist/authorization/safe/request/verify-jwt-bearer-token-for-audience.js +50 -0
  44. package/dist/authorization/safe/validation/jwt/payload/verify-authorization-audience.d.ts.map +1 -1
  45. package/dist/authorization/safe/validation/jwt/payload/verify-authorization-expiration-time.d.ts.map +1 -1
  46. package/dist/authorization/safe/validation/jwt/payload/verify-authorization-issued-at-time.d.ts.map +1 -1
  47. package/dist/authorization/safe/validation/jwt/payload/verify-authorization-issuer.d.ts.map +1 -1
  48. package/dist/authorization/safe/validation/jwt/payload/verify-authorization-not-before-time.d.ts.map +1 -1
  49. package/dist/authorization/safe/validation/jwt/payload/verify-authorization-subject.d.ts.map +1 -1
  50. package/dist/authorization/safe/validation/jwt/verify-token-header.d.ts.map +1 -1
  51. package/dist/authorization/safe/validation/jwt/verify-token-payload.d.ts.map +1 -1
  52. package/dist/crypto/calculate-combined-hash.d.ts.map +1 -1
  53. package/dist/crypto/calculate-hash.d.ts +1 -1
  54. package/dist/crypto/calculate-hash.d.ts.map +1 -1
  55. package/dist/crypto/calculate-hash.js +1 -1
  56. package/dist/crypto/index.d.ts +1 -0
  57. package/dist/crypto/index.d.ts.map +1 -1
  58. package/dist/crypto/index.js +1 -0
  59. package/dist/crypto/private-public-keys/create-key-pair-from-mnemonic.d.ts.map +1 -1
  60. package/dist/crypto/private-public-keys/create-key-pair-from-private-key.d.ts.map +1 -1
  61. package/dist/crypto/private-public-keys/create-key-pair-from-private-key.js +1 -1
  62. package/dist/crypto/private-public-keys/create-key-pair-from-public-key.d.ts +11 -0
  63. package/dist/crypto/private-public-keys/create-key-pair-from-public-key.d.ts.map +1 -0
  64. package/dist/crypto/private-public-keys/create-key-pair-from-public-key.js +51 -0
  65. package/dist/crypto/private-public-keys/generation/create-entropy-for-elliptical-curve.d.ts.map +1 -1
  66. package/dist/crypto/private-public-keys/generation/generate-key-pair.d.ts.map +1 -1
  67. package/dist/crypto/private-public-keys/generation/get-private-public-key-from-keypair.d.ts.map +1 -1
  68. package/dist/crypto/signature/create-crypto-signature.d.ts +11 -0
  69. package/dist/crypto/signature/create-crypto-signature.d.ts.map +1 -1
  70. package/dist/crypto/signature/create-crypto-signature.js +14 -1
  71. package/dist/crypto/signature/verify-crypto-signature-by-data.d.ts +4 -0
  72. package/dist/crypto/signature/verify-crypto-signature-by-data.d.ts.map +1 -1
  73. package/dist/crypto/signature/verify-crypto-signature-by-data.js +8 -2
  74. package/dist/crypto/signature/verify-crypto-signature-by-hash.d.ts +4 -0
  75. package/dist/crypto/signature/verify-crypto-signature-by-hash.d.ts.map +1 -1
  76. package/dist/crypto/signature/verify-crypto-signature-by-hash.js +7 -1
  77. package/dist/errors/index.d.ts +2 -0
  78. package/dist/errors/index.d.ts.map +1 -1
  79. package/dist/errors/index.js +2 -0
  80. package/dist/errors/share-data/share-data-errors.d.ts +92 -1
  81. package/dist/errors/share-data/share-data-errors.d.ts.map +1 -1
  82. package/dist/errors/share-data/share-data-errors.js +130 -1
  83. package/dist/errors/shareblock/shareblock-errors.d.ts +40 -0
  84. package/dist/errors/shareblock/shareblock-errors.d.ts.map +1 -0
  85. package/dist/errors/shareblock/shareblock-errors.js +50 -0
  86. package/dist/errors/validation/crypto-validation-errors.d.ts +8 -0
  87. package/dist/errors/validation/crypto-validation-errors.d.ts.map +1 -0
  88. package/dist/errors/validation/crypto-validation-errors.js +15 -0
  89. package/dist/helpers/array/array-helpers.d.ts.map +1 -1
  90. package/dist/helpers/crypto/cryptography-helpers.d.ts.map +1 -1
  91. package/dist/helpers/data/data-helpers.d.ts.map +1 -1
  92. package/dist/helpers/file/file-helpers.d.ts.map +1 -1
  93. package/dist/helpers/id-helpers.d.ts.map +1 -1
  94. package/dist/helpers/lodash/lodash-helpers.d.ts.map +1 -1
  95. package/dist/helpers/object-helpers.d.ts.map +1 -1
  96. package/dist/helpers/object-validation-helpers.d.ts.map +1 -1
  97. package/dist/helpers/request/params-object-helpers.d.ts +6 -6
  98. package/dist/helpers/request/params-object-helpers.d.ts.map +1 -1
  99. package/dist/helpers/request/params-object-helpers.js +11 -11
  100. package/dist/helpers/request/query-object-helpers.d.ts.map +1 -1
  101. package/dist/helpers/request/request-object-helpers.d.ts.map +1 -1
  102. package/dist/models/application/audit-log/application-audit-log-models.d.ts +82 -92
  103. package/dist/models/application/audit-log/application-audit-log-models.d.ts.map +1 -1
  104. package/dist/models/application/database/firestore-models.d.ts +158 -307
  105. package/dist/models/application/database/firestore-models.d.ts.map +1 -1
  106. package/dist/models/authorization/authorization-models.d.ts +34 -44
  107. package/dist/models/authorization/authorization-models.d.ts.map +1 -1
  108. package/dist/models/authorization/authorization-models.js +2 -2
  109. package/dist/models/crypto/crypto-models.d.ts +1 -7
  110. package/dist/models/crypto/crypto-models.d.ts.map +1 -1
  111. package/dist/models/data/data-models.d.ts +27 -13
  112. package/dist/models/data/data-models.d.ts.map +1 -1
  113. package/dist/models/data/data-models.js +23 -2
  114. package/dist/models/dynamic-execution/dynamic-execution-models.d.ts +1 -9
  115. package/dist/models/dynamic-execution/dynamic-execution-models.d.ts.map +1 -1
  116. package/dist/models/events/share-event-models.d.ts +90 -119
  117. package/dist/models/events/share-event-models.d.ts.map +1 -1
  118. package/dist/models/events/share-event-models.js +34 -3
  119. package/dist/models/functions/share-data-function-models.d.ts +23 -193
  120. package/dist/models/functions/share-data-function-models.d.ts.map +1 -1
  121. package/dist/models/functions/share-data-function-models.js +1 -1
  122. package/dist/models/generic/request-response-models.d.ts +1 -7
  123. package/dist/models/generic/request-response-models.d.ts.map +1 -1
  124. package/dist/models/index.d.ts +7 -1
  125. package/dist/models/index.d.ts.map +1 -1
  126. package/dist/models/index.js +7 -1
  127. package/dist/models/rules/share-rule-models.d.ts +759 -1116
  128. package/dist/models/rules/share-rule-models.d.ts.map +1 -1
  129. package/dist/models/rules/share-rule-models.js +6 -6
  130. package/dist/models/safe/safe-transaction-models.d.ts +28 -30
  131. package/dist/models/safe/safe-transaction-models.d.ts.map +1 -1
  132. package/dist/models/safe/transactions/authorities-transactions-models.d.ts +77 -419
  133. package/dist/models/safe/transactions/authorities-transactions-models.d.ts.map +1 -1
  134. package/dist/models/safe/transactions/authorities-transactions-models.js +3 -3
  135. package/dist/models/safe/transactions/events-transactions-models.d.ts +89 -0
  136. package/dist/models/safe/transactions/events-transactions-models.d.ts.map +1 -0
  137. package/dist/models/safe/transactions/events-transactions-models.js +53 -0
  138. package/dist/models/safe/transactions/functions-transactions-models.d.ts +89 -0
  139. package/dist/models/safe/transactions/functions-transactions-models.d.ts.map +1 -0
  140. package/dist/models/safe/transactions/functions-transactions-models.js +53 -0
  141. package/dist/models/safe/transactions/rules-transactions-models.d.ts +59 -603
  142. package/dist/models/safe/transactions/rules-transactions-models.d.ts.map +1 -1
  143. package/dist/models/safe/transactions/sharedata-transactions-models.d.ts +302 -0
  144. package/dist/models/safe/transactions/sharedata-transactions-models.d.ts.map +1 -0
  145. package/dist/models/safe/transactions/sharedata-transactions-models.js +79 -0
  146. package/dist/models/share-data/share-data-crypto-models.d.ts +307 -0
  147. package/dist/models/share-data/share-data-crypto-models.d.ts.map +1 -0
  148. package/dist/models/share-data/share-data-crypto-models.js +91 -0
  149. package/dist/models/share-data/share-data-models.d.ts +114 -0
  150. package/dist/models/share-data/share-data-models.d.ts.map +1 -0
  151. package/dist/models/share-data/{share-data.js → share-data-models.js} +1 -1
  152. package/dist/models/share-data/share-data-persistence-models.d.ts +158 -0
  153. package/dist/models/share-data/share-data-persistence-models.d.ts.map +1 -0
  154. package/dist/models/share-data/share-data-persistence-models.js +94 -0
  155. package/dist/models/shareblock/shareblock-models.d.ts +280 -0
  156. package/dist/models/shareblock/shareblock-models.d.ts.map +1 -0
  157. package/dist/models/shareblock/shareblock-models.js +222 -0
  158. package/dist/transactions/authority/create-safe-transaction-authority-data.d.ts.map +1 -1
  159. package/dist/transactions/authority/create-safe-transaction-authority.d.ts.map +1 -1
  160. package/package.json +32 -21
  161. package/dist/models/share-data/share-data.d.ts +0 -181
  162. package/dist/models/share-data/share-data.d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"create-key-pair-from-private-key.d.ts","sourceRoot":"","sources":["../../../src/crypto/private-public-keys/create-key-pair-from-private-key.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAE5G;;;;;GAKG;AACH,QAAA,MAAM,2BAA2B,UAAW,uBAAuB,GAAG,0BAA0B,cAChF,MAAM,KAAG,QAAQ,CAAC,EAAE,CAAC,OAKpC,CAAC;AAEF,OAAO,EAAE,2BAA2B,EAAE,CAAC"}
1
+ {"version":3,"file":"create-key-pair-from-private-key.d.ts","sourceRoot":"","sources":["../../../src/crypto/private-public-keys/create-key-pair-from-private-key.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAE5G;;;;;GAKG;AACH,QAAA,MAAM,2BAA2B,GAAI,OAAO,uBAAuB,GAAG,0BAA0B,EAC5F,YAAY,MAAM,KAAG,QAAQ,CAAC,EAAE,CAAC,OAKpC,CAAC;AAEF,OAAO,EAAE,2BAA2B,EAAE,CAAC"}
@@ -44,7 +44,7 @@ const Elliptic = __importStar(require("elliptic"));
44
44
  */
45
45
  const createKeyPairFromPrivateKey = (curve, privateKey) => {
46
46
  const ellipticalCurve = new Elliptic.ec(curve);
47
- const keyPair = ellipticalCurve.keyFromPrivate(privateKey);
47
+ const keyPair = ellipticalCurve.keyFromPrivate(privateKey, 'hex');
48
48
  return keyPair;
49
49
  };
50
50
  exports.createKeyPairFromPrivateKey = createKeyPairFromPrivateKey;
@@ -0,0 +1,11 @@
1
+ import * as Elliptic from 'elliptic';
2
+ import { EllipticalCurvesEncryption, EllipticalCurvesSigning } from '../../_settings/cryptography-settings';
3
+ /**
4
+ * This function creates a key pair from a public key using the elliptic library.
5
+ *
6
+ * @param curve the elliptical curve to create the key pair for.
7
+ * @param publicKey the public key in hexadecimal format.
8
+ * @returns
9
+ */
10
+ export declare const createKeyPairFromPublicKey: (curve: EllipticalCurvesSigning | EllipticalCurvesEncryption, publicKey: string, encoding?: BufferEncoding) => Elliptic.ec.KeyPair;
11
+ //# sourceMappingURL=create-key-pair-from-public-key.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-key-pair-from-public-key.d.ts","sourceRoot":"","sources":["../../../src/crypto/private-public-keys/create-key-pair-from-public-key.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAE5G;;;;;;GAMG;AACH,eAAO,MAAM,0BAA0B,GACnC,OAAO,uBAAuB,GAAG,0BAA0B,EAC3D,WAAW,MAAM,EACjB,WAAU,cAAsB,KACjC,QAAQ,CAAC,EAAE,CAAC,OAKd,CAAC"}
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.createKeyPairFromPublicKey = void 0;
37
+ /* eslint-disable new-cap */
38
+ const Elliptic = __importStar(require("elliptic"));
39
+ /**
40
+ * This function creates a key pair from a public key using the elliptic library.
41
+ *
42
+ * @param curve the elliptical curve to create the key pair for.
43
+ * @param publicKey the public key in hexadecimal format.
44
+ * @returns
45
+ */
46
+ const createKeyPairFromPublicKey = (curve, publicKey, encoding = 'hex') => {
47
+ const ellipticalCurve = new Elliptic.ec(curve);
48
+ const keyPair = ellipticalCurve.keyFromPublic(publicKey, encoding);
49
+ return keyPair;
50
+ };
51
+ exports.createKeyPairFromPublicKey = createKeyPairFromPublicKey;
@@ -1 +1 @@
1
- {"version":3,"file":"create-entropy-for-elliptical-curve.d.ts","sourceRoot":"","sources":["../../../../src/crypto/private-public-keys/generation/create-entropy-for-elliptical-curve.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AAG/G;;;;;GAKG;AACH,QAAA,MAAM,8BAA8B,UAAW,uBAAuB,GAAG,0BAA0B,KAAG,MAQrG,CAAC;AAEF,OAAO,EAAE,8BAA8B,EAAE,CAAC"}
1
+ {"version":3,"file":"create-entropy-for-elliptical-curve.d.ts","sourceRoot":"","sources":["../../../../src/crypto/private-public-keys/generation/create-entropy-for-elliptical-curve.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AAG/G;;;;;GAKG;AACH,QAAA,MAAM,8BAA8B,GAAI,OAAO,uBAAuB,GAAG,0BAA0B,KAAG,MAQrG,CAAC;AAEF,OAAO,EAAE,8BAA8B,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"generate-key-pair.d.ts","sourceRoot":"","sources":["../../../../src/crypto/private-public-keys/generation/generate-key-pair.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAC/G,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAErC;;;;;GAKG;AACH,QAAA,MAAM,eAAe,UAAW,uBAAuB,GAAG,0BAA0B,cAAc,MAAM,WAC3F,MAAM,KAAG,QAAQ,CAAC,EAAE,CAAC,OAMjC,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"generate-key-pair.d.ts","sourceRoot":"","sources":["../../../../src/crypto/private-public-keys/generation/generate-key-pair.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAC/G,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAErC;;;;;GAKG;AACH,QAAA,MAAM,eAAe,GAAI,OAAO,uBAAuB,GAAG,0BAA0B,EAAE,YAAY,MAAM,EACpG,SAAS,MAAM,KAAG,QAAQ,CAAC,EAAE,CAAC,OAMjC,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-private-public-key-from-keypair.d.ts","sourceRoot":"","sources":["../../../../src/crypto/private-public-keys/generation/get-private-public-key-from-keypair.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAErC;;;;GAIG;AACH,QAAA,MAAM,wBAAwB,YAAa,QAAQ,CAAC,EAAE,CAAC,OAAO,KAAG,MAEhE,CAAC;AAEF;;;;GAIG;AACH,QAAA,MAAM,uBAAuB,YAAa,QAAQ,CAAC,EAAE,CAAC,OAAO,KAAG,MAE/D,CAAC;AAEF,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,CAAC"}
1
+ {"version":3,"file":"get-private-public-key-from-keypair.d.ts","sourceRoot":"","sources":["../../../../src/crypto/private-public-keys/generation/get-private-public-key-from-keypair.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAErC;;;;GAIG;AACH,QAAA,MAAM,wBAAwB,GAAI,SAAS,QAAQ,CAAC,EAAE,CAAC,OAAO,KAAG,MAEhE,CAAC;AAEF;;;;GAIG;AACH,QAAA,MAAM,uBAAuB,GAAI,SAAS,QAAQ,CAAC,EAAE,CAAC,OAAO,KAAG,MAE/D,CAAC;AAEF,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,CAAC"}
@@ -3,6 +3,17 @@ import * as Elliptic from 'elliptic';
3
3
  * This function creates a signature for a hash using an elliptical curve.
4
4
  * @param keyPair the key pair to use for signing.
5
5
  * @param hashToSign the hash to sign.
6
+ *
7
+ * Implementation note: `elliptic.ec(curve).keyPair.sign(msg)` treats `msg`
8
+ * as a hex string, parses it to a BigInt, then truncates to the curve's
9
+ * `n.bitLength()` (~253 bits for `'ed25519'`) by right-shifting, discarding
10
+ * the LOW bits. For inputs longer than ~63 hex characters that means the
11
+ * signature only commits to the leading high bits of the input — bytes near
12
+ * the end of `hashToSign` contribute nothing to the signature. We always
13
+ * re-hash with SHA-256 first so the input handed to `sign` is a fixed-size
14
+ * 256-bit digest whose every bit depends on every input bit (avalanche),
15
+ * making the 3-bit ECDSA truncation harmless. `verifyCryptoSignatureByHash`
16
+ * mirrors this transformation.
6
17
  */
7
18
  declare const createEllipticalCurveSignature: (keyPair: Elliptic.ec.KeyPair, hashToSign: string) => string;
8
19
  export { createEllipticalCurveSignature };
@@ -1 +1 @@
1
- {"version":3,"file":"create-crypto-signature.d.ts","sourceRoot":"","sources":["../../../src/crypto/signature/create-crypto-signature.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAErC;;;;GAIG;AACH,QAAA,MAAM,8BAA8B,YAAa,QAAQ,CAAC,EAAE,CAAC,OAAO,cAAc,MAAM,KAAG,MAG1F,CAAC;AAEF,OAAO,EAAE,8BAA8B,EAAE,CAAC"}
1
+ {"version":3,"file":"create-crypto-signature.d.ts","sourceRoot":"","sources":["../../../src/crypto/signature/create-crypto-signature.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAGrC;;;;;;;;;;;;;;;GAeG;AACH,QAAA,MAAM,8BAA8B,GAAI,SAAS,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,YAAY,MAAM,KAAG,MAI1F,CAAC;AAEF,OAAO,EAAE,8BAA8B,EAAE,CAAC"}
@@ -1,13 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createEllipticalCurveSignature = void 0;
4
+ const calculate_hash_1 = require("../calculate-hash");
4
5
  /**
5
6
  * This function creates a signature for a hash using an elliptical curve.
6
7
  * @param keyPair the key pair to use for signing.
7
8
  * @param hashToSign the hash to sign.
9
+ *
10
+ * Implementation note: `elliptic.ec(curve).keyPair.sign(msg)` treats `msg`
11
+ * as a hex string, parses it to a BigInt, then truncates to the curve's
12
+ * `n.bitLength()` (~253 bits for `'ed25519'`) by right-shifting, discarding
13
+ * the LOW bits. For inputs longer than ~63 hex characters that means the
14
+ * signature only commits to the leading high bits of the input — bytes near
15
+ * the end of `hashToSign` contribute nothing to the signature. We always
16
+ * re-hash with SHA-256 first so the input handed to `sign` is a fixed-size
17
+ * 256-bit digest whose every bit depends on every input bit (avalanche),
18
+ * making the 3-bit ECDSA truncation harmless. `verifyCryptoSignatureByHash`
19
+ * mirrors this transformation.
8
20
  */
9
21
  const createEllipticalCurveSignature = (keyPair, hashToSign) => {
10
- const signature = keyPair.sign(hashToSign).toDER('hex');
22
+ const digest = (0, calculate_hash_1.calculateHash)(hashToSign);
23
+ const signature = keyPair.sign(digest).toDER('hex');
11
24
  return signature;
12
25
  };
13
26
  exports.createEllipticalCurveSignature = createEllipticalCurveSignature;
@@ -7,6 +7,10 @@ import { EllipticalCurvesSigning, EllipticalCurvesEncryption } from '../../_sett
7
7
  * @param signature the signature to verify
8
8
  * @param publicKey the public key to verify the signature
9
9
  * @returns
10
+ *
11
+ * Mirrors the `calculateHash`-before-sign step from
12
+ * `createEllipticalCurveSignature` so both sides see the same fixed-size
13
+ * 256-bit digest. See that function for the rationale.
10
14
  */
11
15
  declare const verifyCryptoSignatureByData: (curve: EllipticalCurvesSigning | EllipticalCurvesEncryption, data: any, signature: string, publicKey: string) => Promise<boolean>;
12
16
  export { verifyCryptoSignatureByData };
@@ -1 +1 @@
1
- {"version":3,"file":"verify-crypto-signature-by-data.d.ts","sourceRoot":"","sources":["../../../src/crypto/signature/verify-crypto-signature-by-data.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAE5G;;;;;;;;GAQG;AACH,QAAA,MAAM,2BAA2B,UAAiB,uBAAuB,GAAG,0BAA0B,QAAQ,GAAG,aAAa,MAAM,aACrH,MAAM,KAAG,OAAO,CAAC,OAAO,CAMtC,CAAC;AAEF,OAAO,EAAE,2BAA2B,EAAE,CAAC"}
1
+ {"version":3,"file":"verify-crypto-signature-by-data.d.ts","sourceRoot":"","sources":["../../../src/crypto/signature/verify-crypto-signature-by-data.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAG5G;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,2BAA2B,GAAU,OAAO,uBAAuB,GAAG,0BAA0B,EAAE,MAAM,GAAG,EAAE,WAAW,MAAM,EAChI,WAAW,MAAM,KAAG,OAAO,CAAC,OAAO,CAOtC,CAAC;AAEF,OAAO,EAAE,2BAA2B,EAAE,CAAC"}
@@ -36,6 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.verifyCryptoSignatureByData = void 0;
37
37
  /* eslint-disable @typescript-eslint/no-explicit-any */
38
38
  const elliptic = __importStar(require("elliptic"));
39
+ const calculate_hash_1 = require("../calculate-hash");
39
40
  /**
40
41
  * This function verifies the signature of the data using the public key
41
42
  *
@@ -44,12 +45,17 @@ const elliptic = __importStar(require("elliptic"));
44
45
  * @param signature the signature to verify
45
46
  * @param publicKey the public key to verify the signature
46
47
  * @returns
48
+ *
49
+ * Mirrors the `calculateHash`-before-sign step from
50
+ * `createEllipticalCurveSignature` so both sides see the same fixed-size
51
+ * 256-bit digest. See that function for the rationale.
47
52
  */
48
53
  const verifyCryptoSignatureByData = async (curve, data, signature, publicKey) => {
49
54
  // convert data to a string.
50
- const hash = JSON.stringify(data);
55
+ const stringified = JSON.stringify(data);
51
56
  // eslint-disable-next-line new-cap
52
57
  const key = new elliptic.ec(curve).keyFromPublic(publicKey, 'hex');
53
- return key.verify(hash, signature);
58
+ const digest = (0, calculate_hash_1.calculateHash)(stringified);
59
+ return key.verify(digest, signature);
54
60
  };
55
61
  exports.verifyCryptoSignatureByData = verifyCryptoSignatureByData;
@@ -7,6 +7,10 @@ import { EllipticalCurvesSigning, EllipticalCurvesEncryption } from '../../_sett
7
7
  * @param signature the signature to verify
8
8
  * @param publicKey the public key to verify the signature
9
9
  * @returns
10
+ *
11
+ * Mirrors the `calculateHash`-before-sign step from
12
+ * `createEllipticalCurveSignature` so both sides see the same fixed-size
13
+ * 256-bit digest. See that function for the rationale.
10
14
  */
11
15
  declare const verifyCryptoSignatureByHash: (curve: EllipticalCurvesSigning | EllipticalCurvesEncryption, hash: string, signature: string, publicKey: string) => Promise<boolean>;
12
16
  export { verifyCryptoSignatureByHash };
@@ -1 +1 @@
1
- {"version":3,"file":"verify-crypto-signature-by-hash.d.ts","sourceRoot":"","sources":["../../../src/crypto/signature/verify-crypto-signature-by-hash.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAE5G;;;;;;;;GAQG;AACH,QAAA,MAAM,2BAA2B,UAAiB,uBAAuB,GAAG,0BAA0B,QAAQ,MAAM,aAAa,MAAM,aACxH,MAAM,KAAG,OAAO,CAAC,OAAO,CAItC,CAAC;AAEF,OAAO,EAAE,2BAA2B,EAAE,CAAC"}
1
+ {"version":3,"file":"verify-crypto-signature-by-hash.d.ts","sourceRoot":"","sources":["../../../src/crypto/signature/verify-crypto-signature-by-hash.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,MAAM,uCAAuC,CAAC;AAG5G;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,2BAA2B,GAAU,OAAO,uBAAuB,GAAG,0BAA0B,EAAE,MAAM,MAAM,EAAE,WAAW,MAAM,EACnI,WAAW,MAAM,KAAG,OAAO,CAAC,OAAO,CAKtC,CAAC;AAEF,OAAO,EAAE,2BAA2B,EAAE,CAAC"}
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.verifyCryptoSignatureByHash = void 0;
37
37
  const elliptic = __importStar(require("elliptic"));
38
+ const calculate_hash_1 = require("../calculate-hash");
38
39
  /**
39
40
  * This function verifies the signature of the data using the public key
40
41
  *
@@ -43,10 +44,15 @@ const elliptic = __importStar(require("elliptic"));
43
44
  * @param signature the signature to verify
44
45
  * @param publicKey the public key to verify the signature
45
46
  * @returns
47
+ *
48
+ * Mirrors the `calculateHash`-before-sign step from
49
+ * `createEllipticalCurveSignature` so both sides see the same fixed-size
50
+ * 256-bit digest. See that function for the rationale.
46
51
  */
47
52
  const verifyCryptoSignatureByHash = async (curve, hash, signature, publicKey) => {
48
53
  // eslint-disable-next-line new-cap
49
54
  const key = new elliptic.ec(curve).keyFromPublic(publicKey, 'hex');
50
- return key.verify(hash, signature);
55
+ const digest = (0, calculate_hash_1.calculateHash)(hash);
56
+ return key.verify(digest, signature);
51
57
  };
52
58
  exports.verifyCryptoSignatureByHash = verifyCryptoSignatureByHash;
@@ -6,5 +6,7 @@ export * from './request/request-errors';
6
6
  export * from './safe/safe-rules-errors';
7
7
  export * from './scheduler/scheduler-errors';
8
8
  export * from './share-data/share-data-errors';
9
+ export * from './shareblock/shareblock-errors';
10
+ export * from './validation/crypto-validation-errors';
9
11
  export * from './base-error';
10
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAG/C,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uCAAuC,CAAC;AAGtD,cAAc,cAAc,CAAC"}
@@ -22,5 +22,7 @@ __exportStar(require("./request/request-errors"), exports);
22
22
  __exportStar(require("./safe/safe-rules-errors"), exports);
23
23
  __exportStar(require("./scheduler/scheduler-errors"), exports);
24
24
  __exportStar(require("./share-data/share-data-errors"), exports);
25
+ __exportStar(require("./shareblock/shareblock-errors"), exports);
26
+ __exportStar(require("./validation/crypto-validation-errors"), exports);
25
27
  // Base error
26
28
  __exportStar(require("./base-error"), exports);
@@ -1,5 +1,5 @@
1
1
  import { BaseError } from '../base-error';
2
- import { ShareDataTypes } from '../../models/share-data/share-data';
2
+ import { ShareDataTypes } from '../../models/share-data/share-data-models';
3
3
  import { IShareDataFunction } from '../../models/functions/share-data-function-models';
4
4
  /**
5
5
  * This error is thrown when a function is tried to be applied to the share data thats state is locked.
@@ -64,4 +64,95 @@ export declare class ShareRuleProposedConditionsNotPresentError extends BaseErro
64
64
  */
65
65
  constructor(ruleId: string);
66
66
  }
67
+ /**
68
+ * This error is thrown when share data already exists.
69
+ */
70
+ export declare class ShareDataAlreadyExistsError extends BaseError {
71
+ constructor(shareDataId: string);
72
+ }
73
+ /**
74
+ * This error is thrown when share data is not found.
75
+ */
76
+ export declare class ShareDataNotFoundError extends BaseError {
77
+ constructor(shareDataId: string);
78
+ }
79
+ /**
80
+ * This error is thrown when there is duplicate share data.
81
+ */
82
+ export declare class ShareDataDuplicateError extends BaseError {
83
+ constructor(shareDataId: string);
84
+ }
85
+ /**
86
+ * This error is thrown when share data crypto already exists.
87
+ */
88
+ export declare class ShareDataCryptoAlreadyExistsError extends BaseError {
89
+ constructor(shareDataId: string);
90
+ }
91
+ /**
92
+ * This error is thrown when share data crypto initialization public key is different.
93
+ */
94
+ export declare class CryptoInitializationPublicKeyIsDifferentError extends BaseError {
95
+ constructor(shareDataId: string);
96
+ }
97
+ /**
98
+ * This error is thrown when share data crypto proof failed.
99
+ */
100
+ export declare class ShareDataCryptoProofFailedError extends BaseError {
101
+ constructor(shareDataId: string);
102
+ }
103
+ /**
104
+ * This error is thrown when share data structural proof already exists.
105
+ */
106
+ export declare class ShareDataStructuralProofAlreadyExistsError extends BaseError {
107
+ constructor(shareDataId: string);
108
+ }
109
+ /**
110
+ * This error is thrown when share data structural proof failed.
111
+ */
112
+ export declare class ShareDataStructuralProofFailedError extends BaseError {
113
+ constructor(shareDataId: string);
114
+ }
115
+ /**
116
+ * This error is thrown when a runtime transaction proposal proof fails to
117
+ * verify. Distinct from {@link ShareDataStructuralProofFailedError}: a
118
+ * structural proof attests only to the pre-mutation state under a purpose,
119
+ * whereas a transaction proof additionally binds the exact *proposed* state
120
+ * being applied. A failure here means the proof's signature does not cover
121
+ * the (current state, proposed state, function, chain position) tuple the
122
+ * caller is trying to apply — e.g. a proof minted for a different amount,
123
+ * a different function, or a structural proof replayed as a transaction.
124
+ */
125
+ export declare class ShareDataTransactionProofFailedError extends BaseError {
126
+ constructor(shareDataId: string);
127
+ }
128
+ /**
129
+ * This error is thrown when a transaction proposal proof is cryptographically
130
+ * valid but signed by a key that is not authorized to mutate this block.
131
+ * Distinct from {@link ShareDataTransactionProofFailedError}: there the proof's
132
+ * signature does not cover the proposed transition; here the signature is
133
+ * sound, but `proof.publicKey` is not the block's `creationPublicKey`. Signature
134
+ * validity proves *someone* signed the transition — this gate proves the
135
+ * *authorized* someone did, closing the "any valid keypair signs a legal
136
+ * transition" hole on the runtime mutation path.
137
+ */
138
+ export declare class ShareDataTransactionNotAuthorizedError extends BaseError {
139
+ constructor(shareDataId: string, signingPublicKey: string);
140
+ }
141
+ /**
142
+ * This error is thrown when the system attempts to get the previous share data hash
143
+ * but the share data has not been initialized for the proof yet.
144
+ */
145
+ export declare class ShareDataPreviousHashNotAvailableError extends BaseError {
146
+ constructor(shareDataId: string);
147
+ }
148
+ /**
149
+ * This error is thrown when a persisted ShareData snapshot cannot be replayed — an
150
+ * unknown block type, an unrecognized schema version, or a transaction whose
151
+ * `functionId` does not resolve to a registered function on the rebuilt block.
152
+ * Distinct from {@link ShareDataIntegrityError}, which signals that a replay
153
+ * succeeded but its result diverged from the snapshot's `expected*` cross-checks.
154
+ */
155
+ export declare class ShareDataPersistenceError extends BaseError {
156
+ constructor(shareDataId: string, reason: string);
157
+ }
67
158
  //# sourceMappingURL=share-data-errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"share-data-errors.d.ts","sourceRoot":"","sources":["../../../src/errors/share-data/share-data-errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AAEvF;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,SAAS;IACjD;;OAEG;gBACS,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,cAAc;CAGjE;AAED;;GAEG;AACH,qBAAa,2CAA4C,SAAQ,SAAS;IACtE;;OAEG;gBACS,WAAW,EAAE,MAAM;CAGlC;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,SAAS;IAClD;;OAEG;gBACS,WAAW,EAAE,MAAM;CAGlC;AAED;;GAEG;AACH,qBAAa,yDAA0D,SAAQ,SAAS;IACpF;;OAEG;gBACS,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;CAI5E;AAGD;;GAEG;AACH,qBAAa,6BAA8B,SAAQ,SAAS;IACxD;;OAEG;gBACS,WAAW,EAAE,MAAM,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM;CAIjG;AAKD;;GAEG;AACH,qBAAa,yCAA0C,SAAQ,SAAS;IACpE;;OAEG;gBACS,MAAM,EAAE,MAAM;CAG7B;AAED;;GAEG;AACH,qBAAa,0CAA2C,SAAQ,SAAS;IACrE;;OAEG;gBACS,MAAM,EAAE,MAAM;CAG7B"}
1
+ {"version":3,"file":"share-data-errors.d.ts","sourceRoot":"","sources":["../../../src/errors/share-data/share-data-errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AAEvF;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,SAAS;IACjD;;OAEG;gBACS,WAAW,EAAE,MAAM,EAAE,aAAa,EAAE,cAAc;CAGjE;AAED;;GAEG;AACH,qBAAa,2CAA4C,SAAQ,SAAS;IACtE;;OAEG;gBACS,WAAW,EAAE,MAAM;CAGlC;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,SAAS;IAClD;;OAEG;gBACS,WAAW,EAAE,MAAM;CAGlC;AAED;;GAEG;AACH,qBAAa,yDAA0D,SAAQ,SAAS;IACpF;;OAEG;gBACS,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;CAI5E;AAGD;;GAEG;AACH,qBAAa,6BAA8B,SAAQ,SAAS;IACxD;;OAEG;gBACS,WAAW,EAAE,MAAM,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM;CAIjG;AAKD;;GAEG;AACH,qBAAa,yCAA0C,SAAQ,SAAS;IACpE;;OAEG;gBACS,MAAM,EAAE,MAAM;CAG7B;AAED;;GAEG;AACH,qBAAa,0CAA2C,SAAQ,SAAS;IACrE;;OAEG;gBACS,MAAM,EAAE,MAAM;CAG7B;AAID;;GAEG;AACH,qBAAa,2BAA4B,SAAQ,SAAS;gBAC1C,WAAW,EAAE,MAAM;CAGlC;AAED;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,SAAS;gBACrC,WAAW,EAAE,MAAM;CAGlC;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,SAAS;gBACtC,WAAW,EAAE,MAAM;CAGlC;AAED;;GAEG;AACH,qBAAa,iCAAkC,SAAQ,SAAS;gBAChD,WAAW,EAAE,MAAM;CAGlC;AAED;;GAEG;AACH,qBAAa,6CAA8C,SAAQ,SAAS;gBAC5D,WAAW,EAAE,MAAM;CAGlC;AAED;;GAEG;AACH,qBAAa,+BAAgC,SAAQ,SAAS;gBAC9C,WAAW,EAAE,MAAM;CAGlC;AAED;;GAEG;AACH,qBAAa,0CAA2C,SAAQ,SAAS;gBACzD,WAAW,EAAE,MAAM;CAGlC;AAED;;GAEG;AACH,qBAAa,mCAAoC,SAAQ,SAAS;gBAClD,WAAW,EAAE,MAAM;CAGlC;AAED;;;;;;;;;GASG;AACH,qBAAa,oCAAqC,SAAQ,SAAS;gBACnD,WAAW,EAAE,MAAM;CAGlC;AAED;;;;;;;;;GASG;AACH,qBAAa,sCAAuC,SAAQ,SAAS;gBACrD,WAAW,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM;CAM5D;AAED;;;GAGG;AACH,qBAAa,sCAAuC,SAAQ,SAAS;gBACrD,WAAW,EAAE,MAAM;CAIlC;AAED;;;;;;GAMG;AACH,qBAAa,yBAA0B,SAAQ,SAAS;gBACxC,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAGlD"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ShareRuleProposedConditionsNotPresentError = exports.ShareRuleCurrentConditionsNotPresentError = exports.ShareDataFunctionHashNotValid = exports.ShareDataFunctionBeingAppliedDoesNotExistOnShareDataError = exports.ShareDataIntegrityError = exports.ShareDataCurrentAndProposalDataMatchesError = exports.ShareDataIsLockedError = void 0;
3
+ exports.ShareDataPersistenceError = exports.ShareDataPreviousHashNotAvailableError = exports.ShareDataTransactionNotAuthorizedError = exports.ShareDataTransactionProofFailedError = exports.ShareDataStructuralProofFailedError = exports.ShareDataStructuralProofAlreadyExistsError = exports.ShareDataCryptoProofFailedError = exports.CryptoInitializationPublicKeyIsDifferentError = exports.ShareDataCryptoAlreadyExistsError = exports.ShareDataDuplicateError = exports.ShareDataNotFoundError = exports.ShareDataAlreadyExistsError = exports.ShareRuleProposedConditionsNotPresentError = exports.ShareRuleCurrentConditionsNotPresentError = exports.ShareDataFunctionHashNotValid = exports.ShareDataFunctionBeingAppliedDoesNotExistOnShareDataError = exports.ShareDataIntegrityError = exports.ShareDataCurrentAndProposalDataMatchesError = exports.ShareDataIsLockedError = void 0;
4
4
  const base_error_1 = require("../base-error");
5
5
  /**
6
6
  * This error is thrown when a function is tried to be applied to the share data thats state is locked.
@@ -90,3 +90,132 @@ class ShareRuleProposedConditionsNotPresentError extends base_error_1.BaseError
90
90
  }
91
91
  exports.ShareRuleProposedConditionsNotPresentError = ShareRuleProposedConditionsNotPresentError;
92
92
  //#endregion Rules
93
+ /**
94
+ * This error is thrown when share data already exists.
95
+ */
96
+ class ShareDataAlreadyExistsError extends base_error_1.BaseError {
97
+ constructor(shareDataId) {
98
+ super(`Share data with id ${shareDataId} already exists.`);
99
+ }
100
+ }
101
+ exports.ShareDataAlreadyExistsError = ShareDataAlreadyExistsError;
102
+ /**
103
+ * This error is thrown when share data is not found.
104
+ */
105
+ class ShareDataNotFoundError extends base_error_1.BaseError {
106
+ constructor(shareDataId) {
107
+ super(`Share data with id ${shareDataId} was not found.`);
108
+ }
109
+ }
110
+ exports.ShareDataNotFoundError = ShareDataNotFoundError;
111
+ /**
112
+ * This error is thrown when there is duplicate share data.
113
+ */
114
+ class ShareDataDuplicateError extends base_error_1.BaseError {
115
+ constructor(shareDataId) {
116
+ super(`Duplicate share data with id ${shareDataId} found.`);
117
+ }
118
+ }
119
+ exports.ShareDataDuplicateError = ShareDataDuplicateError;
120
+ /**
121
+ * This error is thrown when share data crypto already exists.
122
+ */
123
+ class ShareDataCryptoAlreadyExistsError extends base_error_1.BaseError {
124
+ constructor(shareDataId) {
125
+ super(`Share data with id ${shareDataId} already has existing crypto values exists.`);
126
+ }
127
+ }
128
+ exports.ShareDataCryptoAlreadyExistsError = ShareDataCryptoAlreadyExistsError;
129
+ /**
130
+ * This error is thrown when share data crypto initialization public key is different.
131
+ */
132
+ class CryptoInitializationPublicKeyIsDifferentError extends base_error_1.BaseError {
133
+ constructor(shareDataId) {
134
+ super(`Share data with id ${shareDataId} crypto initialization public key is different.`);
135
+ }
136
+ }
137
+ exports.CryptoInitializationPublicKeyIsDifferentError = CryptoInitializationPublicKeyIsDifferentError;
138
+ /**
139
+ * This error is thrown when share data crypto proof failed.
140
+ */
141
+ class ShareDataCryptoProofFailedError extends base_error_1.BaseError {
142
+ constructor(shareDataId) {
143
+ super(`Share data with id ${shareDataId} crypto proof failed.`);
144
+ }
145
+ }
146
+ exports.ShareDataCryptoProofFailedError = ShareDataCryptoProofFailedError;
147
+ /**
148
+ * This error is thrown when share data structural proof already exists.
149
+ */
150
+ class ShareDataStructuralProofAlreadyExistsError extends base_error_1.BaseError {
151
+ constructor(shareDataId) {
152
+ super(`Share data with id ${shareDataId} already has existing structural proof values exists.`);
153
+ }
154
+ }
155
+ exports.ShareDataStructuralProofAlreadyExistsError = ShareDataStructuralProofAlreadyExistsError;
156
+ /**
157
+ * This error is thrown when share data structural proof failed.
158
+ */
159
+ class ShareDataStructuralProofFailedError extends base_error_1.BaseError {
160
+ constructor(shareDataId) {
161
+ super(`Share data with id ${shareDataId} structural proof failed.`);
162
+ }
163
+ }
164
+ exports.ShareDataStructuralProofFailedError = ShareDataStructuralProofFailedError;
165
+ /**
166
+ * This error is thrown when a runtime transaction proposal proof fails to
167
+ * verify. Distinct from {@link ShareDataStructuralProofFailedError}: a
168
+ * structural proof attests only to the pre-mutation state under a purpose,
169
+ * whereas a transaction proof additionally binds the exact *proposed* state
170
+ * being applied. A failure here means the proof's signature does not cover
171
+ * the (current state, proposed state, function, chain position) tuple the
172
+ * caller is trying to apply — e.g. a proof minted for a different amount,
173
+ * a different function, or a structural proof replayed as a transaction.
174
+ */
175
+ class ShareDataTransactionProofFailedError extends base_error_1.BaseError {
176
+ constructor(shareDataId) {
177
+ super(`Share data with id ${shareDataId} transaction proposal proof failed.`);
178
+ }
179
+ }
180
+ exports.ShareDataTransactionProofFailedError = ShareDataTransactionProofFailedError;
181
+ /**
182
+ * This error is thrown when a transaction proposal proof is cryptographically
183
+ * valid but signed by a key that is not authorized to mutate this block.
184
+ * Distinct from {@link ShareDataTransactionProofFailedError}: there the proof's
185
+ * signature does not cover the proposed transition; here the signature is
186
+ * sound, but `proof.publicKey` is not the block's `creationPublicKey`. Signature
187
+ * validity proves *someone* signed the transition — this gate proves the
188
+ * *authorized* someone did, closing the "any valid keypair signs a legal
189
+ * transition" hole on the runtime mutation path.
190
+ */
191
+ class ShareDataTransactionNotAuthorizedError extends base_error_1.BaseError {
192
+ constructor(shareDataId, signingPublicKey) {
193
+ super(`Share data with id ${shareDataId} rejected a transaction proposal: ` +
194
+ `signing key ${signingPublicKey} is not authorized to mutate this block.`);
195
+ }
196
+ }
197
+ exports.ShareDataTransactionNotAuthorizedError = ShareDataTransactionNotAuthorizedError;
198
+ /**
199
+ * This error is thrown when the system attempts to get the previous share data hash
200
+ * but the share data has not been initialized for the proof yet.
201
+ */
202
+ class ShareDataPreviousHashNotAvailableError extends base_error_1.BaseError {
203
+ constructor(shareDataId) {
204
+ super(`Share data with id ${shareDataId} previous hash is not available. ` +
205
+ `This is likely due to the share data not being initialized.`);
206
+ }
207
+ }
208
+ exports.ShareDataPreviousHashNotAvailableError = ShareDataPreviousHashNotAvailableError;
209
+ /**
210
+ * This error is thrown when a persisted ShareData snapshot cannot be replayed — an
211
+ * unknown block type, an unrecognized schema version, or a transaction whose
212
+ * `functionId` does not resolve to a registered function on the rebuilt block.
213
+ * Distinct from {@link ShareDataIntegrityError}, which signals that a replay
214
+ * succeeded but its result diverged from the snapshot's `expected*` cross-checks.
215
+ */
216
+ class ShareDataPersistenceError extends base_error_1.BaseError {
217
+ constructor(shareDataId, reason) {
218
+ super(`Share data with id ${shareDataId} could not be reconstructed from its persisted snapshot: ${reason}`);
219
+ }
220
+ }
221
+ exports.ShareDataPersistenceError = ShareDataPersistenceError;
@@ -0,0 +1,40 @@
1
+ import { BaseError } from '../base-error';
2
+ import { ShareBlockType } from '../../models/shareblock/shareblock-models';
3
+ /**
4
+ * Thrown by a ShareBlock factory when the supplied metadata's `blockType`
5
+ * doesn't match the factory's variant. Each factory expects a specific
6
+ * `ShareBlockType` — e.g. `createFundingShareBlock` requires
7
+ * `metadata.blockType === ShareBlockType.Funding`.
8
+ */
9
+ export declare class ShareBlockTypeMismatchError extends BaseError {
10
+ readonly shareBlockId: string;
11
+ readonly expected: ShareBlockType;
12
+ readonly received: ShareBlockType;
13
+ constructor(shareBlockId: string, expected: ShareBlockType, received: ShareBlockType);
14
+ }
15
+ /**
16
+ * Thrown by Funding/Distribution factories when
17
+ * `metadata.relatedLoanApplicationId` is missing. Both variants always tie
18
+ * back to a specific loan application; constructing one without an id is a
19
+ * caller bug (caught at construction rather than first transaction so the
20
+ * error surfaces as close to the wiring mistake as possible).
21
+ */
22
+ export declare class ShareBlockMissingLoanApplicationIdError extends BaseError {
23
+ readonly shareBlockId: string;
24
+ readonly blockType: ShareBlockType;
25
+ constructor(shareBlockId: string, blockType: ShareBlockType);
26
+ }
27
+ /**
28
+ * Thrown when a wire-format proof bundle is missing a proof for one of the
29
+ * purposes the target ShareBlock variant requires. The HTTP route uses the
30
+ * per-variant `*_REQUIRED_PROOF_PURPOSES` array (exported from each
31
+ * `create-*-shareblock` module) to detect this early — before any state
32
+ * lands — so callers get one explicit "you forgot purpose X" instead of a
33
+ * confusing chain of verifyStructuralProof failures.
34
+ */
35
+ export declare class MissingRequiredProofError extends BaseError {
36
+ readonly blockType: ShareBlockType;
37
+ readonly purpose: string;
38
+ constructor(blockType: ShareBlockType, purpose: string);
39
+ }
40
+ //# sourceMappingURL=shareblock-errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shareblock-errors.d.ts","sourceRoot":"","sources":["../../../src/errors/shareblock/shareblock-errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,2CAA2C,CAAC;AAE3E;;;;;GAKG;AACH,qBAAa,2BAA4B,SAAQ,SAAS;IACtD,SAAgB,YAAY,EAAE,MAAM,CAAC;IACrC,SAAgB,QAAQ,EAAE,cAAc,CAAC;IACzC,SAAgB,QAAQ,EAAE,cAAc,CAAC;gBAE7B,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,cAAc;CAQvF;AAED;;;;;;GAMG;AACH,qBAAa,uCAAwC,SAAQ,SAAS;IAClE,SAAgB,YAAY,EAAE,MAAM,CAAC;IACrC,SAAgB,SAAS,EAAE,cAAc,CAAC;gBAE9B,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,cAAc;CAO9D;AAED;;;;;;;GAOG;AACH,qBAAa,yBAA0B,SAAQ,SAAS;IACpD,SAAgB,SAAS,EAAE,cAAc,CAAC;IAC1C,SAAgB,OAAO,EAAE,MAAM,CAAC;gBAEpB,SAAS,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM;CAOzD"}
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MissingRequiredProofError = exports.ShareBlockMissingLoanApplicationIdError = exports.ShareBlockTypeMismatchError = void 0;
4
+ const base_error_1 = require("../base-error");
5
+ /**
6
+ * Thrown by a ShareBlock factory when the supplied metadata's `blockType`
7
+ * doesn't match the factory's variant. Each factory expects a specific
8
+ * `ShareBlockType` — e.g. `createFundingShareBlock` requires
9
+ * `metadata.blockType === ShareBlockType.Funding`.
10
+ */
11
+ class ShareBlockTypeMismatchError extends base_error_1.BaseError {
12
+ constructor(shareBlockId, expected, received) {
13
+ super(`ShareBlock ${shareBlockId}: factory for type ${expected} received metadata.blockType === ${received}.`);
14
+ this.shareBlockId = shareBlockId;
15
+ this.expected = expected;
16
+ this.received = received;
17
+ }
18
+ }
19
+ exports.ShareBlockTypeMismatchError = ShareBlockTypeMismatchError;
20
+ /**
21
+ * Thrown by Funding/Distribution factories when
22
+ * `metadata.relatedLoanApplicationId` is missing. Both variants always tie
23
+ * back to a specific loan application; constructing one without an id is a
24
+ * caller bug (caught at construction rather than first transaction so the
25
+ * error surfaces as close to the wiring mistake as possible).
26
+ */
27
+ class ShareBlockMissingLoanApplicationIdError extends base_error_1.BaseError {
28
+ constructor(shareBlockId, blockType) {
29
+ super(`ShareBlock ${shareBlockId}: ${blockType} blocks require metadata.relatedLoanApplicationId, none was provided.`);
30
+ this.shareBlockId = shareBlockId;
31
+ this.blockType = blockType;
32
+ }
33
+ }
34
+ exports.ShareBlockMissingLoanApplicationIdError = ShareBlockMissingLoanApplicationIdError;
35
+ /**
36
+ * Thrown when a wire-format proof bundle is missing a proof for one of the
37
+ * purposes the target ShareBlock variant requires. The HTTP route uses the
38
+ * per-variant `*_REQUIRED_PROOF_PURPOSES` array (exported from each
39
+ * `create-*-shareblock` module) to detect this early — before any state
40
+ * lands — so callers get one explicit "you forgot purpose X" instead of a
41
+ * confusing chain of verifyStructuralProof failures.
42
+ */
43
+ class MissingRequiredProofError extends base_error_1.BaseError {
44
+ constructor(blockType, purpose) {
45
+ super(`Missing required proof for purpose '${purpose}' on ${blockType} ShareBlock construction.`);
46
+ this.blockType = blockType;
47
+ this.purpose = purpose;
48
+ }
49
+ }
50
+ exports.MissingRequiredProofError = MissingRequiredProofError;
@@ -0,0 +1,8 @@
1
+ import { BaseError } from '../base-error';
2
+ /**
3
+ * This is thrown when the crypto proof is not valid on the shared data object.
4
+ */
5
+ export declare class ShareDataCryptoProofNotValidError extends BaseError {
6
+ constructor(shareDataId: string, cryptoProof: string, publicKey: string);
7
+ }
8
+ //# sourceMappingURL=crypto-validation-errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crypto-validation-errors.d.ts","sourceRoot":"","sources":["../../../src/errors/validation/crypto-validation-errors.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C;;GAEG;AACH,qBAAa,iCAAkC,SAAQ,SAAS;gBAChD,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CAI1E"}