@degenerate/generic 0.2.7 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_settings/database-settings.d.ts +3 -0
- package/dist/_settings/database-settings.d.ts.map +1 -1
- package/dist/_settings/database-settings.js +3 -0
- package/dist/application/audit-log/additional-ids/create-audit-log-additional-ids-with-query.d.ts.map +1 -1
- package/dist/application/audit-log/additional-ids/create-multiple-path-alai.d.ts.map +1 -1
- package/dist/application/audit-log/additional-ids/create-query-audit-log-for-alai.d.ts.map +1 -1
- package/dist/application/audit-log/create-application-audit-log.d.ts.map +1 -1
- package/dist/application/audit-log/create-application-audit-log.js +1 -1
- package/dist/application/database/firestore/generics/add-items-to-database.d.ts.map +1 -1
- package/dist/application/database/firestore/generics/add-items-to-database.js +2 -2
- package/dist/application/database/firestore/generics/add-or-update-items-to-database.d.ts.map +1 -1
- package/dist/application/database/firestore/generics/add-or-update-items-to-database.js +3 -3
- package/dist/application/database/firestore/generics/create-database-change-information.d.ts.map +1 -1
- package/dist/application/database/firestore/generics/delete-items-on-database.d.ts.map +1 -1
- package/dist/application/database/firestore/generics/delete-items-on-database.js +2 -2
- package/dist/application/database/firestore/generics/get-item-from-database.d.ts.map +1 -1
- package/dist/application/database/firestore/generics/get-item-from-database.js +2 -2
- package/dist/application/database/firestore/generics/get-items-different-path-on-database.d.ts.map +1 -1
- package/dist/application/database/firestore/generics/get-items-different-path-on-database.js +2 -2
- package/dist/application/database/firestore/generics/get-items-from-database.d.ts.map +1 -1
- package/dist/application/database/firestore/generics/get-items-from-database.js +1 -1
- package/dist/application/database/firestore/generics/update-items-on-database.d.ts.map +1 -1
- package/dist/application/database/firestore/generics/update-items-on-database.js +2 -2
- package/dist/application/database/firestore/generics/update-items-properties-on-database.d.ts.map +1 -1
- package/dist/application/database/firestore/generics/update-items-properties-on-database.js +2 -2
- package/dist/authorization/index.d.ts +1 -0
- package/dist/authorization/index.d.ts.map +1 -1
- package/dist/authorization/index.js +1 -0
- package/dist/authorization/jwt/keys/create-public-key-pem.d.ts.map +1 -1
- package/dist/authorization/jwt/keys/create-secret-key-pem.d.ts.map +1 -1
- package/dist/authorization/jwt/sign/create-authorization-issuer.d.ts.map +1 -1
- package/dist/authorization/jwt/sign/create-authorization-subject.d.ts.map +1 -1
- package/dist/authorization/jwt/sign/create-jwt-options.d.ts +7 -1
- package/dist/authorization/jwt/sign/create-jwt-options.d.ts.map +1 -1
- package/dist/authorization/jwt/sign/create-jwt-signed-token.d.ts.map +1 -1
- package/dist/authorization/jwt/transform/transform-token-payload-to-safe-payload.d.ts.map +1 -1
- package/dist/authorization/jwt/verify/get-decoded-jwt-header.d.ts.map +1 -1
- package/dist/authorization/jwt/verify/get-decoded-jwt-signed-token-payload.d.ts.map +1 -1
- package/dist/authorization/jwt/verify/verify-jwt-signed-token.d.ts.map +1 -1
- package/dist/authorization/safe/request/decode-bearer-token.d.ts.map +1 -1
- package/dist/authorization/safe/request/decode-safe-request.d.ts.map +1 -1
- package/dist/authorization/safe/request/determine-issuer-from-request.d.ts.map +1 -1
- package/dist/authorization/safe/request/issuer/determine-issuer-from-bearer-token.d.ts.map +1 -1
- package/dist/authorization/safe/request/verify-jwt-bearer-token-for-audience.d.ts +31 -0
- package/dist/authorization/safe/request/verify-jwt-bearer-token-for-audience.d.ts.map +1 -0
- package/dist/authorization/safe/request/verify-jwt-bearer-token-for-audience.js +50 -0
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-audience.d.ts.map +1 -1
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-expiration-time.d.ts.map +1 -1
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-issued-at-time.d.ts.map +1 -1
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-issuer.d.ts.map +1 -1
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-not-before-time.d.ts.map +1 -1
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-subject.d.ts.map +1 -1
- package/dist/authorization/safe/validation/jwt/verify-token-header.d.ts.map +1 -1
- package/dist/authorization/safe/validation/jwt/verify-token-payload.d.ts.map +1 -1
- package/dist/crypto/calculate-combined-hash.d.ts.map +1 -1
- package/dist/crypto/calculate-hash.d.ts +1 -1
- package/dist/crypto/calculate-hash.d.ts.map +1 -1
- package/dist/crypto/calculate-hash.js +1 -1
- package/dist/crypto/index.d.ts +1 -0
- package/dist/crypto/index.d.ts.map +1 -1
- package/dist/crypto/index.js +1 -0
- package/dist/crypto/private-public-keys/create-key-pair-from-mnemonic.d.ts.map +1 -1
- package/dist/crypto/private-public-keys/create-key-pair-from-private-key.d.ts.map +1 -1
- package/dist/crypto/private-public-keys/create-key-pair-from-private-key.js +1 -1
- package/dist/crypto/private-public-keys/create-key-pair-from-public-key.d.ts +11 -0
- package/dist/crypto/private-public-keys/create-key-pair-from-public-key.d.ts.map +1 -0
- package/dist/crypto/private-public-keys/create-key-pair-from-public-key.js +51 -0
- package/dist/crypto/private-public-keys/generation/create-entropy-for-elliptical-curve.d.ts.map +1 -1
- package/dist/crypto/private-public-keys/generation/generate-key-pair.d.ts.map +1 -1
- package/dist/crypto/private-public-keys/generation/get-private-public-key-from-keypair.d.ts.map +1 -1
- package/dist/crypto/signature/create-crypto-signature.d.ts +11 -0
- package/dist/crypto/signature/create-crypto-signature.d.ts.map +1 -1
- package/dist/crypto/signature/create-crypto-signature.js +14 -1
- package/dist/crypto/signature/verify-crypto-signature-by-data.d.ts +4 -0
- package/dist/crypto/signature/verify-crypto-signature-by-data.d.ts.map +1 -1
- package/dist/crypto/signature/verify-crypto-signature-by-data.js +8 -2
- package/dist/crypto/signature/verify-crypto-signature-by-hash.d.ts +4 -0
- package/dist/crypto/signature/verify-crypto-signature-by-hash.d.ts.map +1 -1
- package/dist/crypto/signature/verify-crypto-signature-by-hash.js +7 -1
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +2 -0
- package/dist/errors/share-data/share-data-errors.d.ts +105 -1
- package/dist/errors/share-data/share-data-errors.d.ts.map +1 -1
- package/dist/errors/share-data/share-data-errors.js +148 -1
- package/dist/errors/shareblock/shareblock-errors.d.ts +40 -0
- package/dist/errors/shareblock/shareblock-errors.d.ts.map +1 -0
- package/dist/errors/shareblock/shareblock-errors.js +50 -0
- package/dist/errors/validation/crypto-validation-errors.d.ts +8 -0
- package/dist/errors/validation/crypto-validation-errors.d.ts.map +1 -0
- package/dist/errors/validation/crypto-validation-errors.js +15 -0
- package/dist/helpers/array/array-helpers.d.ts.map +1 -1
- package/dist/helpers/crypto/cryptography-helpers.d.ts.map +1 -1
- package/dist/helpers/data/data-helpers.d.ts.map +1 -1
- package/dist/helpers/file/file-helpers.d.ts.map +1 -1
- package/dist/helpers/id-helpers.d.ts.map +1 -1
- package/dist/helpers/lodash/lodash-helpers.d.ts.map +1 -1
- package/dist/helpers/object-helpers.d.ts.map +1 -1
- package/dist/helpers/object-validation-helpers.d.ts.map +1 -1
- package/dist/helpers/request/params-object-helpers.d.ts +6 -13
- package/dist/helpers/request/params-object-helpers.d.ts.map +1 -1
- package/dist/helpers/request/params-object-helpers.js +11 -21
- package/dist/helpers/request/query-object-helpers.d.ts.map +1 -1
- package/dist/helpers/request/request-object-helpers.d.ts.map +1 -1
- package/dist/models/application/audit-log/application-audit-log-models.d.ts +82 -92
- package/dist/models/application/audit-log/application-audit-log-models.d.ts.map +1 -1
- package/dist/models/application/database/firestore-models.d.ts +158 -307
- package/dist/models/application/database/firestore-models.d.ts.map +1 -1
- package/dist/models/authorization/authorization-models.d.ts +34 -44
- package/dist/models/authorization/authorization-models.d.ts.map +1 -1
- package/dist/models/authorization/authorization-models.js +2 -2
- package/dist/models/crypto/crypto-models.d.ts +1 -7
- package/dist/models/crypto/crypto-models.d.ts.map +1 -1
- package/dist/models/data/data-models.d.ts +27 -13
- package/dist/models/data/data-models.d.ts.map +1 -1
- package/dist/models/data/data-models.js +23 -2
- package/dist/models/dynamic-execution/dynamic-execution-models.d.ts +1 -9
- package/dist/models/dynamic-execution/dynamic-execution-models.d.ts.map +1 -1
- package/dist/models/events/share-event-models.d.ts +91 -120
- package/dist/models/events/share-event-models.d.ts.map +1 -1
- package/dist/models/events/share-event-models.js +35 -4
- package/dist/models/functions/share-data-function-models.d.ts +23 -193
- package/dist/models/functions/share-data-function-models.d.ts.map +1 -1
- package/dist/models/functions/share-data-function-models.js +1 -1
- package/dist/models/generic/request-response-models.d.ts +1 -7
- package/dist/models/generic/request-response-models.d.ts.map +1 -1
- package/dist/models/index.d.ts +4 -1
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/index.js +4 -1
- package/dist/models/rules/share-rule-models.d.ts +759 -1116
- package/dist/models/rules/share-rule-models.d.ts.map +1 -1
- package/dist/models/rules/share-rule-models.js +6 -6
- package/dist/models/safe/safe-transaction-models.d.ts +28 -30
- package/dist/models/safe/safe-transaction-models.d.ts.map +1 -1
- package/dist/models/safe/transactions/authorities-transactions-models.d.ts +77 -419
- package/dist/models/safe/transactions/authorities-transactions-models.d.ts.map +1 -1
- package/dist/models/safe/transactions/authorities-transactions-models.js +3 -3
- package/dist/models/safe/transactions/events-transactions-models.d.ts +22 -372
- package/dist/models/safe/transactions/events-transactions-models.d.ts.map +1 -1
- package/dist/models/safe/transactions/events-transactions-models.js +1 -1
- package/dist/models/safe/transactions/functions-transactions-models.d.ts +22 -372
- package/dist/models/safe/transactions/functions-transactions-models.d.ts.map +1 -1
- package/dist/models/safe/transactions/functions-transactions-models.js +1 -1
- package/dist/models/safe/transactions/rules-transactions-models.d.ts +59 -603
- package/dist/models/safe/transactions/rules-transactions-models.d.ts.map +1 -1
- package/dist/models/safe/transactions/sharedata-transactions-models.d.ts +256 -388
- package/dist/models/safe/transactions/sharedata-transactions-models.d.ts.map +1 -1
- package/dist/models/safe/transactions/sharedata-transactions-models.js +30 -4
- package/dist/models/share-data/share-data-crypto-models.d.ts +344 -0
- package/dist/models/share-data/share-data-crypto-models.d.ts.map +1 -0
- package/dist/models/share-data/share-data-crypto-models.js +131 -0
- package/dist/models/share-data/share-data-models.d.ts +114 -0
- package/dist/models/share-data/share-data-models.d.ts.map +1 -0
- package/dist/models/share-data/{share-data.js → share-data-models.js} +1 -1
- package/dist/models/share-data/share-data-persistence-models.d.ts +165 -0
- package/dist/models/share-data/share-data-persistence-models.d.ts.map +1 -0
- package/dist/models/share-data/share-data-persistence-models.js +101 -0
- package/dist/models/shareblock/shareblock-models.d.ts +489 -0
- package/dist/models/shareblock/shareblock-models.d.ts.map +1 -0
- package/dist/models/shareblock/shareblock-models.js +395 -0
- package/dist/transactions/authority/create-safe-transaction-authority-data.d.ts.map +1 -1
- package/dist/transactions/authority/create-safe-transaction-authority.d.ts.map +1 -1
- package/package.json +30 -22
- package/dist/models/share-data/share-data.d.ts +0 -181
- package/dist/models/share-data/share-data.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/crypto/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAK1C,cAAc,uEAAuE,CAAC;AACtF,cAAc,sEAAsE,CAAC;AACrF,cAAc,gEAAgE,CAAC;AAC/E,cAAc,6DAA6D,CAAC;AAC5E,cAAc,oDAAoD,CAAC;AACnE,cAAc,sEAAsE,CAAC;AAGrF,cAAc,wDAAwD,CAAC;AACvE,cAAc,qDAAqD,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/crypto/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAK1C,cAAc,uEAAuE,CAAC;AACtF,cAAc,sEAAsE,CAAC;AACrF,cAAc,gEAAgE,CAAC;AAC/E,cAAc,6DAA6D,CAAC;AAC5E,cAAc,oDAAoD,CAAC;AACnE,cAAc,sEAAsE,CAAC;AAGrF,cAAc,wDAAwD,CAAC;AACvE,cAAc,qDAAqD,CAAC;AACpE,cAAc,uDAAuD,CAAC;AAMtE,cAAc,qCAAqC,CAAC;AACpD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,6CAA6C,CAAC"}
|
package/dist/crypto/index.js
CHANGED
|
@@ -27,6 +27,7 @@ __exportStar(require("./private-public-keys/generation/get-private-public-key-fr
|
|
|
27
27
|
//#endregion folder generation
|
|
28
28
|
__exportStar(require("./private-public-keys/create-key-pair-from-private-key"), exports);
|
|
29
29
|
__exportStar(require("./private-public-keys/create-key-pair-from-mnemonic"), exports);
|
|
30
|
+
__exportStar(require("./private-public-keys/create-key-pair-from-public-key"), exports);
|
|
30
31
|
//#endregion folder private-public-keys
|
|
31
32
|
//#region folder signature
|
|
32
33
|
__exportStar(require("./signature/create-crypto-signature"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-key-pair-from-mnemonic.d.ts","sourceRoot":"","sources":["../../../src/crypto/private-public-keys/create-key-pair-from-mnemonic.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAErC,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAkB,MAAM,uCAAuC,CAAC;AAE5H;;;;;;GAMG;AACH,QAAA,MAAM,yBAAyB,
|
|
1
|
+
{"version":3,"file":"create-key-pair-from-mnemonic.d.ts","sourceRoot":"","sources":["../../../src/crypto/private-public-keys/create-key-pair-from-mnemonic.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAErC,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAkB,MAAM,uCAAuC,CAAC;AAE5H;;;;;;GAMG;AACH,QAAA,MAAM,yBAAyB,GAAI,OAAO,uBAAuB,GAAG,0BAA0B,EAAE,UAAU,MAAM,KAAG,QAAQ,CAAC,EAAE,CAAC,OAO9H,CAAC;AAEF,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
|
|
@@ -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,
|
|
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;
|
package/dist/crypto/private-public-keys/generation/create-entropy-for-elliptical-curve.d.ts.map
CHANGED
|
@@ -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,
|
|
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,
|
|
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"}
|
package/dist/crypto/private-public-keys/generation/get-private-public-key-from-keypair.d.ts.map
CHANGED
|
@@ -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,
|
|
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;
|
|
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
|
|
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;
|
|
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
|
|
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
|
-
|
|
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;
|
|
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
|
-
|
|
55
|
+
const digest = (0, calculate_hash_1.calculateHash)(hash);
|
|
56
|
+
return key.verify(digest, signature);
|
|
51
57
|
};
|
|
52
58
|
exports.verifyCryptoSignatureByHash = verifyCryptoSignatureByHash;
|
package/dist/errors/index.d.ts
CHANGED
|
@@ -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;
|
|
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"}
|
package/dist/errors/index.js
CHANGED
|
@@ -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,108 @@ 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 a delegated-signer registration is rejected.
|
|
143
|
+
* Distinct from {@link ShareDataTransactionNotAuthorizedError} (which rejects a
|
|
144
|
+
* runtime *transaction* whose signer is not authorized): this rejects the
|
|
145
|
+
* *registration* of a delegate — either because the registration proof was not
|
|
146
|
+
* signed by the block's `creationPublicKey` (only the owner may delegate; there
|
|
147
|
+
* is no transitive delegation), because the granted function-id set is empty,
|
|
148
|
+
* or because the proof's `purpose` does not bind the exact
|
|
149
|
+
* `(signerPublicKey, functionIds)` grant being registered.
|
|
150
|
+
*/
|
|
151
|
+
export declare class ShareDataDelegationNotAuthorizedError extends BaseError {
|
|
152
|
+
constructor(shareDataId: string, registeringPublicKey: string);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* This error is thrown when the system attempts to get the previous share data hash
|
|
156
|
+
* but the share data has not been initialized for the proof yet.
|
|
157
|
+
*/
|
|
158
|
+
export declare class ShareDataPreviousHashNotAvailableError extends BaseError {
|
|
159
|
+
constructor(shareDataId: string);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* This error is thrown when a persisted ShareData snapshot cannot be replayed — an
|
|
163
|
+
* unknown block type, an unrecognized schema version, or a transaction whose
|
|
164
|
+
* `functionId` does not resolve to a registered function on the rebuilt block.
|
|
165
|
+
* Distinct from {@link ShareDataIntegrityError}, which signals that a replay
|
|
166
|
+
* succeeded but its result diverged from the snapshot's `expected*` cross-checks.
|
|
167
|
+
*/
|
|
168
|
+
export declare class ShareDataPersistenceError extends BaseError {
|
|
169
|
+
constructor(shareDataId: string, reason: string);
|
|
170
|
+
}
|
|
67
171
|
//# 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,
|
|
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;;;;;;;;;GASG;AACH,qBAAa,qCAAsC,SAAQ,SAAS;gBACpD,WAAW,EAAE,MAAM,EAAE,oBAAoB,EAAE,MAAM;CAOhE;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.ShareDataDelegationNotAuthorizedError = 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,150 @@ 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 a delegated-signer registration is rejected.
|
|
200
|
+
* Distinct from {@link ShareDataTransactionNotAuthorizedError} (which rejects a
|
|
201
|
+
* runtime *transaction* whose signer is not authorized): this rejects the
|
|
202
|
+
* *registration* of a delegate — either because the registration proof was not
|
|
203
|
+
* signed by the block's `creationPublicKey` (only the owner may delegate; there
|
|
204
|
+
* is no transitive delegation), because the granted function-id set is empty,
|
|
205
|
+
* or because the proof's `purpose` does not bind the exact
|
|
206
|
+
* `(signerPublicKey, functionIds)` grant being registered.
|
|
207
|
+
*/
|
|
208
|
+
class ShareDataDelegationNotAuthorizedError extends base_error_1.BaseError {
|
|
209
|
+
constructor(shareDataId, registeringPublicKey) {
|
|
210
|
+
super(`Share data with id ${shareDataId} rejected a delegated-signer registration: ` +
|
|
211
|
+
`key ${registeringPublicKey} is not authorized to delegate, or the registration ` +
|
|
212
|
+
`proof does not bind the requested grant.`);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
exports.ShareDataDelegationNotAuthorizedError = ShareDataDelegationNotAuthorizedError;
|
|
216
|
+
/**
|
|
217
|
+
* This error is thrown when the system attempts to get the previous share data hash
|
|
218
|
+
* but the share data has not been initialized for the proof yet.
|
|
219
|
+
*/
|
|
220
|
+
class ShareDataPreviousHashNotAvailableError extends base_error_1.BaseError {
|
|
221
|
+
constructor(shareDataId) {
|
|
222
|
+
super(`Share data with id ${shareDataId} previous hash is not available. ` +
|
|
223
|
+
`This is likely due to the share data not being initialized.`);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
exports.ShareDataPreviousHashNotAvailableError = ShareDataPreviousHashNotAvailableError;
|
|
227
|
+
/**
|
|
228
|
+
* This error is thrown when a persisted ShareData snapshot cannot be replayed — an
|
|
229
|
+
* unknown block type, an unrecognized schema version, or a transaction whose
|
|
230
|
+
* `functionId` does not resolve to a registered function on the rebuilt block.
|
|
231
|
+
* Distinct from {@link ShareDataIntegrityError}, which signals that a replay
|
|
232
|
+
* succeeded but its result diverged from the snapshot's `expected*` cross-checks.
|
|
233
|
+
*/
|
|
234
|
+
class ShareDataPersistenceError extends base_error_1.BaseError {
|
|
235
|
+
constructor(shareDataId, reason) {
|
|
236
|
+
super(`Share data with id ${shareDataId} could not be reconstructed from its persisted snapshot: ${reason}`);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
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"}
|