@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-set-audiences.d.ts","sourceRoot":"","sources":["../../../../src/cors/authority/audience/get-set-audiences.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,qBAAqB,EAGxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,qBAAqB,CAGxE;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,QAGhD;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,QAEhD;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,QAEhD;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,QAE5C;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,QAE7C;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,QAEhD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-jwt-authorities.d.ts","sourceRoot":"","sources":["../../../../src/cors/authority/jwt/validate-jwt-authorities.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAKvC;;;;;;;;;;;;GAYG;AACH,wBAAsB,sBAAsB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,YAAY,iBAelF"}
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.validateJWTAuthorities = validateJWTAuthorities;
|
|
5
5
|
const generic_1 = require("@degenerate/generic");
|
|
6
6
|
const get_set_audiences_1 = require("../audience/get-set-audiences");
|
|
7
|
-
const errors_1 = require("@degenerate/generic/src/errors");
|
|
8
7
|
/**
|
|
9
8
|
* This function validates that the incoming request has a valid JWT token and it is authorized
|
|
10
9
|
* for the expected function.
|
|
@@ -23,10 +22,10 @@ async function validateJWTAuthorities(req, res, next) {
|
|
|
23
22
|
// get audience from the request
|
|
24
23
|
const audience = (0, get_set_audiences_1.getAudienceAuthority)(req);
|
|
25
24
|
if (!audience) {
|
|
26
|
-
throw new
|
|
25
|
+
throw new generic_1.RequestNotAuthorizedError('No audience found in the request');
|
|
27
26
|
}
|
|
28
27
|
if (audience !== generic_1.AuthorizationAudience.AUTHORITIES) {
|
|
29
|
-
throw new
|
|
28
|
+
throw new generic_1.RequestNotAuthorizedError('the audience included is not for authorities');
|
|
30
29
|
}
|
|
31
30
|
// check if an Authority is present.
|
|
32
31
|
next();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-authorities-transaction.d.ts","sourceRoot":"","sources":["../../../../src/cors/endpoints/authorities/validate-authorities-transaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE1D;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,kDAY7F;AAED;;;;;;;;;;;;;;;;;;;GAmBG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-request-body.d.ts","sourceRoot":"","sources":["../../../../src/cors/endpoints/helpers/validate-request-body.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE1D;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAC/B,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,YAAY,GACnB,IAAI,CAgBN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"all-error-handler.d.ts","sourceRoot":"","sources":["../../../src/cors/errors/all-error-handler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAoB,MAAM,qBAAqB,CAAC;AAElE;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC3B,GAAG,EAAE,SAAS,EACd,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,YAAY,GACnB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAOpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bad-request-handler.d.ts","sourceRoot":"","sources":["../../../src/cors/errors/bad-request-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG1D;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC7B,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,YAAY,kDAYrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unauthorized-handler.d.ts","sourceRoot":"","sources":["../../../src/cors/errors/unauthorized-handler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE1D;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAC/B,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,YAAY,kDAYrB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cors/index.ts"],"names":[],"mappings":"AACA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAM9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAI3C,cAAc,wCAAwC,CAAC;AACvD,cAAc,0CAA0C,CAAC;AAEzD,cAAc,0DAA0D,CAAC;AACzE,cAAc,2CAA2C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"authorities.routes.d.ts","sourceRoot":"","sources":["../../../src/cors/routes/authorities.routes.ts"],"names":[],"mappings":"AAuDA,eAAO,MAAM,WAAW,4CAAS,CAAC"}
|
|
@@ -27,8 +27,8 @@ exports.authorities = void 0;
|
|
|
27
27
|
const express = __importStar(require("express"));
|
|
28
28
|
const get_set_audiences_1 = require("../authority/audience/get-set-audiences");
|
|
29
29
|
const validate_jwt_authorities_1 = require("../authority/jwt/validate-jwt-authorities");
|
|
30
|
-
const params_object_helpers_1 = require("@degenerate/generic/src/helpers/request/params-object-helpers");
|
|
31
30
|
const validate_request_body_1 = require("../endpoints/helpers/validate-request-body");
|
|
31
|
+
const generic_1 = require("@degenerate/generic");
|
|
32
32
|
// eslint-disable-next-line new-cap
|
|
33
33
|
const router = express.Router({ mergeParams: true });
|
|
34
34
|
router.use(get_set_audiences_1.setAudienceAuthority); // set the audience to share data (this will throw an error if the audience is not set)
|
|
@@ -50,7 +50,7 @@ router.get('/', async (req, res) => {
|
|
|
50
50
|
});
|
|
51
51
|
router.get('/:authorityid', async (req, res) => {
|
|
52
52
|
console.log('GET /authorities params called');
|
|
53
|
-
const authorityId = (0,
|
|
53
|
+
const authorityId = (0, generic_1.getAuthorityId)(req); // get the authority id.
|
|
54
54
|
console.log(`Authority ID: ${authorityId}`);
|
|
55
55
|
return res.status(200).send({ successful: true, authorityId });
|
|
56
56
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.routes.d.ts","sourceRoot":"","sources":["../../../src/cors/routes/events.routes.ts"],"names":[],"mappings":"AAoCA,eAAO,MAAM,MAAM,4CAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"functions.routes.d.ts","sourceRoot":"","sources":["../../../src/cors/routes/functions.routes.ts"],"names":[],"mappings":"AAmCA,eAAO,MAAM,SAAS,4CAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules.routes.d.ts","sourceRoot":"","sources":["../../../src/cors/routes/rules.routes.ts"],"names":[],"mappings":"AAmCA,eAAO,MAAM,KAAK,4CAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"share-data.routes.d.ts","sourceRoot":"","sources":["../../../src/cors/routes/share-data.routes.ts"],"names":[],"mappings":"AAmCA,eAAO,MAAM,SAAS,4CAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/examples/express-server/app.ts"],"names":[],"mappings":"AAYA,QAAA,MAAM,GAAG,6CAAY,CAAC;AAiBtB,eAAe,GAAG,CAAC"}
|
|
@@ -3,7 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const authorization_1 = require("@degenerate/generic/src/authorization");
|
|
7
6
|
const express_1 = __importDefault(require("express"));
|
|
8
7
|
//#region Route Imports
|
|
9
8
|
const authorities_routes_1 = require("../../cors/routes/authorities.routes");
|
|
@@ -11,11 +10,12 @@ const events_routes_1 = require("../../cors/routes/events.routes");
|
|
|
11
10
|
const functions_routes_1 = require("../../cors/routes/functions.routes");
|
|
12
11
|
const rules_routes_1 = require("../../cors/routes/rules.routes");
|
|
13
12
|
const share_data_routes_1 = require("../../cors/routes/share-data.routes");
|
|
13
|
+
const generic_1 = require("@degenerate/generic");
|
|
14
14
|
//#endregion Route Imports
|
|
15
15
|
// create the express application
|
|
16
16
|
const app = (0, express_1.default)();
|
|
17
17
|
app.use(express_1.default.json());
|
|
18
|
-
const authorizedAuthorities = new
|
|
18
|
+
const authorizedAuthorities = new generic_1.AuthorizedAuthorities();
|
|
19
19
|
// Initialize the authorized authorities here if needed
|
|
20
20
|
// e.g., authorizedAuthorities.addAuthorizedJWTAuthority(...);
|
|
21
21
|
// Make the instance available throughout the app
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/examples/express-server/server.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@degenerate/endpoints",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"devDependencies": {
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"@degenerate/generic": "^0.1.7",
|
|
43
43
|
"express": "^4.21.1"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "d158ea8a4c8109a7a5373cbd3d5c89f89888af6e"
|
|
46
46
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-set-audiences.d.ts","sourceRoot":"","sources":["../../../../../../src/cors/authority/audience/get-set-audiences.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,qBAAqB,EAGxB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,qBAAqB,CAGxE;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,QAGhD;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,QAEhD;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,QAEhD;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,QAE5C;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,QAE7C;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,QAEhD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate-jwt-authorities.d.ts","sourceRoot":"","sources":["../../../../../../src/cors/authority/jwt/validate-jwt-authorities.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAKvC;;;;;;;;;;;;GAYG;AACH,wBAAsB,sBAAsB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,YAAY,iBAelF"}
|
package/dist/endpoints/src/cors/endpoints/authorities/validate-authorities-transaction.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate-authorities-transaction.d.ts","sourceRoot":"","sources":["../../../../../../src/cors/endpoints/authorities/validate-authorities-transaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE1D;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,YAAY,kDAY7F;AAED;;;;;;;;;;;;;;;;;;;GAmBG"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validate-request-body.d.ts","sourceRoot":"","sources":["../../../../../../src/cors/endpoints/helpers/validate-request-body.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE1D;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAC/B,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,YAAY,GACnB,IAAI,CAgBN"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"all-error-handler.d.ts","sourceRoot":"","sources":["../../../../../src/cors/errors/all-error-handler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAoB,MAAM,qBAAqB,CAAC;AAElE;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC3B,GAAG,EAAE,SAAS,EACd,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,YAAY,GACnB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAOpC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bad-request-handler.d.ts","sourceRoot":"","sources":["../../../../../src/cors/errors/bad-request-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG1D;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC7B,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,YAAY,kDAYrB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"unauthorized-handler.d.ts","sourceRoot":"","sources":["../../../../../src/cors/errors/unauthorized-handler.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE1D;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAC/B,GAAG,EAAE,GAAG,EACR,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,IAAI,EAAE,YAAY,kDAYrB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cors/index.ts"],"names":[],"mappings":"AACA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAM9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAI3C,cAAc,wCAAwC,CAAC;AACvD,cAAc,0CAA0C,CAAC;AAEzD,cAAc,0DAA0D,CAAC;AACzE,cAAc,2CAA2C,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authorities.routes.d.ts","sourceRoot":"","sources":["../../../../../src/cors/routes/authorities.routes.ts"],"names":[],"mappings":"AAuDA,eAAO,MAAM,WAAW,4CAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"events.routes.d.ts","sourceRoot":"","sources":["../../../../../src/cors/routes/events.routes.ts"],"names":[],"mappings":"AAoCA,eAAO,MAAM,MAAM,4CAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"functions.routes.d.ts","sourceRoot":"","sources":["../../../../../src/cors/routes/functions.routes.ts"],"names":[],"mappings":"AAmCA,eAAO,MAAM,SAAS,4CAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rules.routes.d.ts","sourceRoot":"","sources":["../../../../../src/cors/routes/rules.routes.ts"],"names":[],"mappings":"AAmCA,eAAO,MAAM,KAAK,4CAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"share-data.routes.d.ts","sourceRoot":"","sources":["../../../../../src/cors/routes/share-data.routes.ts"],"names":[],"mappings":"AAmCA,eAAO,MAAM,SAAS,4CAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../../../src/examples/express-server/app.ts"],"names":[],"mappings":"AAWA,QAAA,MAAM,GAAG,6CAAY,CAAC;AAiBtB,eAAe,GAAG,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../../../src/examples/express-server/server.ts"],"names":[],"mappings":""}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This contains the settings for the authorization functions.
|
|
3
|
-
*/
|
|
4
|
-
export declare const AuthorizationSettings: {
|
|
5
|
-
JWT: {
|
|
6
|
-
Algorithm: string;
|
|
7
|
-
ExpiresInDefault: string;
|
|
8
|
-
NotBeforeDefault: number;
|
|
9
|
-
EncodingDefault: string;
|
|
10
|
-
MutatePayload: boolean;
|
|
11
|
-
NoTimestamp: boolean;
|
|
12
|
-
AllowInsecureKeySizes: boolean;
|
|
13
|
-
AllowInvalidAsymmetricKeyTypes: boolean;
|
|
14
|
-
HeaderType: string;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
//# sourceMappingURL=authorization-settings.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"authorization-settings.d.ts","sourceRoot":"","sources":["../../../../../generic/src/_settings/authorization-settings.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;CAYjC,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// This file contains the settings needed for authorization in the application.
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.AuthorizationSettings = void 0;
|
|
5
|
-
/**
|
|
6
|
-
* This contains the settings for the authorization functions.
|
|
7
|
-
*/
|
|
8
|
-
exports.AuthorizationSettings = {
|
|
9
|
-
JWT: {
|
|
10
|
-
Algorithm: 'ES512', // ECDSA using P-521 curve and SHA-512 hash algorithm
|
|
11
|
-
ExpiresInDefault: '1h', // the expiration time of the jwt token
|
|
12
|
-
NotBeforeDefault: 0, // the not before time of the jwt token
|
|
13
|
-
EncodingDefault: 'utf8', // the encoding to use when converting the payload to a string
|
|
14
|
-
MutatePayload: true, // If true, the payload object will be mutated with the standard claims (iat, exp, etc.). Default is false.
|
|
15
|
-
NoTimestamp: false, // If true, the iat (issued at) claim will not be included in the token.
|
|
16
|
-
AllowInsecureKeySizes: false, // If true, allows the use of insecure key sizes.
|
|
17
|
-
AllowInvalidAsymmetricKeyTypes: false, // If true, allows the use of invalid asymmetric key types
|
|
18
|
-
HeaderType: 'JWT', // the type of the token in the header
|
|
19
|
-
}
|
|
20
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export * from './jwt/keys/create-secret-key-pem';
|
|
2
|
-
export * from './jwt/keys/create-public-key-pem';
|
|
3
|
-
export * from './jwt/sign/create-authorization-issuer';
|
|
4
|
-
export * from './jwt/sign/create-authorization-subject';
|
|
5
|
-
export * from './jwt/sign/create-jwt-options';
|
|
6
|
-
export * from './jwt/sign/create-jwt-signed-token';
|
|
7
|
-
export * from './jwt/transform/transform-token-payload-to-safe-payload';
|
|
8
|
-
export * from './jwt/verify/get-decoded-jwt-header';
|
|
9
|
-
export * from './jwt/verify/get-decoded-jwt-signed-token-payload';
|
|
10
|
-
export * from './jwt/verify/verify-jwt-signed-token';
|
|
11
|
-
export * from './safe/authorization/authorized-authorities';
|
|
12
|
-
export * from './safe/request/decode-bearer-token';
|
|
13
|
-
export * from './safe/request/decode-safe-request';
|
|
14
|
-
export * from './safe/request/determine-issuer-from-request';
|
|
15
|
-
export * from './safe/request/issuer/determine-issuer-from-bearer-token';
|
|
16
|
-
export * from './safe/validation/jwt/payload/verify-authorization-audience';
|
|
17
|
-
export * from './safe/validation/jwt/payload/verify-authorization-expiration-time';
|
|
18
|
-
export * from './safe/validation/jwt/payload/verify-authorization-issued-at-time';
|
|
19
|
-
export * from './safe/validation/jwt/payload/verify-authorization-issuer';
|
|
20
|
-
export * from './safe/validation/jwt/payload/verify-authorization-not-before-time';
|
|
21
|
-
export * from './safe/validation/jwt/payload/verify-authorization-subject';
|
|
22
|
-
export * from './safe/validation/jwt/verify-token-header';
|
|
23
|
-
export * from './safe/validation/jwt/verify-token-payload';
|
|
24
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../generic/src/authorization/index.ts"],"names":[],"mappings":"AACA,cAAc,kCAAkC,CAAC;AACjD,cAAc,kCAAkC,CAAC;AAIjD,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,oCAAoC,CAAC;AAInD,cAAc,yDAAyD,CAAC;AAIxE,cAAc,qCAAqC,CAAC;AACpD,cAAc,mDAAmD,CAAC;AAClE,cAAc,sCAAsC,CAAC;AAMrD,cAAc,6CAA6C,CAAC;AAI5D,cAAc,oCAAoC,CAAC;AACnD,cAAc,oCAAoC,CAAC;AACnD,cAAc,8CAA8C,CAAC;AAG7D,cAAc,0DAA0D,CAAC;AAWzE,cAAc,6DAA6D,CAAC;AAC5E,cAAc,oEAAoE,CAAC;AACnF,cAAc,mEAAmE,CAAC;AAClF,cAAc,2DAA2D,CAAC;AAC1E,cAAc,oEAAoE,CAAC;AACnF,cAAc,4DAA4D,CAAC;AAI3E,cAAc,2CAA2C,CAAC;AAC1D,cAAc,4CAA4C,CAAC"}
|
|
@@ -1,61 +0,0 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
//#region JWT Key functions
|
|
18
|
-
__exportStar(require("./jwt/keys/create-secret-key-pem"), exports);
|
|
19
|
-
__exportStar(require("./jwt/keys/create-public-key-pem"), exports);
|
|
20
|
-
//#endregion JWT Key functions
|
|
21
|
-
//#region JWT sign
|
|
22
|
-
__exportStar(require("./jwt/sign/create-authorization-issuer"), exports);
|
|
23
|
-
__exportStar(require("./jwt/sign/create-authorization-subject"), exports);
|
|
24
|
-
__exportStar(require("./jwt/sign/create-jwt-options"), exports);
|
|
25
|
-
__exportStar(require("./jwt/sign/create-jwt-signed-token"), exports);
|
|
26
|
-
//#endregion JWT sign
|
|
27
|
-
//#region JWT Transform
|
|
28
|
-
__exportStar(require("./jwt/transform/transform-token-payload-to-safe-payload"), exports);
|
|
29
|
-
//#endregion JWT Transform
|
|
30
|
-
//#region JWT verify
|
|
31
|
-
__exportStar(require("./jwt/verify/get-decoded-jwt-header"), exports);
|
|
32
|
-
__exportStar(require("./jwt/verify/get-decoded-jwt-signed-token-payload"), exports);
|
|
33
|
-
__exportStar(require("./jwt/verify/verify-jwt-signed-token"), exports);
|
|
34
|
-
//#endregion JWT verify
|
|
35
|
-
//#region Safe
|
|
36
|
-
//#region Authorization
|
|
37
|
-
__exportStar(require("./safe/authorization/authorized-authorities"), exports);
|
|
38
|
-
//#endregion Authorization
|
|
39
|
-
//#region Request
|
|
40
|
-
__exportStar(require("./safe/request/decode-bearer-token"), exports);
|
|
41
|
-
__exportStar(require("./safe/request/decode-safe-request"), exports);
|
|
42
|
-
__exportStar(require("./safe/request/determine-issuer-from-request"), exports);
|
|
43
|
-
//#region Issuer
|
|
44
|
-
__exportStar(require("./safe/request/issuer/determine-issuer-from-bearer-token"), exports);
|
|
45
|
-
//#endregion Issuer
|
|
46
|
-
//#endregion Request
|
|
47
|
-
//#region Validation
|
|
48
|
-
//#region JWT
|
|
49
|
-
//#region JWT Payload
|
|
50
|
-
__exportStar(require("./safe/validation/jwt/payload/verify-authorization-audience"), exports);
|
|
51
|
-
__exportStar(require("./safe/validation/jwt/payload/verify-authorization-expiration-time"), exports);
|
|
52
|
-
__exportStar(require("./safe/validation/jwt/payload/verify-authorization-issued-at-time"), exports);
|
|
53
|
-
__exportStar(require("./safe/validation/jwt/payload/verify-authorization-issuer"), exports);
|
|
54
|
-
__exportStar(require("./safe/validation/jwt/payload/verify-authorization-not-before-time"), exports);
|
|
55
|
-
__exportStar(require("./safe/validation/jwt/payload/verify-authorization-subject"), exports);
|
|
56
|
-
//#endregion JWT Payload
|
|
57
|
-
__exportStar(require("./safe/validation/jwt/verify-token-header"), exports);
|
|
58
|
-
__exportStar(require("./safe/validation/jwt/verify-token-payload"), exports);
|
|
59
|
-
//#endregion JWT
|
|
60
|
-
//#endregion Validation
|
|
61
|
-
//#endregion Safe
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This takes a public key in hex or Base64 format and creates a PEM key from it.
|
|
3
|
-
*
|
|
4
|
-
* @param publicKey the public key to create the PEM key from.
|
|
5
|
-
* @returns
|
|
6
|
-
*/
|
|
7
|
-
declare const createPublicKeyPem: (publicKey: string) => string;
|
|
8
|
-
export { createPublicKeyPem };
|
|
9
|
-
//# sourceMappingURL=create-public-key-pem.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-public-key-pem.d.ts","sourceRoot":"","sources":["../../../../../../../generic/src/authorization/jwt/keys/create-public-key-pem.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,QAAA,MAAM,kBAAkB,cAAe,MAAM,KAAG,MAW/C,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createPublicKeyPem = void 0;
|
|
4
|
-
const cryptography_helpers_1 = require("../../../helpers/crypto/cryptography-helpers");
|
|
5
|
-
const object_validation_helpers_1 = require("../../../helpers/object-validation-helpers");
|
|
6
|
-
/**
|
|
7
|
-
* This takes a public key in hex or Base64 format and creates a PEM key from it.
|
|
8
|
-
*
|
|
9
|
-
* @param publicKey the public key to create the PEM key from.
|
|
10
|
-
* @returns
|
|
11
|
-
*/
|
|
12
|
-
const createPublicKeyPem = (publicKey) => {
|
|
13
|
-
let jwtKey; // the key to return
|
|
14
|
-
const isValidHexString = (0, object_validation_helpers_1.validateStringHex)(publicKey);
|
|
15
|
-
if (isValidHexString) { // check if this is a hex encoded secret key.
|
|
16
|
-
const derKey = (0, cryptography_helpers_1.hexToBase64)(publicKey); // convert the hex to base 64
|
|
17
|
-
jwtKey = (0, cryptography_helpers_1.base64ToPublicPEM)(derKey);
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
// add in the
|
|
21
|
-
jwtKey = (0, cryptography_helpers_1.base64ToPublicPEM)(publicKey);
|
|
22
|
-
}
|
|
23
|
-
return jwtKey;
|
|
24
|
-
};
|
|
25
|
-
exports.createPublicKeyPem = createPublicKeyPem;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This takes a secret key in hex or Base64 format and creates a PEM key from it.
|
|
3
|
-
*
|
|
4
|
-
* @param secretKey the secret key to create the PEM key from.
|
|
5
|
-
* @returns
|
|
6
|
-
*/
|
|
7
|
-
declare const createSecretKeyPem: (secretKey: string) => string;
|
|
8
|
-
export { createSecretKeyPem };
|
|
9
|
-
//# sourceMappingURL=create-secret-key-pem.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-secret-key-pem.d.ts","sourceRoot":"","sources":["../../../../../../../generic/src/authorization/jwt/keys/create-secret-key-pem.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,QAAA,MAAM,kBAAkB,cAAe,MAAM,KAAG,MAU/C,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createSecretKeyPem = void 0;
|
|
4
|
-
const cryptography_helpers_1 = require("../../../helpers/crypto/cryptography-helpers");
|
|
5
|
-
const object_validation_helpers_1 = require("../../../helpers/object-validation-helpers");
|
|
6
|
-
/**
|
|
7
|
-
* This takes a secret key in hex or Base64 format and creates a PEM key from it.
|
|
8
|
-
*
|
|
9
|
-
* @param secretKey the secret key to create the PEM key from.
|
|
10
|
-
* @returns
|
|
11
|
-
*/
|
|
12
|
-
const createSecretKeyPem = (secretKey) => {
|
|
13
|
-
let jwtKey;
|
|
14
|
-
if ((0, object_validation_helpers_1.validateStringHex)(secretKey)) { // check if this is a hex encoded secret key.
|
|
15
|
-
const derKey = (0, cryptography_helpers_1.hexToBase64)(secretKey); // convert the hex to base 64
|
|
16
|
-
jwtKey = (0, cryptography_helpers_1.base64ToPrivateECPEM)(derKey);
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
// add in the
|
|
20
|
-
jwtKey = (0, cryptography_helpers_1.base64ToPrivateECPEM)(secretKey);
|
|
21
|
-
}
|
|
22
|
-
return jwtKey;
|
|
23
|
-
};
|
|
24
|
-
exports.createSecretKeyPem = createSecretKeyPem;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { IAuthorizationIssuer } from '../../../models/authorization/authorization-models';
|
|
2
|
-
/**
|
|
3
|
-
* This function creates an authorization issuer.
|
|
4
|
-
* @param issuerName the name of the issuer (this should be letters and numbers only)
|
|
5
|
-
* @param publicKey the public key of the issuer (this should be a hex string)
|
|
6
|
-
* @returns
|
|
7
|
-
*/
|
|
8
|
-
declare const createAuthorizationIssuer: (issuerName: string, publicKey: string) => IAuthorizationIssuer;
|
|
9
|
-
export { createAuthorizationIssuer };
|
|
10
|
-
//# sourceMappingURL=create-authorization-issuer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-authorization-issuer.d.ts","sourceRoot":"","sources":["../../../../../../../generic/src/authorization/jwt/sign/create-authorization-issuer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oDAAoD,CAAC;AAE1F;;;;;GAKG;AACH,QAAA,MAAM,yBAAyB,eAAgB,MAAM,aAAa,MAAM,KAAG,oBAe1E,CAAC;AAEF,OAAO,EAAE,yBAAyB,EAAE,CAAC"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createAuthorizationIssuer = void 0;
|
|
4
|
-
const authorization_errors_1 = require("../../../errors/authorization/authorization-errors");
|
|
5
|
-
const object_validation_helpers_1 = require("../../../helpers/object-validation-helpers");
|
|
6
|
-
/**
|
|
7
|
-
* This function creates an authorization issuer.
|
|
8
|
-
* @param issuerName the name of the issuer (this should be letters and numbers only)
|
|
9
|
-
* @param publicKey the public key of the issuer (this should be a hex string)
|
|
10
|
-
* @returns
|
|
11
|
-
*/
|
|
12
|
-
const createAuthorizationIssuer = (issuerName, publicKey) => {
|
|
13
|
-
// make sure the incoming public key is a hex format
|
|
14
|
-
const publicKeyIsHex = (0, object_validation_helpers_1.validateStringHex)(publicKey);
|
|
15
|
-
if (!publicKeyIsHex) { // if the public key is not a valid hex string
|
|
16
|
-
throw new authorization_errors_1.SafeAuthorizationIssuerPublicKeyNotValidError(issuerName, publicKey);
|
|
17
|
-
}
|
|
18
|
-
if (publicKey.length < 8) { // if the public key is less than 8 characters
|
|
19
|
-
throw new authorization_errors_1.SafeAuthorizationIssuerPublicKeyNotValidError(issuerName, publicKey);
|
|
20
|
-
}
|
|
21
|
-
// get the last 8 characters of the public key
|
|
22
|
-
const publicKeyParse = publicKey.slice(-8);
|
|
23
|
-
const authorizationIssuer = `${issuerName}-${publicKeyParse}`;
|
|
24
|
-
return authorizationIssuer;
|
|
25
|
-
};
|
|
26
|
-
exports.createAuthorizationIssuer = createAuthorizationIssuer;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { AuthorizationSubjectStart, IAuthorizationSubject } from '../../../models/authorization/authorization-models';
|
|
2
|
-
/**
|
|
3
|
-
* This creates an authorization subject.
|
|
4
|
-
*
|
|
5
|
-
* @param subjectType the type of the subject
|
|
6
|
-
* @param subjectId the id of the subject (userid, safenetworkid etc.)
|
|
7
|
-
*
|
|
8
|
-
* @returns
|
|
9
|
-
*/
|
|
10
|
-
declare const createAuthorizationSubject: (subjectType: AuthorizationSubjectStart, subjectId: string) => IAuthorizationSubject;
|
|
11
|
-
export { createAuthorizationSubject };
|
|
12
|
-
//# sourceMappingURL=create-authorization-subject.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-authorization-subject.d.ts","sourceRoot":"","sources":["../../../../../../../generic/src/authorization/jwt/sign/create-authorization-subject.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAC;AAEtH;;;;;;;GAOG;AACH,QAAA,MAAM,0BAA0B,gBACf,yBAAyB,aAC3B,MAAM,KAClB,qBAKF,CAAC;AAEF,OAAO,EAAE,0BAA0B,EAAE,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createAuthorizationSubject = void 0;
|
|
4
|
-
const authorization_errors_1 = require("../../../errors/authorization/authorization-errors");
|
|
5
|
-
/**
|
|
6
|
-
* This creates an authorization subject.
|
|
7
|
-
*
|
|
8
|
-
* @param subjectType the type of the subject
|
|
9
|
-
* @param subjectId the id of the subject (userid, safenetworkid etc.)
|
|
10
|
-
*
|
|
11
|
-
* @returns
|
|
12
|
-
*/
|
|
13
|
-
const createAuthorizationSubject = (subjectType, subjectId) => {
|
|
14
|
-
if (!subjectId) {
|
|
15
|
-
throw new authorization_errors_1.SafeAuthorizationSubjectNotValidError(subjectType, subjectId);
|
|
16
|
-
}
|
|
17
|
-
return `${subjectType}:${subjectId}`;
|
|
18
|
-
};
|
|
19
|
-
exports.createAuthorizationSubject = createAuthorizationSubject;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import jwt from 'jsonwebtoken';
|
|
2
|
-
import { AuthorizationAudience, IAuthorizationSubject } from '../../../models/authorization/authorization-models';
|
|
3
|
-
/**
|
|
4
|
-
* This function creates the options for the jwt token issuance
|
|
5
|
-
*
|
|
6
|
-
* @param subject the subject of the token
|
|
7
|
-
* @param audience the audience of the token (default is sharedata)
|
|
8
|
-
* @param algorithm the algorithm to use (default is ES512)
|
|
9
|
-
* @param expiresIn the expiration time of the token (default is 1 hour)
|
|
10
|
-
* @param notBefore the not before time of the token (default is 0)
|
|
11
|
-
* @param keyid A unique identifier for the key used to sign the token. This can be used to prevent replay attacks. (optional)
|
|
12
|
-
* @param header An object containing additional header properties to include in the token. (optional)
|
|
13
|
-
* @returns
|
|
14
|
-
*/
|
|
15
|
-
declare const createJwtOptions: (subject: IAuthorizationSubject, audience?: AuthorizationAudience | AuthorizationAudience[], algorithm?: jwt.Algorithm, expiresIn?: string | number, notBefore?: string | number, keyid?: string, header?: jwt.JwtHeader) => jwt.SignOptions;
|
|
16
|
-
export { createJwtOptions };
|
|
17
|
-
//# sourceMappingURL=create-jwt-options.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-jwt-options.d.ts","sourceRoot":"","sources":["../../../../../../../generic/src/authorization/jwt/sign/create-jwt-options.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,cAAc,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,oDAAoD,CAAC;AAGlH;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,gBAAgB,YACT,qBAAqB,aACpB,qBAAqB,GAAG,qBAAqB,EAAE,cAC9C,GAAG,CAAC,SAAS,cACb,MAAM,GAAG,MAAM,cACf,MAAM,GAAG,MAAM,UAClB,MAAM,WACL,GAAG,CAAC,SAAS,KACvB,GAAG,CAAC,WAkBN,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createJwtOptions = void 0;
|
|
4
|
-
const authorization_models_1 = require("../../../models/authorization/authorization-models");
|
|
5
|
-
const authorization_settings_1 = require("../../../_settings/authorization-settings");
|
|
6
|
-
/**
|
|
7
|
-
* This function creates the options for the jwt token issuance
|
|
8
|
-
*
|
|
9
|
-
* @param subject the subject of the token
|
|
10
|
-
* @param audience the audience of the token (default is sharedata)
|
|
11
|
-
* @param algorithm the algorithm to use (default is ES512)
|
|
12
|
-
* @param expiresIn the expiration time of the token (default is 1 hour)
|
|
13
|
-
* @param notBefore the not before time of the token (default is 0)
|
|
14
|
-
* @param keyid A unique identifier for the key used to sign the token. This can be used to prevent replay attacks. (optional)
|
|
15
|
-
* @param header An object containing additional header properties to include in the token. (optional)
|
|
16
|
-
* @returns
|
|
17
|
-
*/
|
|
18
|
-
const createJwtOptions = (subject, // the subject of the token
|
|
19
|
-
audience = authorization_models_1.AuthorizationAudience.SHAREDATA, // audience
|
|
20
|
-
algorithm = authorization_settings_1.AuthorizationSettings.JWT.Algorithm, // ECDSA using P-521 curve and SHA-512 hash algorithm
|
|
21
|
-
expiresIn = authorization_settings_1.AuthorizationSettings.JWT.ExpiresInDefault, // Default expiration time
|
|
22
|
-
notBefore = authorization_settings_1.AuthorizationSettings.JWT.NotBeforeDefault, // Default not before time
|
|
23
|
-
keyid, // A unique identifier for the key used to sign the token. This can be used to prevent replay attacks.
|
|
24
|
-
header) => {
|
|
25
|
-
const jwtOptions = {
|
|
26
|
-
subject,
|
|
27
|
-
audience,
|
|
28
|
-
algorithm,
|
|
29
|
-
expiresIn,
|
|
30
|
-
notBefore,
|
|
31
|
-
mutatePayload: authorization_settings_1.AuthorizationSettings.JWT.MutatePayload, // If true, the payload object will be mutated with the standard claims (iat, exp, etc.). Default is false.
|
|
32
|
-
noTimestamp: authorization_settings_1.AuthorizationSettings.JWT.NoTimestamp, // If true, the iat (issued at) claim will not be included in the token.
|
|
33
|
-
encoding: authorization_settings_1.AuthorizationSettings.JWT.EncodingDefault, // The encoding to use when converting the payload to a string.
|
|
34
|
-
allowInsecureKeySizes: authorization_settings_1.AuthorizationSettings.JWT.AllowInsecureKeySizes, // If true, allows the use of insecure key sizes.
|
|
35
|
-
allowInvalidAsymmetricKeyTypes: authorization_settings_1.AuthorizationSettings.JWT.AllowInvalidAsymmetricKeyTypes, // If true, allows the use of invalid asymmetric key types.
|
|
36
|
-
};
|
|
37
|
-
if (keyid)
|
|
38
|
-
jwtOptions.keyid = keyid;
|
|
39
|
-
if (header)
|
|
40
|
-
jwtOptions.header = header;
|
|
41
|
-
return jwtOptions;
|
|
42
|
-
};
|
|
43
|
-
exports.createJwtOptions = createJwtOptions;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { IAuthorizationPayload } from '../../../models/authorization/authorization-models';
|
|
2
|
-
import jwt from 'jsonwebtoken';
|
|
3
|
-
/**
|
|
4
|
-
* This creates a signed JWT token with the given payload and secret key.
|
|
5
|
-
*
|
|
6
|
-
* @param payload the payload to sign
|
|
7
|
-
* @param secretKey the secret key to sign the token with
|
|
8
|
-
* @param options the options for the signed jwt token
|
|
9
|
-
* @returns
|
|
10
|
-
*/
|
|
11
|
-
declare const createJWTSignedToken: (payload: IAuthorizationPayload, secretKey: string, options: jwt.SignOptions) => string;
|
|
12
|
-
export { createJWTSignedToken };
|
|
13
|
-
//# sourceMappingURL=create-jwt-signed-token.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-jwt-signed-token.d.ts","sourceRoot":"","sources":["../../../../../../../generic/src/authorization/jwt/sign/create-jwt-signed-token.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,qBAAqB,EACxB,MAAM,oDAAoD,CAAC;AAC5D,OAAO,GAAG,MAAM,cAAc,CAAC;AAG/B;;;;;;;GAOG;AACH,QAAA,MAAM,oBAAoB,YACb,qBAAqB,aACnB,MAAM,WACR,GAAG,CAAC,WAAW,KACzB,MAIF,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|