@degenerate/endpoints 0.0.5 → 0.0.7
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/cors/authority/audience/get-set-audiences.d.ts.map +1 -0
- package/dist/cors/authority/jwt/validate-jwt-authorities.d.ts.map +1 -0
- package/dist/{endpoints/src/cors → cors}/authority/jwt/validate-jwt-authorities.js +2 -3
- package/dist/cors/endpoints/authorities/validate-authorities-transaction.d.ts.map +1 -0
- package/dist/cors/endpoints/helpers/validate-request-body.d.ts.map +1 -0
- package/dist/cors/errors/all-error-handler.d.ts.map +1 -0
- package/dist/cors/errors/bad-request-handler.d.ts.map +1 -0
- package/dist/cors/errors/unauthorized-handler.d.ts.map +1 -0
- package/dist/cors/index.d.ts.map +1 -0
- package/dist/cors/routes/authorities.routes.d.ts.map +1 -0
- package/dist/{endpoints/src/cors → cors}/routes/authorities.routes.js +2 -2
- package/dist/cors/routes/events.routes.d.ts.map +1 -0
- package/dist/cors/routes/functions.routes.d.ts.map +1 -0
- package/dist/cors/routes/rules.routes.d.ts.map +1 -0
- package/dist/cors/routes/share-data.routes.d.ts.map +1 -0
- package/dist/examples/express-server/app.d.ts.map +1 -0
- package/dist/{endpoints/src/examples → examples}/express-server/app.js +2 -2
- package/dist/examples/express-server/server.d.ts.map +1 -0
- package/dist/{endpoints/src/index.d.ts.map → index.d.ts.map} +1 -1
- package/package.json +2 -2
- package/dist/endpoints/src/cors/authority/audience/get-set-audiences.d.ts.map +0 -1
- package/dist/endpoints/src/cors/authority/jwt/validate-jwt-authorities.d.ts.map +0 -1
- package/dist/endpoints/src/cors/endpoints/authorities/validate-authorities-transaction.d.ts.map +0 -1
- package/dist/endpoints/src/cors/endpoints/helpers/validate-request-body.d.ts.map +0 -1
- package/dist/endpoints/src/cors/errors/all-error-handler.d.ts.map +0 -1
- package/dist/endpoints/src/cors/errors/bad-request-handler.d.ts.map +0 -1
- package/dist/endpoints/src/cors/errors/unauthorized-handler.d.ts.map +0 -1
- package/dist/endpoints/src/cors/index.d.ts.map +0 -1
- package/dist/endpoints/src/cors/routes/authorities.routes.d.ts.map +0 -1
- package/dist/endpoints/src/cors/routes/events.routes.d.ts.map +0 -1
- package/dist/endpoints/src/cors/routes/functions.routes.d.ts.map +0 -1
- package/dist/endpoints/src/cors/routes/rules.routes.d.ts.map +0 -1
- package/dist/endpoints/src/cors/routes/share-data.routes.d.ts.map +0 -1
- package/dist/endpoints/src/examples/express-server/app.d.ts.map +0 -1
- package/dist/endpoints/src/examples/express-server/server.d.ts.map +0 -1
- package/dist/generic/src/_settings/authorization-settings.d.ts +0 -17
- package/dist/generic/src/_settings/authorization-settings.d.ts.map +0 -1
- package/dist/generic/src/_settings/authorization-settings.js +0 -20
- package/dist/generic/src/authorization/index.d.ts +0 -24
- package/dist/generic/src/authorization/index.d.ts.map +0 -1
- package/dist/generic/src/authorization/index.js +0 -61
- package/dist/generic/src/authorization/jwt/keys/create-public-key-pem.d.ts +0 -9
- package/dist/generic/src/authorization/jwt/keys/create-public-key-pem.d.ts.map +0 -1
- package/dist/generic/src/authorization/jwt/keys/create-public-key-pem.js +0 -25
- package/dist/generic/src/authorization/jwt/keys/create-secret-key-pem.d.ts +0 -9
- package/dist/generic/src/authorization/jwt/keys/create-secret-key-pem.d.ts.map +0 -1
- package/dist/generic/src/authorization/jwt/keys/create-secret-key-pem.js +0 -24
- package/dist/generic/src/authorization/jwt/sign/create-authorization-issuer.d.ts +0 -10
- package/dist/generic/src/authorization/jwt/sign/create-authorization-issuer.d.ts.map +0 -1
- package/dist/generic/src/authorization/jwt/sign/create-authorization-issuer.js +0 -26
- package/dist/generic/src/authorization/jwt/sign/create-authorization-subject.d.ts +0 -12
- package/dist/generic/src/authorization/jwt/sign/create-authorization-subject.d.ts.map +0 -1
- package/dist/generic/src/authorization/jwt/sign/create-authorization-subject.js +0 -19
- package/dist/generic/src/authorization/jwt/sign/create-jwt-options.d.ts +0 -17
- package/dist/generic/src/authorization/jwt/sign/create-jwt-options.d.ts.map +0 -1
- package/dist/generic/src/authorization/jwt/sign/create-jwt-options.js +0 -43
- package/dist/generic/src/authorization/jwt/sign/create-jwt-signed-token.d.ts +0 -13
- package/dist/generic/src/authorization/jwt/sign/create-jwt-signed-token.d.ts.map +0 -1
- package/dist/generic/src/authorization/jwt/sign/create-jwt-signed-token.js +0 -22
- package/dist/generic/src/authorization/jwt/transform/transform-token-payload-to-safe-payload.d.ts +0 -10
- package/dist/generic/src/authorization/jwt/transform/transform-token-payload-to-safe-payload.d.ts.map +0 -1
- package/dist/generic/src/authorization/jwt/transform/transform-token-payload-to-safe-payload.js +0 -31
- package/dist/generic/src/authorization/jwt/verify/get-decoded-jwt-header.d.ts +0 -10
- package/dist/generic/src/authorization/jwt/verify/get-decoded-jwt-header.d.ts.map +0 -1
- package/dist/generic/src/authorization/jwt/verify/get-decoded-jwt-header.js +0 -20
- package/dist/generic/src/authorization/jwt/verify/get-decoded-jwt-signed-token-payload.d.ts +0 -9
- package/dist/generic/src/authorization/jwt/verify/get-decoded-jwt-signed-token-payload.d.ts.map +0 -1
- package/dist/generic/src/authorization/jwt/verify/get-decoded-jwt-signed-token-payload.js +0 -17
- package/dist/generic/src/authorization/jwt/verify/verify-jwt-signed-token.d.ts +0 -12
- package/dist/generic/src/authorization/jwt/verify/verify-jwt-signed-token.d.ts.map +0 -1
- package/dist/generic/src/authorization/jwt/verify/verify-jwt-signed-token.js +0 -34
- package/dist/generic/src/authorization/safe/authorization/authorized-authorities.d.ts +0 -42
- package/dist/generic/src/authorization/safe/authorization/authorized-authorities.d.ts.map +0 -1
- package/dist/generic/src/authorization/safe/authorization/authorized-authorities.js +0 -65
- package/dist/generic/src/authorization/safe/request/decode-bearer-token.d.ts +0 -11
- package/dist/generic/src/authorization/safe/request/decode-bearer-token.d.ts.map +0 -1
- package/dist/generic/src/authorization/safe/request/decode-bearer-token.js +0 -31
- package/dist/generic/src/authorization/safe/request/decode-safe-request.d.ts +0 -11
- package/dist/generic/src/authorization/safe/request/decode-safe-request.d.ts.map +0 -1
- package/dist/generic/src/authorization/safe/request/decode-safe-request.js +0 -30
- package/dist/generic/src/authorization/safe/request/determine-issuer-from-request.d.ts +0 -10
- package/dist/generic/src/authorization/safe/request/determine-issuer-from-request.d.ts.map +0 -1
- package/dist/generic/src/authorization/safe/request/determine-issuer-from-request.js +0 -29
- package/dist/generic/src/authorization/safe/request/issuer/determine-issuer-from-bearer-token.d.ts +0 -12
- package/dist/generic/src/authorization/safe/request/issuer/determine-issuer-from-bearer-token.d.ts.map +0 -1
- package/dist/generic/src/authorization/safe/request/issuer/determine-issuer-from-bearer-token.js +0 -30
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-audience.d.ts +0 -10
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-audience.d.ts.map +0 -1
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-audience.js +0 -24
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-expiration-time.d.ts +0 -8
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-expiration-time.d.ts.map +0 -1
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-expiration-time.js +0 -23
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-issued-at-time.d.ts +0 -9
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-issued-at-time.d.ts.map +0 -1
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-issued-at-time.js +0 -24
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-issuer.d.ts +0 -10
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-issuer.d.ts.map +0 -1
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-issuer.js +0 -25
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-not-before-time.d.ts +0 -8
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-not-before-time.d.ts.map +0 -1
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-not-before-time.js +0 -23
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-subject.d.ts +0 -10
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-subject.d.ts.map +0 -1
- package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-subject.js +0 -22
- package/dist/generic/src/authorization/safe/validation/jwt/verify-token-header.d.ts +0 -9
- package/dist/generic/src/authorization/safe/validation/jwt/verify-token-header.d.ts.map +0 -1
- package/dist/generic/src/authorization/safe/validation/jwt/verify-token-header.js +0 -25
- package/dist/generic/src/authorization/safe/validation/jwt/verify-token-payload.d.ts +0 -11
- package/dist/generic/src/authorization/safe/validation/jwt/verify-token-payload.d.ts.map +0 -1
- package/dist/generic/src/authorization/safe/validation/jwt/verify-token-payload.js +0 -30
- package/dist/generic/src/errors/audit-log/audit-log-errors.d.ts +0 -20
- package/dist/generic/src/errors/audit-log/audit-log-errors.d.ts.map +0 -1
- package/dist/generic/src/errors/audit-log/audit-log-errors.js +0 -31
- package/dist/generic/src/errors/authorization/authorization-errors.d.ts +0 -106
- package/dist/generic/src/errors/authorization/authorization-errors.d.ts.map +0 -1
- package/dist/generic/src/errors/authorization/authorization-errors.js +0 -160
- package/dist/generic/src/errors/base-error.d.ts +0 -23
- package/dist/generic/src/errors/base-error.d.ts.map +0 -1
- package/dist/generic/src/errors/base-error.js +0 -34
- package/dist/generic/src/errors/database/database-errors.d.ts +0 -24
- package/dist/generic/src/errors/database/database-errors.d.ts.map +0 -1
- package/dist/generic/src/errors/database/database-errors.js +0 -33
- package/dist/generic/src/errors/generic/generic-errors.d.ts +0 -35
- package/dist/generic/src/errors/generic/generic-errors.d.ts.map +0 -1
- package/dist/generic/src/errors/generic/generic-errors.js +0 -47
- package/dist/generic/src/errors/index.d.ts +0 -10
- package/dist/generic/src/errors/index.d.ts.map +0 -1
- package/dist/generic/src/errors/index.js +0 -26
- package/dist/generic/src/errors/request/request-errors.d.ts +0 -98
- package/dist/generic/src/errors/request/request-errors.d.ts.map +0 -1
- package/dist/generic/src/errors/request/request-errors.js +0 -134
- package/dist/generic/src/errors/safe/safe-rules-errors.d.ts +0 -102
- package/dist/generic/src/errors/safe/safe-rules-errors.d.ts.map +0 -1
- package/dist/generic/src/errors/safe/safe-rules-errors.js +0 -152
- package/dist/generic/src/errors/scheduler/scheduler-errors.d.ts +0 -8
- package/dist/generic/src/errors/scheduler/scheduler-errors.d.ts.map +0 -1
- package/dist/generic/src/errors/scheduler/scheduler-errors.js +0 -14
- package/dist/generic/src/errors/share-data/share-data-errors.d.ts +0 -67
- package/dist/generic/src/errors/share-data/share-data-errors.d.ts.map +0 -1
- package/dist/generic/src/errors/share-data/share-data-errors.js +0 -92
- package/dist/generic/src/helpers/crypto/cryptography-helpers.d.ts +0 -37
- package/dist/generic/src/helpers/crypto/cryptography-helpers.d.ts.map +0 -1
- package/dist/generic/src/helpers/crypto/cryptography-helpers.js +0 -65
- package/dist/generic/src/helpers/object-validation-helpers.d.ts +0 -66
- package/dist/generic/src/helpers/object-validation-helpers.d.ts.map +0 -1
- package/dist/generic/src/helpers/object-validation-helpers.js +0 -254
- package/dist/generic/src/models/application/audit-log/application-audit-log-models.d.ts +0 -87
- package/dist/generic/src/models/application/audit-log/application-audit-log-models.d.ts.map +0 -1
- package/dist/generic/src/models/application/audit-log/application-audit-log-models.js +0 -59
- package/dist/generic/src/models/application/database/firestore-models.d.ts +0 -84
- package/dist/generic/src/models/application/database/firestore-models.d.ts.map +0 -1
- package/dist/generic/src/models/application/database/firestore-models.js +0 -4
- package/dist/generic/src/models/authorization/authorization-models.d.ts +0 -81
- package/dist/generic/src/models/authorization/authorization-models.d.ts.map +0 -1
- package/dist/generic/src/models/authorization/authorization-models.js +0 -33
- package/dist/generic/src/models/crypto/crypto-models.d.ts +0 -5
- package/dist/generic/src/models/crypto/crypto-models.d.ts.map +0 -1
- package/dist/generic/src/models/crypto/crypto-models.js +0 -3
- package/dist/generic/src/models/data/data-models.d.ts +0 -24
- package/dist/generic/src/models/data/data-models.d.ts.map +0 -1
- package/dist/generic/src/models/data/data-models.js +0 -3
- package/dist/generic/src/models/dynamic-execution/dynamic-execution-models.d.ts +0 -9
- package/dist/generic/src/models/dynamic-execution/dynamic-execution-models.d.ts.map +0 -1
- package/dist/generic/src/models/dynamic-execution/dynamic-execution-models.js +0 -2
- package/dist/generic/src/models/events/share-event-models.d.ts +0 -65
- package/dist/generic/src/models/events/share-event-models.d.ts.map +0 -1
- package/dist/generic/src/models/events/share-event-models.js +0 -70
- package/dist/generic/src/models/functions/share-data-function-models.d.ts +0 -86
- package/dist/generic/src/models/functions/share-data-function-models.d.ts.map +0 -1
- package/dist/generic/src/models/functions/share-data-function-models.js +0 -17
- package/dist/generic/src/models/generic/request-response-models.d.ts +0 -8
- package/dist/generic/src/models/generic/request-response-models.d.ts.map +0 -1
- package/dist/generic/src/models/generic/request-response-models.js +0 -2
- package/dist/generic/src/models/index.d.ts +0 -13
- package/dist/generic/src/models/index.d.ts.map +0 -1
- package/dist/generic/src/models/index.js +0 -29
- package/dist/generic/src/models/rules/share-rule-models.d.ts +0 -303
- package/dist/generic/src/models/rules/share-rule-models.d.ts.map +0 -1
- package/dist/generic/src/models/rules/share-rule-models.js +0 -93
- package/dist/generic/src/models/safe/safe-transaction-models.d.ts +0 -81
- package/dist/generic/src/models/safe/safe-transaction-models.d.ts.map +0 -1
- package/dist/generic/src/models/safe/safe-transaction-models.js +0 -26
- package/dist/generic/src/models/share-data/share-data.d.ts +0 -56
- package/dist/generic/src/models/share-data/share-data.d.ts.map +0 -1
- package/dist/generic/src/models/share-data/share-data.js +0 -20
- /package/dist/{endpoints/src/cors → cors}/authority/audience/get-set-audiences.d.ts +0 -0
- /package/dist/{endpoints/src/cors → cors}/authority/audience/get-set-audiences.js +0 -0
- /package/dist/{endpoints/src/cors → cors}/authority/jwt/validate-jwt-authorities.d.ts +0 -0
- /package/dist/{endpoints/src/cors → cors}/endpoints/authorities/validate-authorities-transaction.d.ts +0 -0
- /package/dist/{endpoints/src/cors → cors}/endpoints/authorities/validate-authorities-transaction.js +0 -0
- /package/dist/{endpoints/src/cors → cors}/endpoints/helpers/validate-request-body.d.ts +0 -0
- /package/dist/{endpoints/src/cors → cors}/endpoints/helpers/validate-request-body.js +0 -0
- /package/dist/{endpoints/src/cors → cors}/errors/all-error-handler.d.ts +0 -0
- /package/dist/{endpoints/src/cors → cors}/errors/all-error-handler.js +0 -0
- /package/dist/{endpoints/src/cors → cors}/errors/bad-request-handler.d.ts +0 -0
- /package/dist/{endpoints/src/cors → cors}/errors/bad-request-handler.js +0 -0
- /package/dist/{endpoints/src/cors → cors}/errors/unauthorized-handler.d.ts +0 -0
- /package/dist/{endpoints/src/cors → cors}/errors/unauthorized-handler.js +0 -0
- /package/dist/{endpoints/src/cors → cors}/index.d.ts +0 -0
- /package/dist/{endpoints/src/cors → cors}/index.js +0 -0
- /package/dist/{endpoints/src/cors → cors}/routes/authorities.routes.d.ts +0 -0
- /package/dist/{endpoints/src/cors → cors}/routes/events.routes.d.ts +0 -0
- /package/dist/{endpoints/src/cors → cors}/routes/events.routes.js +0 -0
- /package/dist/{endpoints/src/cors → cors}/routes/functions.routes.d.ts +0 -0
- /package/dist/{endpoints/src/cors → cors}/routes/functions.routes.js +0 -0
- /package/dist/{endpoints/src/cors → cors}/routes/rules.routes.d.ts +0 -0
- /package/dist/{endpoints/src/cors → cors}/routes/rules.routes.js +0 -0
- /package/dist/{endpoints/src/cors → cors}/routes/share-data.routes.d.ts +0 -0
- /package/dist/{endpoints/src/cors → cors}/routes/share-data.routes.js +0 -0
- /package/dist/{endpoints/src/examples → examples}/express-server/app.d.ts +0 -0
- /package/dist/{endpoints/src/examples → examples}/express-server/server.d.ts +0 -0
- /package/dist/{endpoints/src/examples → examples}/express-server/server.js +0 -0
- /package/dist/{endpoints/src/index.d.ts → index.d.ts} +0 -0
- /package/dist/{endpoints/src/index.js → index.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"verify-authorization-issuer.d.ts","sourceRoot":"","sources":["../../../../../../../../../generic/src/authorization/safe/validation/jwt/payload/verify-authorization-issuer.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,oBAAoB,EAAE,MAAM,0DAA0D,CAAC;AAEhG;;;;;GAKG;AACH,QAAA,MAAM,yBAAyB,QAAS,OAAO,KAAG,GAAG,IAAI,oBAexD,CAAC;AAEF,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
|
package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-issuer.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.verifyAuthorizationIssuer = void 0;
|
|
4
|
-
const authorization_errors_1 = require("../../../../../errors/authorization/authorization-errors");
|
|
5
|
-
/**
|
|
6
|
-
* This function verifies that the incoming object is a valid authorization issuer.
|
|
7
|
-
*
|
|
8
|
-
* @param iss the object to verify
|
|
9
|
-
* @returns
|
|
10
|
-
*/
|
|
11
|
-
const verifyAuthorizationIssuer = (iss) => {
|
|
12
|
-
if (!iss) {
|
|
13
|
-
throw new authorization_errors_1.SafeAuthorizationMissingPropertyError('iss');
|
|
14
|
-
}
|
|
15
|
-
if (typeof iss !== 'string') {
|
|
16
|
-
throw new authorization_errors_1.SafeAuthorizationTokenPropertyDataTypeNotValidError('iss', iss, 'string');
|
|
17
|
-
}
|
|
18
|
-
const regex = /^[a-zA-Z0-9]+-[0-9a-fA-F]{8}$/; // make sure the incoming object is in the format of the authorization issuer
|
|
19
|
-
const isValidShape = regex.test(iss); // check if the incoming object is in the correct format
|
|
20
|
-
if (!isValidShape) { // if the incoming object is not in the correct format
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
return true;
|
|
24
|
-
};
|
|
25
|
-
exports.verifyAuthorizationIssuer = verifyAuthorizationIssuer;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This function verifies that the not before time is valid.
|
|
3
|
-
*
|
|
4
|
-
* @param nbf the not before time is the time before which the token is not valid
|
|
5
|
-
*/
|
|
6
|
-
declare const verifyAuthorizationNotBeforeTime: (nbf: unknown) => nbf is number;
|
|
7
|
-
export { verifyAuthorizationNotBeforeTime };
|
|
8
|
-
//# sourceMappingURL=verify-authorization-not-before-time.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"verify-authorization-not-before-time.d.ts","sourceRoot":"","sources":["../../../../../../../../../generic/src/authorization/safe/validation/jwt/payload/verify-authorization-not-before-time.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,QAAA,MAAM,gCAAgC,QAAS,OAAO,KAAG,GAAG,IAAI,MAc/D,CAAC;AAEF,OAAO,EAAE,gCAAgC,EAAE,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.verifyAuthorizationNotBeforeTime = void 0;
|
|
4
|
-
const authorization_errors_1 = require("../../../../../errors/authorization/authorization-errors");
|
|
5
|
-
/**
|
|
6
|
-
* This function verifies that the not before time is valid.
|
|
7
|
-
*
|
|
8
|
-
* @param nbf the not before time is the time before which the token is not valid
|
|
9
|
-
*/
|
|
10
|
-
const verifyAuthorizationNotBeforeTime = (nbf) => {
|
|
11
|
-
if (!nbf) {
|
|
12
|
-
throw new authorization_errors_1.SafeAuthorizationMissingPropertyError('nbf');
|
|
13
|
-
}
|
|
14
|
-
if (typeof nbf !== 'number') {
|
|
15
|
-
throw new authorization_errors_1.SafeAuthorizationTokenPropertyDataTypeNotValidError('nbf', nbf, 'number');
|
|
16
|
-
}
|
|
17
|
-
const currentTime = new Date().getTime() / 1000; // get the current time in unix format
|
|
18
|
-
if (nbf > currentTime) {
|
|
19
|
-
throw new authorization_errors_1.SafeAuthorizationPayloadNotValidError();
|
|
20
|
-
}
|
|
21
|
-
return true;
|
|
22
|
-
};
|
|
23
|
-
exports.verifyAuthorizationNotBeforeTime = verifyAuthorizationNotBeforeTime;
|
package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-subject.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { IAuthorizationSubject } from '../../../../../models/authorization/authorization-models';
|
|
2
|
-
/**
|
|
3
|
-
* This function validates that the input string is a valid authorization subject.
|
|
4
|
-
*
|
|
5
|
-
* @param sub The input string to validate.
|
|
6
|
-
* @returns True if the input is a valid authorization subject, false otherwise.
|
|
7
|
-
*/
|
|
8
|
-
declare const verifyAuthorizationSubject: (sub: unknown) => sub is IAuthorizationSubject;
|
|
9
|
-
export { verifyAuthorizationSubject };
|
|
10
|
-
//# sourceMappingURL=verify-authorization-subject.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"verify-authorization-subject.d.ts","sourceRoot":"","sources":["../../../../../../../../../generic/src/authorization/safe/validation/jwt/payload/verify-authorization-subject.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,qBAAqB,EAExB,MAAM,0DAA0D,CAAC;AAElE;;;;;GAKG;AACH,QAAA,MAAM,0BAA0B,QAAS,OAAO,KAAG,GAAG,IAAI,qBASzD,CAAC;AAEF,OAAO,EAAE,0BAA0B,EAAE,CAAC"}
|
package/dist/generic/src/authorization/safe/validation/jwt/payload/verify-authorization-subject.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.verifyAuthorizationSubject = void 0;
|
|
4
|
-
const authorization_errors_1 = require("../../../../../errors/authorization/authorization-errors");
|
|
5
|
-
const authorization_models_1 = require("../../../../../models/authorization/authorization-models");
|
|
6
|
-
/**
|
|
7
|
-
* This function validates that the input string is a valid authorization subject.
|
|
8
|
-
*
|
|
9
|
-
* @param sub The input string to validate.
|
|
10
|
-
* @returns True if the input is a valid authorization subject, false otherwise.
|
|
11
|
-
*/
|
|
12
|
-
const verifyAuthorizationSubject = (sub) => {
|
|
13
|
-
if (!sub) {
|
|
14
|
-
throw new authorization_errors_1.SafeAuthorizationMissingPropertyError('sub');
|
|
15
|
-
}
|
|
16
|
-
if (typeof sub !== 'string') {
|
|
17
|
-
throw new authorization_errors_1.SafeAuthorizationTokenPropertyDataTypeNotValidError('sub', sub, 'string');
|
|
18
|
-
}
|
|
19
|
-
const regex = new RegExp(`^(${Object.values(authorization_models_1.AuthorizationSubjectStart).join('|')}):.+$`);
|
|
20
|
-
return regex.test(sub);
|
|
21
|
-
};
|
|
22
|
-
exports.verifyAuthorizationSubject = verifyAuthorizationSubject;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This validates that the header encoding is the expected encoding for the token
|
|
3
|
-
*
|
|
4
|
-
* @param token the token to validate the header of.
|
|
5
|
-
* @returns
|
|
6
|
-
*/
|
|
7
|
-
declare const verifyTokenHeader: (token: string) => boolean;
|
|
8
|
-
export { verifyTokenHeader };
|
|
9
|
-
//# sourceMappingURL=verify-token-header.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"verify-token-header.d.ts","sourceRoot":"","sources":["../../../../../../../../generic/src/authorization/safe/validation/jwt/verify-token-header.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,QAAA,MAAM,iBAAiB,UAAW,MAAM,KAAG,OAc1C,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
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;
|
|
@@ -1,11 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"verify-token-payload.d.ts","sourceRoot":"","sources":["../../../../../../../../generic/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"}
|
|
@@ -1,30 +0,0 @@
|
|
|
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;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { BaseError } from '../base-error';
|
|
2
|
-
/**
|
|
3
|
-
* This is throw when the Audit Log Additional Id's reference id is not provided.
|
|
4
|
-
*/
|
|
5
|
-
export declare class AuditLogAlaiIdNotProvidedError extends BaseError {
|
|
6
|
-
/**
|
|
7
|
-
* This is throw when the Additional Log Additional Id's reference id is not provided.
|
|
8
|
-
*/
|
|
9
|
-
constructor();
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* This is throw when the Audit Log Additional Id's query is not provided.
|
|
13
|
-
*/
|
|
14
|
-
export declare class AuditLogAlaiQueryNotProvidedError extends BaseError {
|
|
15
|
-
/**
|
|
16
|
-
* This is throw when the Audit Log Additional Id's query is not provided.
|
|
17
|
-
*/
|
|
18
|
-
constructor();
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=audit-log-errors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"audit-log-errors.d.ts","sourceRoot":"","sources":["../../../../../../generic/src/errors/audit-log/audit-log-errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAI1C;;GAEG;AACH,qBAAa,8BAA+B,SAAQ,SAAS;IACzD;;OAEG;;CAIN;AAED;;GAEG;AACH,qBAAa,iCAAkC,SAAQ,SAAS;IAC5D;;OAEG;;CAIN"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AuditLogAlaiQueryNotProvidedError = exports.AuditLogAlaiIdNotProvidedError = void 0;
|
|
4
|
-
// This file contains the errors for that can occur in the audit log.
|
|
5
|
-
const base_error_1 = require("../base-error");
|
|
6
|
-
//#region Audit Log Additional Id's Errors
|
|
7
|
-
/**
|
|
8
|
-
* This is throw when the Audit Log Additional Id's reference id is not provided.
|
|
9
|
-
*/
|
|
10
|
-
class AuditLogAlaiIdNotProvidedError extends base_error_1.BaseError {
|
|
11
|
-
/**
|
|
12
|
-
* This is throw when the Additional Log Additional Id's reference id is not provided.
|
|
13
|
-
*/
|
|
14
|
-
constructor() {
|
|
15
|
-
super('Audit Log Additional Id\'s reference id is not provided');
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.AuditLogAlaiIdNotProvidedError = AuditLogAlaiIdNotProvidedError;
|
|
19
|
-
/**
|
|
20
|
-
* This is throw when the Audit Log Additional Id's query is not provided.
|
|
21
|
-
*/
|
|
22
|
-
class AuditLogAlaiQueryNotProvidedError extends base_error_1.BaseError {
|
|
23
|
-
/**
|
|
24
|
-
* This is throw when the Audit Log Additional Id's query is not provided.
|
|
25
|
-
*/
|
|
26
|
-
constructor() {
|
|
27
|
-
super('Audit Log Additional Id\'s query is not provided');
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
exports.AuditLogAlaiQueryNotProvidedError = AuditLogAlaiQueryNotProvidedError;
|
|
31
|
-
//#endregion Audit Log Additional Id's Errors
|
|
@@ -1,106 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authorization-errors.d.ts","sourceRoot":"","sources":["../../../../../../generic/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"}
|
|
@@ -1,160 +0,0 @@
|
|
|
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
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is the base error class that all other errors should extend from.
|
|
3
|
-
*/
|
|
4
|
-
export declare class BaseError extends Error {
|
|
5
|
-
errorCode?: number;
|
|
6
|
-
/**
|
|
7
|
-
* This is the base error type for the application.
|
|
8
|
-
*
|
|
9
|
-
* @param message the message to include.
|
|
10
|
-
* @param errorCode the error code if we want to include one.
|
|
11
|
-
*/
|
|
12
|
-
constructor(message: string, errorCode?: number);
|
|
13
|
-
/**
|
|
14
|
-
* This function returns the error as a JSON object.
|
|
15
|
-
*/
|
|
16
|
-
toJSON(): {
|
|
17
|
-
message: string;
|
|
18
|
-
errorType: string;
|
|
19
|
-
errorCode: number | undefined;
|
|
20
|
-
stack: string | undefined;
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=base-error.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"base-error.d.ts","sourceRoot":"","sources":["../../../../../generic/src/errors/base-error.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,SAAU,SAAQ,KAAK;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IAE1B;;;;;OAKG;gBACS,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;IAU/C;;OAEG;IACI,MAAM;;;;;;CAQhB"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseError = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* This is the base error class that all other errors should extend from.
|
|
6
|
-
*/
|
|
7
|
-
class BaseError extends Error {
|
|
8
|
-
/**
|
|
9
|
-
* This is the base error type for the application.
|
|
10
|
-
*
|
|
11
|
-
* @param message the message to include.
|
|
12
|
-
* @param errorCode the error code if we want to include one.
|
|
13
|
-
*/
|
|
14
|
-
constructor(message, errorCode) {
|
|
15
|
-
super(message); // Pass the message to the Error constructor
|
|
16
|
-
this.name = this.constructor.name; // Set the name of the error
|
|
17
|
-
this.errorCode = errorCode; // Set the error code
|
|
18
|
-
// This line is needed to restore the correct prototype chain.
|
|
19
|
-
// (see note below)
|
|
20
|
-
Object.setPrototypeOf(this, new.target.prototype);
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* This function returns the error as a JSON object.
|
|
24
|
-
*/
|
|
25
|
-
toJSON() {
|
|
26
|
-
return {
|
|
27
|
-
message: this.message,
|
|
28
|
-
errorType: this.name,
|
|
29
|
-
errorCode: this.errorCode,
|
|
30
|
-
stack: this.stack,
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.BaseError = BaseError;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { BaseError } from '../base-error';
|
|
2
|
-
/**
|
|
3
|
-
* This is throw when a database records is not found.
|
|
4
|
-
*/
|
|
5
|
-
export declare class DatabaseRecordNotFoundError extends BaseError {
|
|
6
|
-
/**
|
|
7
|
-
* This is thrown when a database record is not found.
|
|
8
|
-
*
|
|
9
|
-
* @param databasePath the path to the database record.
|
|
10
|
-
*/
|
|
11
|
-
constructor(databasePath: string);
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* This is throw when too many database records are found.
|
|
15
|
-
*/
|
|
16
|
-
export declare class DatabaseTooManyRecordsError extends BaseError {
|
|
17
|
-
/**
|
|
18
|
-
* This is thrown when too many database records are found.
|
|
19
|
-
*
|
|
20
|
-
* @param databasePath the path to the database record.
|
|
21
|
-
*/
|
|
22
|
-
constructor(databasePath: string);
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=database-errors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"database-errors.d.ts","sourceRoot":"","sources":["../../../../../../generic/src/errors/database/database-errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C;;GAEG;AACH,qBAAa,2BAA4B,SAAQ,SAAS;IACtD;;;;OAIG;gBACS,YAAY,EAAE,MAAM;CAGnC;AAED;;GAEG;AACH,qBAAa,2BAA4B,SAAQ,SAAS;IACtD;;;;OAIG;gBACS,YAAY,EAAE,MAAM;CAGnC"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DatabaseTooManyRecordsError = exports.DatabaseRecordNotFoundError = void 0;
|
|
4
|
-
// This file contains all the errors that are related to database records.
|
|
5
|
-
const base_error_1 = require("../base-error");
|
|
6
|
-
/**
|
|
7
|
-
* This is throw when a database records is not found.
|
|
8
|
-
*/
|
|
9
|
-
class DatabaseRecordNotFoundError extends base_error_1.BaseError {
|
|
10
|
-
/**
|
|
11
|
-
* This is thrown when a database record is not found.
|
|
12
|
-
*
|
|
13
|
-
* @param databasePath the path to the database record.
|
|
14
|
-
*/
|
|
15
|
-
constructor(databasePath) {
|
|
16
|
-
super(`The database record at ${databasePath} was not found`);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.DatabaseRecordNotFoundError = DatabaseRecordNotFoundError;
|
|
20
|
-
/**
|
|
21
|
-
* This is throw when too many database records are found.
|
|
22
|
-
*/
|
|
23
|
-
class DatabaseTooManyRecordsError extends base_error_1.BaseError {
|
|
24
|
-
/**
|
|
25
|
-
* This is thrown when too many database records are found.
|
|
26
|
-
*
|
|
27
|
-
* @param databasePath the path to the database record.
|
|
28
|
-
*/
|
|
29
|
-
constructor(databasePath) {
|
|
30
|
-
super(`Too many records found at ${databasePath}`);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.DatabaseTooManyRecordsError = DatabaseTooManyRecordsError;
|