@degenerate/generic 0.1.2 → 0.1.4
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/authorization-settings.d.ts +17 -0
- package/dist/_settings/authorization-settings.d.ts.map +1 -0
- package/dist/_settings/authorization-settings.js +20 -0
- package/dist/_settings/cryptography-settings.d.ts +15 -3
- package/dist/_settings/cryptography-settings.d.ts.map +1 -1
- package/dist/_settings/cryptography-settings.js +16 -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 +0 -3
- package/dist/authorization/index.d.ts +24 -0
- package/dist/authorization/index.d.ts.map +1 -0
- package/dist/authorization/index.js +61 -0
- package/dist/authorization/jwt/keys/create-public-key-pem.d.ts +9 -0
- package/dist/authorization/jwt/keys/create-public-key-pem.d.ts.map +1 -0
- package/dist/authorization/jwt/keys/create-public-key-pem.js +25 -0
- package/dist/authorization/jwt/keys/create-secret-key-pem.d.ts +9 -0
- package/dist/authorization/jwt/keys/create-secret-key-pem.d.ts.map +1 -0
- package/dist/authorization/jwt/keys/create-secret-key-pem.js +24 -0
- package/dist/authorization/jwt/sign/create-authorization-issuer.d.ts +10 -0
- package/dist/authorization/jwt/sign/create-authorization-issuer.d.ts.map +1 -0
- package/dist/authorization/jwt/sign/create-authorization-issuer.js +26 -0
- package/dist/authorization/jwt/sign/create-authorization-subject.d.ts +12 -0
- package/dist/authorization/jwt/sign/create-authorization-subject.d.ts.map +1 -0
- package/dist/authorization/jwt/sign/create-authorization-subject.js +19 -0
- package/dist/authorization/jwt/sign/create-jwt-options.d.ts +17 -0
- package/dist/authorization/jwt/sign/create-jwt-options.d.ts.map +1 -0
- package/dist/authorization/jwt/sign/create-jwt-options.js +43 -0
- package/dist/authorization/jwt/sign/create-jwt-signed-token.d.ts +13 -0
- package/dist/authorization/jwt/sign/create-jwt-signed-token.d.ts.map +1 -0
- package/dist/authorization/jwt/sign/create-jwt-signed-token.js +22 -0
- package/dist/authorization/jwt/transform/transform-token-payload-to-safe-payload.d.ts +10 -0
- package/dist/authorization/jwt/transform/transform-token-payload-to-safe-payload.d.ts.map +1 -0
- package/dist/authorization/jwt/transform/transform-token-payload-to-safe-payload.js +31 -0
- package/dist/authorization/jwt/verify/get-decoded-jwt-header.d.ts +10 -0
- package/dist/authorization/jwt/verify/get-decoded-jwt-header.d.ts.map +1 -0
- package/dist/authorization/jwt/verify/get-decoded-jwt-header.js +20 -0
- package/dist/authorization/jwt/verify/get-decoded-jwt-signed-token-payload.d.ts +9 -0
- package/dist/authorization/jwt/verify/get-decoded-jwt-signed-token-payload.d.ts.map +1 -0
- package/dist/authorization/jwt/verify/get-decoded-jwt-signed-token-payload.js +17 -0
- package/dist/authorization/jwt/verify/verify-jwt-signed-token.d.ts +12 -0
- package/dist/authorization/jwt/verify/verify-jwt-signed-token.d.ts.map +1 -0
- package/dist/authorization/jwt/verify/verify-jwt-signed-token.js +34 -0
- package/dist/authorization/safe/authorization/authorized-authorities.d.ts +39 -0
- package/dist/authorization/safe/authorization/authorized-authorities.d.ts.map +1 -0
- package/dist/authorization/safe/authorization/authorized-authorities.js +56 -0
- package/dist/authorization/safe/request/decode-bearer-token.d.ts +11 -0
- package/dist/authorization/safe/request/decode-bearer-token.d.ts.map +1 -0
- package/dist/authorization/safe/request/decode-bearer-token.js +31 -0
- package/dist/authorization/safe/request/decode-safe-request.d.ts +11 -0
- package/dist/authorization/safe/request/decode-safe-request.d.ts.map +1 -0
- package/dist/authorization/safe/request/decode-safe-request.js +30 -0
- package/dist/authorization/safe/request/determine-issuer-from-request.d.ts +10 -0
- package/dist/authorization/safe/request/determine-issuer-from-request.d.ts.map +1 -0
- package/dist/authorization/safe/request/determine-issuer-from-request.js +29 -0
- package/dist/authorization/safe/request/issuer/determine-issuer-from-bearer-token.d.ts +12 -0
- package/dist/authorization/safe/request/issuer/determine-issuer-from-bearer-token.d.ts.map +1 -0
- package/dist/authorization/safe/request/issuer/determine-issuer-from-bearer-token.js +30 -0
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-audience.d.ts +10 -0
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-audience.d.ts.map +1 -0
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-audience.js +24 -0
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-expiration-time.d.ts +8 -0
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-expiration-time.d.ts.map +1 -0
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-expiration-time.js +23 -0
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-issued-at-time.d.ts +9 -0
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-issued-at-time.d.ts.map +1 -0
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-issued-at-time.js +24 -0
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-issuer.d.ts +10 -0
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-issuer.d.ts.map +1 -0
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-issuer.js +25 -0
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-not-before-time.d.ts +8 -0
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-not-before-time.d.ts.map +1 -0
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-not-before-time.js +23 -0
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-subject.d.ts +10 -0
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-subject.d.ts.map +1 -0
- package/dist/authorization/safe/validation/jwt/payload/verify-authorization-subject.js +22 -0
- package/dist/authorization/safe/validation/jwt/verify-token-header.d.ts +9 -0
- package/dist/authorization/safe/validation/jwt/verify-token-header.d.ts.map +1 -0
- package/dist/authorization/safe/validation/jwt/verify-token-header.js +25 -0
- package/dist/authorization/safe/validation/jwt/verify-token-payload.d.ts +11 -0
- package/dist/authorization/safe/validation/jwt/verify-token-payload.d.ts.map +1 -0
- package/dist/authorization/safe/validation/jwt/verify-token-payload.js +30 -0
- 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-private-key.d.ts.map +1 -1
- package/dist/crypto/private-public-keys/generation/create-256-private-key-from-mnemonic.d.ts +1 -1
- package/dist/crypto/private-public-keys/generation/create-256-private-key-from-mnemonic.js +1 -1
- package/dist/crypto/private-public-keys/generation/create-entropy-for-elliptical-curve.d.ts +1 -1
- package/dist/crypto/private-public-keys/generation/create-entropy-for-elliptical-curve.d.ts.map +1 -1
- package/dist/crypto/private-public-keys/generation/create-entropy-for-elliptical-curve.js +3 -2
- package/dist/crypto/private-public-keys/generation/create-random-512-key-pair.d.ts +9 -0
- package/dist/crypto/private-public-keys/generation/create-random-512-key-pair.d.ts.map +1 -0
- package/dist/crypto/private-public-keys/generation/create-random-512-key-pair.js +46 -0
- package/dist/errors/authorization/authorization-errors.d.ts +106 -0
- package/dist/errors/authorization/authorization-errors.d.ts.map +1 -0
- package/dist/errors/authorization/authorization-errors.js +160 -0
- package/dist/errors/index.d.ts +1 -0
- package/dist/errors/index.d.ts.map +1 -1
- package/dist/errors/index.js +1 -0
- package/dist/errors/safe/safe-rules-errors.d.ts +72 -0
- package/dist/errors/safe/safe-rules-errors.d.ts.map +1 -1
- package/dist/errors/safe/safe-rules-errors.js +113 -1
- package/dist/helpers/crypto/cryptography-helpers.d.ts +37 -0
- package/dist/helpers/crypto/cryptography-helpers.d.ts.map +1 -0
- package/dist/helpers/crypto/cryptography-helpers.js +65 -0
- package/dist/helpers/index.d.ts +1 -0
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/index.js +1 -0
- package/dist/helpers/object-validation-helpers.d.ts +8 -1
- package/dist/helpers/object-validation-helpers.d.ts.map +1 -1
- package/dist/helpers/object-validation-helpers.js +22 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/models/authorization/authorization-models.d.ts +81 -0
- package/dist/models/authorization/authorization-models.d.ts.map +1 -0
- package/dist/models/authorization/authorization-models.js +33 -0
- package/dist/models/crypto/crypto-models.d.ts +5 -0
- package/dist/models/crypto/crypto-models.d.ts.map +1 -0
- package/dist/models/crypto/crypto-models.js +3 -0
- package/dist/models/index.d.ts +5 -0
- package/dist/models/index.d.ts.map +1 -1
- package/dist/models/index.js +5 -0
- package/dist/models/rules/share-rule-models.d.ts +42 -19
- package/dist/models/rules/share-rule-models.d.ts.map +1 -1
- package/dist/models/rules/share-rule-models.js +9 -8
- package/dist/models/safe/safe-transactions.d.ts +81 -0
- package/dist/models/safe/safe-transactions.d.ts.map +1 -0
- package/dist/models/safe/safe-transactions.js +26 -0
- package/dist/models/share-data/share-data.d.ts +1 -0
- package/dist/models/share-data/share-data.d.ts.map +1 -1
- package/dist/models/share-data/share-data.js +1 -0
- package/package.json +4 -3
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.verifyTokenHeader = void 0;
|
|
4
|
+
const authorization_settings_1 = require("../../../../_settings/authorization-settings");
|
|
5
|
+
const authorization_errors_1 = require("../../../../errors/authorization/authorization-errors");
|
|
6
|
+
const get_decoded_jwt_header_1 = require("../../../jwt/verify/get-decoded-jwt-header");
|
|
7
|
+
/**
|
|
8
|
+
* This validates that the header encoding is the expected encoding for the token
|
|
9
|
+
*
|
|
10
|
+
* @param token the token to validate the header of.
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
13
|
+
const verifyTokenHeader = (token) => {
|
|
14
|
+
const jwtTokenParts = token.split('.');
|
|
15
|
+
if (jwtTokenParts.length !== 3) {
|
|
16
|
+
throw new authorization_errors_1.SafeAuthorizationTokenNotBase64Error();
|
|
17
|
+
}
|
|
18
|
+
const header = (0, get_decoded_jwt_header_1.getDecodedJwtHeader)(token);
|
|
19
|
+
if (header.alg !== authorization_settings_1.AuthorizationSettings.JWT.Algorithm ||
|
|
20
|
+
header.typ !== authorization_settings_1.AuthorizationSettings.JWT.HeaderType) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
return true;
|
|
24
|
+
};
|
|
25
|
+
exports.verifyTokenHeader = verifyTokenHeader;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import jwt from 'jsonwebtoken';
|
|
2
|
+
import { IValidSafeTokenPayload } from '../../../../models/authorization/authorization-models';
|
|
3
|
+
/**
|
|
4
|
+
* This function verifies the payload of the token to have the minimum token information from the decoded token payload.
|
|
5
|
+
*
|
|
6
|
+
* @param payload the payload to verify
|
|
7
|
+
* @returns void (throws an error if the payload is not valid)
|
|
8
|
+
*/
|
|
9
|
+
declare const verifyTokenPayload: (payload: jwt.JwtPayload) => payload is IValidSafeTokenPayload;
|
|
10
|
+
export { verifyTokenPayload };
|
|
11
|
+
//# sourceMappingURL=verify-token-payload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify-token-payload.d.ts","sourceRoot":"","sources":["../../../../../src/authorization/safe/validation/jwt/verify-token-payload.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,cAAc,CAAC;AAU/B,OAAO,EAAE,sBAAsB,EAAE,MAAM,uDAAuD,CAAC;AAE/F;;;;;GAKG;AACH,QAAA,MAAM,kBAAkB,YAAa,GAAG,CAAC,UAAU,KAAG,OAAO,IAAI,sBAchE,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.verifyTokenPayload = void 0;
|
|
4
|
+
const authorization_errors_1 = require("../../../../errors/authorization/authorization-errors");
|
|
5
|
+
const verify_authorization_issuer_1 = require("./payload/verify-authorization-issuer");
|
|
6
|
+
const verify_authorization_subject_1 = require("./payload/verify-authorization-subject");
|
|
7
|
+
const verify_authorization_audience_1 = require("./payload/verify-authorization-audience");
|
|
8
|
+
const verify_authorization_not_before_time_1 = require("./payload/verify-authorization-not-before-time");
|
|
9
|
+
const verify_authorization_expiration_time_1 = require("./payload/verify-authorization-expiration-time");
|
|
10
|
+
const verify_authorization_issued_at_time_1 = require("./payload/verify-authorization-issued-at-time");
|
|
11
|
+
/**
|
|
12
|
+
* This function verifies the payload of the token to have the minimum token information from the decoded token payload.
|
|
13
|
+
*
|
|
14
|
+
* @param payload the payload to verify
|
|
15
|
+
* @returns void (throws an error if the payload is not valid)
|
|
16
|
+
*/
|
|
17
|
+
const verifyTokenPayload = (payload) => {
|
|
18
|
+
if (!payload || typeof payload !== 'object') {
|
|
19
|
+
throw new authorization_errors_1.SafeAuthorizationPayloadNotValidError();
|
|
20
|
+
}
|
|
21
|
+
// make sure the issued at time is a valid
|
|
22
|
+
(0, verify_authorization_issued_at_time_1.verifyAuthorizationIssuedAtTime)(payload.iat);
|
|
23
|
+
(0, verify_authorization_not_before_time_1.verifyAuthorizationNotBeforeTime)(payload.nbf);
|
|
24
|
+
(0, verify_authorization_expiration_time_1.verifyAuthorizationExpirationTime)(payload.exp);
|
|
25
|
+
(0, verify_authorization_subject_1.verifyAuthorizationSubject)(payload.sub);
|
|
26
|
+
(0, verify_authorization_audience_1.verifyAuthorizationAudience)(payload.aud);
|
|
27
|
+
(0, verify_authorization_issuer_1.verifyAuthorizationIssuer)(payload.iss);
|
|
28
|
+
return true;
|
|
29
|
+
};
|
|
30
|
+
exports.verifyTokenPayload = verifyTokenPayload;
|
package/dist/crypto/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from './calculate-combined-hash';
|
|
|
3
3
|
export * from './private-public-keys/generation/create-256-private-key-from-mnemonic';
|
|
4
4
|
export * from './private-public-keys/generation/create-entropy-for-elliptical-curve';
|
|
5
5
|
export * from './private-public-keys/generation/create-random-256-private-key';
|
|
6
|
+
export * from './private-public-keys/generation/create-random-512-key-pair';
|
|
6
7
|
export * from './private-public-keys/generation/generate-key-pair';
|
|
7
8
|
export * from './private-public-keys/generation/get-private-public-key-from-keypair';
|
|
8
9
|
export * from './private-public-keys/create-key-pair-from-private-key';
|
|
@@ -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,oDAAoD,CAAC;AACnE,cAAc,sEAAsE,CAAC;AAGrF,cAAc,wDAAwD,CAAC;AACvE,cAAc,qDAAqD,CAAC;AAMpE,cAAc,qCAAqC,CAAC;AACpD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,6CAA6C,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;AAMpE,cAAc,qCAAqC,CAAC;AACpD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,6CAA6C,CAAC"}
|
package/dist/crypto/index.js
CHANGED
|
@@ -21,6 +21,7 @@ __exportStar(require("./calculate-combined-hash"), exports);
|
|
|
21
21
|
__exportStar(require("./private-public-keys/generation/create-256-private-key-from-mnemonic"), exports);
|
|
22
22
|
__exportStar(require("./private-public-keys/generation/create-entropy-for-elliptical-curve"), exports);
|
|
23
23
|
__exportStar(require("./private-public-keys/generation/create-random-256-private-key"), exports);
|
|
24
|
+
__exportStar(require("./private-public-keys/generation/create-random-512-key-pair"), exports);
|
|
24
25
|
__exportStar(require("./private-public-keys/generation/generate-key-pair"), exports);
|
|
25
26
|
__exportStar(require("./private-public-keys/generation/get-private-public-key-from-keypair"), exports);
|
|
26
27
|
//#endregion folder generation
|
|
@@ -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,
|
|
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"}
|
|
@@ -28,7 +28,7 @@ const crypto = __importStar(require("crypto"));
|
|
|
28
28
|
const bip39 = __importStar(require("bip39"));
|
|
29
29
|
const cryptography_settings_1 = require("../../../_settings/cryptography-settings");
|
|
30
30
|
/**
|
|
31
|
-
*
|
|
31
|
+
* This function generates a random mnemonic phrase and creates a private key from it. (256 Bits)
|
|
32
32
|
*
|
|
33
33
|
* @returns A random private key as a hexadecimal string.
|
|
34
34
|
*/
|
|
@@ -3,7 +3,7 @@ import { EllipticalCurvesEncryption, EllipticalCurvesSigning } from '../../../_s
|
|
|
3
3
|
* Creates entropy for an elliptical curve.
|
|
4
4
|
*
|
|
5
5
|
* @param signingCurve - The elliptical curve to create entropy for.
|
|
6
|
-
* @returns The entropy for the elliptical curve.
|
|
6
|
+
* @returns The entropy for the elliptical curve. string in hexadecimal format.
|
|
7
7
|
*/
|
|
8
8
|
declare const createEntropyForEllipitalCurve: (curve: EllipticalCurvesSigning | EllipticalCurvesEncryption) => string;
|
|
9
9
|
export { createEntropyForEllipitalCurve };
|
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,UAAW,uBAAuB,GAAG,0BAA0B,KAAG,
|
|
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"}
|
|
@@ -29,12 +29,13 @@ const Elliptic = __importStar(require("elliptic"));
|
|
|
29
29
|
* Creates entropy for an elliptical curve.
|
|
30
30
|
*
|
|
31
31
|
* @param signingCurve - The elliptical curve to create entropy for.
|
|
32
|
-
* @returns The entropy for the elliptical curve.
|
|
32
|
+
* @returns The entropy for the elliptical curve. string in hexadecimal format.
|
|
33
33
|
*/
|
|
34
34
|
const createEntropyForEllipitalCurve = (curve) => {
|
|
35
35
|
const ecKey = new Elliptic.ec(curve);
|
|
36
36
|
const hashStrength = ecKey.hash.hmacStrength;
|
|
37
37
|
const entropy = Elliptic.rand(hashStrength);
|
|
38
|
-
|
|
38
|
+
const entropyHex = entropy.toString('hex');
|
|
39
|
+
return entropyHex;
|
|
39
40
|
};
|
|
40
41
|
exports.createEntropyForEllipitalCurve = createEntropyForEllipitalCurve;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { IPublicPrivateKeyDerPair } from '../../../models/crypto/crypto-models';
|
|
2
|
+
/**
|
|
3
|
+
* This function creates a random key pair using the crypto library for the P521 curve.
|
|
4
|
+
*
|
|
5
|
+
* @returns the private and public key in DER format.
|
|
6
|
+
*/
|
|
7
|
+
declare const createRandom512KeyPair: () => IPublicPrivateKeyDerPair;
|
|
8
|
+
export { createRandom512KeyPair };
|
|
9
|
+
//# sourceMappingURL=create-random-512-key-pair.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-random-512-key-pair.d.ts","sourceRoot":"","sources":["../../../../src/crypto/private-public-keys/generation/create-random-512-key-pair.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAGhF;;;;GAIG;AACH,QAAA,MAAM,sBAAsB,QAAO,wBAelC,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
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 (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.createRandom512KeyPair = void 0;
|
|
27
|
+
const crypto = __importStar(require("crypto"));
|
|
28
|
+
const cryptography_settings_1 = require("../../../_settings/cryptography-settings");
|
|
29
|
+
/**
|
|
30
|
+
* This function creates a random key pair using the crypto library for the P521 curve.
|
|
31
|
+
*
|
|
32
|
+
* @returns the private and public key in DER format.
|
|
33
|
+
*/
|
|
34
|
+
const createRandom512KeyPair = () => {
|
|
35
|
+
const curve = 'secp521r1'; // P521 curve
|
|
36
|
+
const { publicKey, privateKey } = crypto.generateKeyPairSync('ec', { namedCurve: curve }); // Generate the key pair
|
|
37
|
+
const privateKeyDer = privateKey.export({ format: cryptography_settings_1.keyExportFormatDer, type: cryptography_settings_1.sec1KeyExportType })
|
|
38
|
+
.toString(cryptography_settings_1.base64Encoding); // Export the private key to base64
|
|
39
|
+
const publicKeyDer = publicKey.export({ format: cryptography_settings_1.keyExportFormatDer, type: cryptography_settings_1.spkiKeyExportType })
|
|
40
|
+
.toString(cryptography_settings_1.base64Encoding); // Export the public key to base64
|
|
41
|
+
return {
|
|
42
|
+
privateKeyDer,
|
|
43
|
+
publicKeyDer,
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
exports.createRandom512KeyPair = createRandom512KeyPair;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { AuthorityValidationType } from '../../models/authorization/authorization-models';
|
|
2
|
+
import { BaseError } from '../base-error';
|
|
3
|
+
/**
|
|
4
|
+
* This is thrown when the removal of a IJWTAuthority fails because it does not exist.
|
|
5
|
+
*/
|
|
6
|
+
export declare class SafeAuthorizationIssuerDoesNotExistError extends BaseError {
|
|
7
|
+
constructor(issuer: string);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* This is thrown when a authority validation request is received the type of validation requested is unknown.
|
|
11
|
+
* (this should not happen).
|
|
12
|
+
*/
|
|
13
|
+
export declare class SafeAuthorizationAuthorityValidationTypeNotValidError extends BaseError {
|
|
14
|
+
constructor(validationType: AuthorityValidationType);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* This is throw when a database records is not found.
|
|
18
|
+
*/
|
|
19
|
+
export declare class SafeAuthorizationSubjectNotValidError extends BaseError {
|
|
20
|
+
constructor(subjectType: string, subjectId: string);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* This is thrown when the public key given for the issuer is not valid.
|
|
24
|
+
*/
|
|
25
|
+
export declare class SafeAuthorizationIssuerPublicKeyNotValidError extends BaseError {
|
|
26
|
+
constructor(issuerName: string, publicKey: string);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* This is thrown when the issuer is not valid.
|
|
30
|
+
*/
|
|
31
|
+
export declare class SafeAuthorizationIssuerNotValidError extends BaseError {
|
|
32
|
+
constructor(issuer: string);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* This is thrown when the JWT token is not the corrent base64 encoding
|
|
36
|
+
*/
|
|
37
|
+
export declare class SafeAuthorizationTokenNotBase64Error extends BaseError {
|
|
38
|
+
constructor();
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* This is thrown when the secret key or public key is not included for token verification.
|
|
42
|
+
*/
|
|
43
|
+
export declare class SafeAuthorizationKeyNotIncludedForVerificationError extends BaseError {
|
|
44
|
+
constructor();
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* This is thrown when the authorization payload is not valid.
|
|
48
|
+
*/
|
|
49
|
+
export declare class SafeAuthorizationPayloadNotValidError extends BaseError {
|
|
50
|
+
constructor();
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* This is thrown when the type of data in a token is not valid
|
|
54
|
+
*/
|
|
55
|
+
export declare class SafeAuthorizationTokenPropertyDataTypeNotValidError extends BaseError {
|
|
56
|
+
constructor(property: string, propertyValue: any, expectedDataType: string);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* This is thrown when the authorization payload is missing a property
|
|
60
|
+
*/
|
|
61
|
+
export declare class SafeAuthorizationMissingPropertyError extends BaseError {
|
|
62
|
+
constructor(property: string);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* This is thrown when the issued at time is before the current time
|
|
66
|
+
*/
|
|
67
|
+
export declare class SafeAuthorizationTokenIssuedAtTimeNotValidError extends BaseError {
|
|
68
|
+
constructor();
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* This is thrown not authorization exists on the request.
|
|
72
|
+
*/
|
|
73
|
+
export declare class SafeAuthorizationNotExistsError extends BaseError {
|
|
74
|
+
constructor();
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* This is thrown when the bearer token is not found
|
|
78
|
+
*/
|
|
79
|
+
export declare class SafeAuthorizationBearerTokenNotFound extends BaseError {
|
|
80
|
+
constructor();
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* This is thrown when the authorization request headers are not found.
|
|
84
|
+
*/
|
|
85
|
+
export declare class SafeRequestAuthorizationHeadersNotFound extends BaseError {
|
|
86
|
+
constructor();
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* This is thrown when the authorization is not found in the request headers.
|
|
90
|
+
*/
|
|
91
|
+
export declare class SafeRequestAuthorizationHeaderNotFound extends BaseError {
|
|
92
|
+
constructor();
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* This is thrown when the Issuer does not match the expected issuer.
|
|
96
|
+
*/
|
|
97
|
+
export declare class SafeAuthorizationIssuerNotMatchingExpectedError extends BaseError {
|
|
98
|
+
constructor(expectedIssuer: string, actualIssuer: string);
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* This is thrown when the decoded token null or a string (not an object)
|
|
102
|
+
*/
|
|
103
|
+
export declare class SafeAuthorizationTokenNotObjectError extends BaseError {
|
|
104
|
+
constructor();
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=authorization-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorization-errors.d.ts","sourceRoot":"","sources":["../../../src/errors/authorization/authorization-errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,iDAAiD,CAAC;AAC1F,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C;;GAEG;AACH,qBAAa,wCAAyC,SAAQ,SAAS;gBACvD,MAAM,EAAE,MAAM;CAG7B;AAED;;;GAGG;AACH,qBAAa,qDAAsD,SAAQ,SAAS;gBACpE,cAAc,EAAE,uBAAuB;CAGtD;AAED;;GAEG;AACH,qBAAa,qCAAsC,SAAQ,SAAS;gBACpD,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CAGrD;AAED;;GAEG;AACH,qBAAa,6CAA8C,SAAQ,SAAS;gBAC5D,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;CAGpD;AAED;;GAEG;AACH,qBAAa,oCAAqC,SAAQ,SAAS;gBACnD,MAAM,EAAE,MAAM;CAG7B;AAED;;GAEG;AACH,qBAAa,oCAAqC,SAAQ,SAAS;;CAIlE;AAED;;GAEG;AACH,qBAAa,mDAAoD,SAAQ,SAAS;;CAIjF;AAED;;GAEG;AACH,qBAAa,qCAAsC,SAAQ,SAAS;;CAInE;AAED;;GAEG;AACH,qBAAa,mDAAoD,SAAQ,SAAS;gBAClE,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,GAAG,EAAE,gBAAgB,EAAE,MAAM;CAG7E;AAED;;GAEG;AACH,qBAAa,qCAAsC,SAAQ,SAAS;gBACpD,QAAQ,EAAE,MAAM;CAG/B;AAED;;GAEG;AACH,qBAAa,+CAAgD,SAAQ,SAAS;;CAI7E;AAED;;GAEG;AACH,qBAAa,+BAAgC,SAAQ,SAAS;;CAI7D;AAED;;GAEG;AACH,qBAAa,oCAAqC,SAAQ,SAAS;;CAIlE;AAKD;;GAEG;AACH,qBAAa,uCAAwC,SAAQ,SAAS;;CAIrE;AAED;;GAEG;AACH,qBAAa,sCAAuC,SAAQ,SAAS;;CAIpE;AAED;;GAEG;AACH,qBAAa,+CAAgD,SAAQ,SAAS;gBAC9D,cAAc,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM;CAG3D;AAED;;GAEG;AACH,qBAAa,oCAAqC,SAAQ,SAAS;;CAIlE"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SafeAuthorizationTokenNotObjectError = exports.SafeAuthorizationIssuerNotMatchingExpectedError = exports.SafeRequestAuthorizationHeaderNotFound = exports.SafeRequestAuthorizationHeadersNotFound = exports.SafeAuthorizationBearerTokenNotFound = exports.SafeAuthorizationNotExistsError = exports.SafeAuthorizationTokenIssuedAtTimeNotValidError = exports.SafeAuthorizationMissingPropertyError = exports.SafeAuthorizationTokenPropertyDataTypeNotValidError = exports.SafeAuthorizationPayloadNotValidError = exports.SafeAuthorizationKeyNotIncludedForVerificationError = exports.SafeAuthorizationTokenNotBase64Error = exports.SafeAuthorizationIssuerNotValidError = exports.SafeAuthorizationIssuerPublicKeyNotValidError = exports.SafeAuthorizationSubjectNotValidError = exports.SafeAuthorizationAuthorityValidationTypeNotValidError = exports.SafeAuthorizationIssuerDoesNotExistError = void 0;
|
|
4
|
+
const base_error_1 = require("../base-error");
|
|
5
|
+
/**
|
|
6
|
+
* This is thrown when the removal of a IJWTAuthority fails because it does not exist.
|
|
7
|
+
*/
|
|
8
|
+
class SafeAuthorizationIssuerDoesNotExistError extends base_error_1.BaseError {
|
|
9
|
+
constructor(issuer) {
|
|
10
|
+
super(`The authorization issuer ${issuer} does not exist`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.SafeAuthorizationIssuerDoesNotExistError = SafeAuthorizationIssuerDoesNotExistError;
|
|
14
|
+
/**
|
|
15
|
+
* This is thrown when a authority validation request is received the type of validation requested is unknown.
|
|
16
|
+
* (this should not happen).
|
|
17
|
+
*/
|
|
18
|
+
class SafeAuthorizationAuthorityValidationTypeNotValidError extends base_error_1.BaseError {
|
|
19
|
+
constructor(validationType) {
|
|
20
|
+
super(`The authority validation type is not valid, the type is ${validationType}`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.SafeAuthorizationAuthorityValidationTypeNotValidError = SafeAuthorizationAuthorityValidationTypeNotValidError;
|
|
24
|
+
/**
|
|
25
|
+
* This is throw when a database records is not found.
|
|
26
|
+
*/
|
|
27
|
+
class SafeAuthorizationSubjectNotValidError extends base_error_1.BaseError {
|
|
28
|
+
constructor(subjectType, subjectId) {
|
|
29
|
+
super(`The authorization subject ${subjectType} with id ${subjectId} is not valid`);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.SafeAuthorizationSubjectNotValidError = SafeAuthorizationSubjectNotValidError;
|
|
33
|
+
/**
|
|
34
|
+
* This is thrown when the public key given for the issuer is not valid.
|
|
35
|
+
*/
|
|
36
|
+
class SafeAuthorizationIssuerPublicKeyNotValidError extends base_error_1.BaseError {
|
|
37
|
+
constructor(issuerName, publicKey) {
|
|
38
|
+
super(`The authorization issuer ${issuerName} with public key ${publicKey} is not valid`);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.SafeAuthorizationIssuerPublicKeyNotValidError = SafeAuthorizationIssuerPublicKeyNotValidError;
|
|
42
|
+
/**
|
|
43
|
+
* This is thrown when the issuer is not valid.
|
|
44
|
+
*/
|
|
45
|
+
class SafeAuthorizationIssuerNotValidError extends base_error_1.BaseError {
|
|
46
|
+
constructor(issuer) {
|
|
47
|
+
super(`The authorization issuer ${issuer} is not valid`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
exports.SafeAuthorizationIssuerNotValidError = SafeAuthorizationIssuerNotValidError;
|
|
51
|
+
/**
|
|
52
|
+
* This is thrown when the JWT token is not the corrent base64 encoding
|
|
53
|
+
*/
|
|
54
|
+
class SafeAuthorizationTokenNotBase64Error extends base_error_1.BaseError {
|
|
55
|
+
constructor() {
|
|
56
|
+
super('The authorization token is not a valid base64 encoding');
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.SafeAuthorizationTokenNotBase64Error = SafeAuthorizationTokenNotBase64Error;
|
|
60
|
+
/**
|
|
61
|
+
* This is thrown when the secret key or public key is not included for token verification.
|
|
62
|
+
*/
|
|
63
|
+
class SafeAuthorizationKeyNotIncludedForVerificationError extends base_error_1.BaseError {
|
|
64
|
+
constructor() {
|
|
65
|
+
super('The secret of public key is not included for token verification');
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
exports.SafeAuthorizationKeyNotIncludedForVerificationError = SafeAuthorizationKeyNotIncludedForVerificationError;
|
|
69
|
+
/**
|
|
70
|
+
* This is thrown when the authorization payload is not valid.
|
|
71
|
+
*/
|
|
72
|
+
class SafeAuthorizationPayloadNotValidError extends base_error_1.BaseError {
|
|
73
|
+
constructor() {
|
|
74
|
+
super('The authorization payload is not valid');
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
exports.SafeAuthorizationPayloadNotValidError = SafeAuthorizationPayloadNotValidError;
|
|
78
|
+
/**
|
|
79
|
+
* This is thrown when the type of data in a token is not valid
|
|
80
|
+
*/
|
|
81
|
+
class SafeAuthorizationTokenPropertyDataTypeNotValidError extends base_error_1.BaseError {
|
|
82
|
+
constructor(property, propertyValue, expectedDataType) {
|
|
83
|
+
super(`The property ${property} with value ${propertyValue} is not a valid ${expectedDataType}`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
exports.SafeAuthorizationTokenPropertyDataTypeNotValidError = SafeAuthorizationTokenPropertyDataTypeNotValidError;
|
|
87
|
+
/**
|
|
88
|
+
* This is thrown when the authorization payload is missing a property
|
|
89
|
+
*/
|
|
90
|
+
class SafeAuthorizationMissingPropertyError extends base_error_1.BaseError {
|
|
91
|
+
constructor(property) {
|
|
92
|
+
super(`The authorization payload is missing the property ${property}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
exports.SafeAuthorizationMissingPropertyError = SafeAuthorizationMissingPropertyError;
|
|
96
|
+
/**
|
|
97
|
+
* This is thrown when the issued at time is before the current time
|
|
98
|
+
*/
|
|
99
|
+
class SafeAuthorizationTokenIssuedAtTimeNotValidError extends base_error_1.BaseError {
|
|
100
|
+
constructor() {
|
|
101
|
+
super('The issued at time of the token is not valid: ');
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
exports.SafeAuthorizationTokenIssuedAtTimeNotValidError = SafeAuthorizationTokenIssuedAtTimeNotValidError;
|
|
105
|
+
/**
|
|
106
|
+
* This is thrown not authorization exists on the request.
|
|
107
|
+
*/
|
|
108
|
+
class SafeAuthorizationNotExistsError extends base_error_1.BaseError {
|
|
109
|
+
constructor() {
|
|
110
|
+
super('The authorization does not exist');
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
exports.SafeAuthorizationNotExistsError = SafeAuthorizationNotExistsError;
|
|
114
|
+
/**
|
|
115
|
+
* This is thrown when the bearer token is not found
|
|
116
|
+
*/
|
|
117
|
+
class SafeAuthorizationBearerTokenNotFound extends base_error_1.BaseError {
|
|
118
|
+
constructor() {
|
|
119
|
+
super('The bearer token is not found');
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
exports.SafeAuthorizationBearerTokenNotFound = SafeAuthorizationBearerTokenNotFound;
|
|
123
|
+
//#region Safe Request Authorization Errors
|
|
124
|
+
/**
|
|
125
|
+
* This is thrown when the authorization request headers are not found.
|
|
126
|
+
*/
|
|
127
|
+
class SafeRequestAuthorizationHeadersNotFound extends base_error_1.BaseError {
|
|
128
|
+
constructor() {
|
|
129
|
+
super('The authorization request headers are not found');
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
exports.SafeRequestAuthorizationHeadersNotFound = SafeRequestAuthorizationHeadersNotFound;
|
|
133
|
+
/**
|
|
134
|
+
* This is thrown when the authorization is not found in the request headers.
|
|
135
|
+
*/
|
|
136
|
+
class SafeRequestAuthorizationHeaderNotFound extends base_error_1.BaseError {
|
|
137
|
+
constructor() {
|
|
138
|
+
super('The authorization header is not found');
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
exports.SafeRequestAuthorizationHeaderNotFound = SafeRequestAuthorizationHeaderNotFound;
|
|
142
|
+
/**
|
|
143
|
+
* This is thrown when the Issuer does not match the expected issuer.
|
|
144
|
+
*/
|
|
145
|
+
class SafeAuthorizationIssuerNotMatchingExpectedError extends base_error_1.BaseError {
|
|
146
|
+
constructor(expectedIssuer, actualIssuer) {
|
|
147
|
+
super(`The expected issuer ${expectedIssuer} does not match the actual issuer ${actualIssuer}`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
exports.SafeAuthorizationIssuerNotMatchingExpectedError = SafeAuthorizationIssuerNotMatchingExpectedError;
|
|
151
|
+
/**
|
|
152
|
+
* This is thrown when the decoded token null or a string (not an object)
|
|
153
|
+
*/
|
|
154
|
+
class SafeAuthorizationTokenNotObjectError extends base_error_1.BaseError {
|
|
155
|
+
constructor() {
|
|
156
|
+
super('The decoded token is not an object');
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
exports.SafeAuthorizationTokenNotObjectError = SafeAuthorizationTokenNotObjectError;
|
|
160
|
+
//#endregion Safe Request Authorization Errors
|
package/dist/errors/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/errors/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,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;AAG/C,cAAc,cAAc,CAAC"}
|
package/dist/errors/index.js
CHANGED
|
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./audit-log/audit-log-errors"), exports);
|
|
18
|
+
__exportStar(require("./authorization/authorization-errors"), exports);
|
|
18
19
|
__exportStar(require("./database/database-errors"), exports);
|
|
19
20
|
__exportStar(require("./generic/generic-errors"), exports);
|
|
20
21
|
__exportStar(require("./request/request-errors"), exports);
|
|
@@ -27,4 +27,76 @@ export declare class SafeRuleEvaluationSpecialConditionPatternError extends Base
|
|
|
27
27
|
*/
|
|
28
28
|
constructor(dataValue: unknown, conditionValue: unknown);
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* This error is thrown when a rule set has no rule groups
|
|
32
|
+
*/
|
|
33
|
+
export declare class SafeRuleRuleSetNoRuleGroupsError extends BaseError {
|
|
34
|
+
/**
|
|
35
|
+
* This error is thrown when a rule set has no rule groups
|
|
36
|
+
*/
|
|
37
|
+
constructor(name: string, description?: string);
|
|
38
|
+
}
|
|
39
|
+
export declare class SafeRuleConditionNotTypeOfError extends BaseError {
|
|
40
|
+
constructor(conditionType: ConditionType, expectedType: string);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* This error is thrown when a rule condition is not an object
|
|
44
|
+
*/
|
|
45
|
+
export declare class SafeRuleConditionNotObjectError extends BaseError {
|
|
46
|
+
constructor(incomingObject: unknown);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* This error is thrown when a rule condition is missing or has an extra property
|
|
50
|
+
*/
|
|
51
|
+
export declare class SafeRuleConditionHasMismatchingProperties extends BaseError {
|
|
52
|
+
constructor(incomingObject: unknown, expectedPropertyCount: number, actualPropertyCount: number);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* This error is thrown when the safe condition qualifier is not valid
|
|
56
|
+
*/
|
|
57
|
+
export declare class SafeRuleConditionQualifierError extends BaseError {
|
|
58
|
+
constructor(conditionQualifier: unknown);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* This error is thrown when a rule condition property is missing
|
|
62
|
+
*/
|
|
63
|
+
export declare class SafeRuleConditionPropertyMissingError extends BaseError {
|
|
64
|
+
constructor(missingProperty: string);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* This error is thrown when a rule condition value is not valid
|
|
68
|
+
*/
|
|
69
|
+
export declare class SafeRuleConditionValueWrongType extends BaseError {
|
|
70
|
+
constructor(conditionValue: unknown, expectedType: string);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* This error is thrown when a rule condition type is not valid
|
|
74
|
+
*/
|
|
75
|
+
export declare class SafeRuleConditionTypeNotValidError extends BaseError {
|
|
76
|
+
constructor(conditionType: unknown);
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* This error is thrown when a safe rule is not an object
|
|
80
|
+
*/
|
|
81
|
+
export declare class SafeRuleNotObjectError extends BaseError {
|
|
82
|
+
constructor(incomingObject: unknown);
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* This error is thrown when a safe rule is missing or has an extra property
|
|
86
|
+
*/
|
|
87
|
+
export declare class SafeRuleHasMismatchingProperties extends BaseError {
|
|
88
|
+
constructor(incomingObject: unknown, expectedPropertyCount: number, actualPropertyCount: number);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* This error is thrown when a safe rule is missing property
|
|
92
|
+
*/
|
|
93
|
+
export declare class SafeRuleHasMissingProperty extends BaseError {
|
|
94
|
+
constructor(incomingObject: unknown, expectedProperty: string);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* This error is thrown when a safe rule property is not valid
|
|
98
|
+
*/
|
|
99
|
+
export declare class SafeRulePropertyValueWrongType extends BaseError {
|
|
100
|
+
constructor(propertyName: string, propertyValue: unknown, expectedType: string);
|
|
101
|
+
}
|
|
30
102
|
//# sourceMappingURL=safe-rules-errors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safe-rules-errors.d.ts","sourceRoot":"","sources":["../../../src/errors/safe/safe-rules-errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C;;GAEG;AACH,qBAAa,yCAA0C,SAAQ,SAAS;IACpE;;OAEG;gBACS,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa;CAGxF;AAED;;GAEG;AACH,qBAAa,qCAAsC,SAAQ,SAAS;IAChE;;OAEG;gBACS,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa;CAGxF;AAED;;GAEG;AACH,qBAAa,8CAA+C,SAAQ,SAAS;IACzE;;OAEG;gBACS,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO;CAG1D"}
|
|
1
|
+
{"version":3,"file":"safe-rules-errors.d.ts","sourceRoot":"","sources":["../../../src/errors/safe/safe-rules-errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C;;GAEG;AACH,qBAAa,yCAA0C,SAAQ,SAAS;IACpE;;OAEG;gBACS,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa;CAGxF;AAED;;GAEG;AACH,qBAAa,qCAAsC,SAAQ,SAAS;IAChE;;OAEG;gBACS,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa;CAGxF;AAED;;GAEG;AACH,qBAAa,8CAA+C,SAAQ,SAAS;IACzE;;OAEG;gBACS,SAAS,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO;CAG1D;AAED;;GAEG;AACH,qBAAa,gCAAiC,SAAQ,SAAS;IAC3D;;OAEG;gBACS,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM;CAGjD;AAKD,qBAAa,+BAAgC,SAAQ,SAAS;gBAC9C,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM;CAGjE;AAGD;;GAEG;AACH,qBAAa,+BAAgC,SAAQ,SAAS;gBAC9C,cAAc,EAAE,OAAO;CAGtC;AAED;;GAEG;AACH,qBAAa,yCAA0C,SAAQ,SAAS;gBACxD,cAAc,EAAE,OAAO,EAAE,qBAAqB,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM;CAGlG;AAED;;GAEG;AACH,qBAAa,+BAAgC,SAAQ,SAAS;gBAC9C,kBAAkB,EAAE,OAAO;CAG1C;AAGD;;GAEG;AACH,qBAAa,qCAAsC,SAAQ,SAAS;gBACpD,eAAe,EAAE,MAAM;CAGtC;AAED;;GAEG;AACH,qBAAa,+BAAgC,SAAQ,SAAS;gBAC9C,cAAc,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM;CAG5D;AAED;;GAEG;AACH,qBAAa,kCAAmC,SAAQ,SAAS;gBACjD,aAAa,EAAE,OAAO;CAGrC;AAMD;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,SAAS;gBACrC,cAAc,EAAE,OAAO;CAGtC;AAED;;GAEG;AACH,qBAAa,gCAAiC,SAAQ,SAAS;gBAC/C,cAAc,EAAE,OAAO,EAAE,qBAAqB,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM;CAGlG;AAED;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,SAAS;gBACzC,cAAc,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM;CAGhE;AAED;;GAEG;AACH,qBAAa,8BAA+B,SAAQ,SAAS;gBAC7C,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM;CAGjF"}
|