@degenerate/endpoints 0.0.4 → 0.0.6
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/endpoints/src/cors/index.d.ts +4 -0
- package/dist/endpoints/src/cors/index.d.ts.map +1 -1
- package/dist/endpoints/src/cors/index.js +4 -0
- package/dist/endpoints/src/examples/express-server/app.d.ts.map +1 -1
- package/dist/endpoints/src/examples/express-server/app.js +2 -2
- package/package.json +3 -3
- 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/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
|
@@ -6,4 +6,8 @@ export * from './routes/events.routes';
|
|
|
6
6
|
export * from './routes/functions.routes';
|
|
7
7
|
export * from './routes/rules.routes';
|
|
8
8
|
export * from './routes/share-data.routes';
|
|
9
|
+
export * from './authority/audience/get-set-audiences';
|
|
10
|
+
export * from './authority/jwt/validate-jwt-authorities';
|
|
11
|
+
export * from './endpoints/authorities/validate-authorities-transaction';
|
|
12
|
+
export * from './endpoints/helpers/validate-request-body';
|
|
9
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +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"}
|
|
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"}
|
|
@@ -26,3 +26,7 @@ __exportStar(require("./routes/functions.routes"), exports);
|
|
|
26
26
|
__exportStar(require("./routes/rules.routes"), exports);
|
|
27
27
|
__exportStar(require("./routes/share-data.routes"), exports);
|
|
28
28
|
//#endregion routes
|
|
29
|
+
__exportStar(require("./authority/audience/get-set-audiences"), exports);
|
|
30
|
+
__exportStar(require("./authority/jwt/validate-jwt-authorities"), exports);
|
|
31
|
+
__exportStar(require("./endpoints/authorities/validate-authorities-transaction"), exports);
|
|
32
|
+
__exportStar(require("./endpoints/helpers/validate-request-body"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../../../src/examples/express-server/app.ts"],"names":[],"mappings":"
|
|
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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@degenerate/endpoints",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"devDependencies": {
|
|
@@ -39,8 +39,8 @@
|
|
|
39
39
|
"author": "Degenerate Inc.",
|
|
40
40
|
"license": "ISC",
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@degenerate/generic": "^0.1.
|
|
42
|
+
"@degenerate/generic": "^0.1.7",
|
|
43
43
|
"express": "^4.21.1"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "970fa09b25d01f8f99559458c24e64fb0f4da615"
|
|
46
46
|
}
|
|
@@ -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"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createJWTSignedToken = void 0;
|
|
7
|
-
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
8
|
-
const create_secret_key_pem_1 = require("../keys/create-secret-key-pem");
|
|
9
|
-
/**
|
|
10
|
-
* This creates a signed JWT token with the given payload and secret key.
|
|
11
|
-
*
|
|
12
|
-
* @param payload the payload to sign
|
|
13
|
-
* @param secretKey the secret key to sign the token with
|
|
14
|
-
* @param options the options for the signed jwt token
|
|
15
|
-
* @returns
|
|
16
|
-
*/
|
|
17
|
-
const createJWTSignedToken = (payload, secretKey, options) => {
|
|
18
|
-
const jwtKey = (0, create_secret_key_pem_1.createSecretKeyPem)(secretKey);
|
|
19
|
-
const jwtToken = jsonwebtoken_1.default.sign(payload, jwtKey, options);
|
|
20
|
-
return jwtToken;
|
|
21
|
-
};
|
|
22
|
-
exports.createJWTSignedToken = createJWTSignedToken;
|
package/dist/generic/src/authorization/jwt/transform/transform-token-payload-to-safe-payload.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { IDecodedJwtToken, IValidSafeTokenPayload } from '../../../models/authorization/authorization-models';
|
|
2
|
-
/**
|
|
3
|
-
* This function transforms the token payload to a safe payload with custom claims (if any).
|
|
4
|
-
*
|
|
5
|
-
* @param payload the payload to transform
|
|
6
|
-
* @returns the safe payload
|
|
7
|
-
*/
|
|
8
|
-
declare const transformTokenPayloadToSafePayload: (payload: IValidSafeTokenPayload) => IDecodedJwtToken;
|
|
9
|
-
export { transformTokenPayloadToSafePayload };
|
|
10
|
-
//# sourceMappingURL=transform-token-payload-to-safe-payload.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transform-token-payload-to-safe-payload.d.ts","sourceRoot":"","sources":["../../../../../../../generic/src/authorization/jwt/transform/transform-token-payload-to-safe-payload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,oDAAoD,CAAC;AAE9G;;;;;GAKG;AACH,QAAA,MAAM,kCAAkC,YAAa,sBAAsB,KAAG,gBAuB7E,CAAC;AAEF,OAAO,EAAE,kCAAkC,EAAE,CAAC"}
|
package/dist/generic/src/authorization/jwt/transform/transform-token-payload-to-safe-payload.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.transformTokenPayloadToSafePayload = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* This function transforms the token payload to a safe payload with custom claims (if any).
|
|
6
|
-
*
|
|
7
|
-
* @param payload the payload to transform
|
|
8
|
-
* @returns the safe payload
|
|
9
|
-
*/
|
|
10
|
-
const transformTokenPayloadToSafePayload = (payload) => {
|
|
11
|
-
// get any other properties from the payload other than the default ones
|
|
12
|
-
const otherProperties = Object.keys(payload).reduce((acc, key) => {
|
|
13
|
-
if (!['iat', 'nbf', 'exp', 'sub', 'aud', 'iss'].includes(key)) {
|
|
14
|
-
acc[key] = payload[key];
|
|
15
|
-
}
|
|
16
|
-
return acc;
|
|
17
|
-
}, {});
|
|
18
|
-
const safePayload = {
|
|
19
|
-
iat: payload.iat,
|
|
20
|
-
nbf: payload.nbf,
|
|
21
|
-
exp: payload.exp,
|
|
22
|
-
sub: payload.sub,
|
|
23
|
-
aud: payload.aud,
|
|
24
|
-
iss: payload.iss,
|
|
25
|
-
};
|
|
26
|
-
if (Object.keys(otherProperties).length > 0) {
|
|
27
|
-
safePayload.customClaims = otherProperties;
|
|
28
|
-
}
|
|
29
|
-
return safePayload;
|
|
30
|
-
};
|
|
31
|
-
exports.transformTokenPayloadToSafePayload = transformTokenPayloadToSafePayload;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { IAuthorizationHeader } from '../../../models/authorization/authorization-models';
|
|
2
|
-
/**
|
|
3
|
-
* This function gets the decoded jwt header from the token.
|
|
4
|
-
*
|
|
5
|
-
* @param token the token to get the header from.
|
|
6
|
-
* @returns
|
|
7
|
-
*/
|
|
8
|
-
declare const getDecodedJwtHeader: (token: string) => IAuthorizationHeader;
|
|
9
|
-
export { getDecodedJwtHeader };
|
|
10
|
-
//# sourceMappingURL=get-decoded-jwt-header.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-decoded-jwt-header.d.ts","sourceRoot":"","sources":["../../../../../../../generic/src/authorization/jwt/verify/get-decoded-jwt-header.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oDAAoD,CAAC;AAE1F;;;;;GAKG;AACH,QAAA,MAAM,mBAAmB,UAAW,MAAM,KAAG,oBAU5C,CAAC;AAEF,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDecodedJwtHeader = void 0;
|
|
4
|
-
const authorization_errors_1 = require("../../../errors/authorization/authorization-errors");
|
|
5
|
-
/**
|
|
6
|
-
* This function gets the decoded jwt header from the token.
|
|
7
|
-
*
|
|
8
|
-
* @param token the token to get the header from.
|
|
9
|
-
* @returns
|
|
10
|
-
*/
|
|
11
|
-
const getDecodedJwtHeader = (token) => {
|
|
12
|
-
// break the token apart
|
|
13
|
-
const jwtTokenParts = token.split('.');
|
|
14
|
-
if (jwtTokenParts.length !== 3) {
|
|
15
|
-
throw new authorization_errors_1.SafeAuthorizationTokenNotBase64Error();
|
|
16
|
-
}
|
|
17
|
-
const header = JSON.parse(Buffer.from(jwtTokenParts[0], 'base64').toString('utf-8'));
|
|
18
|
-
return header;
|
|
19
|
-
};
|
|
20
|
-
exports.getDecodedJwtHeader = getDecodedJwtHeader;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { JwtPayload } from 'jsonwebtoken';
|
|
2
|
-
/**
|
|
3
|
-
* This function gets the decoded payload from a signed JWT token.
|
|
4
|
-
*
|
|
5
|
-
* @param token the token to get the payload from
|
|
6
|
-
*/
|
|
7
|
-
declare const getDecodedJwtSignedTokenPayload: (token: string) => JwtPayload | null | string;
|
|
8
|
-
export { getDecodedJwtSignedTokenPayload };
|
|
9
|
-
//# sourceMappingURL=get-decoded-jwt-signed-token-payload.d.ts.map
|
package/dist/generic/src/authorization/jwt/verify/get-decoded-jwt-signed-token-payload.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-decoded-jwt-signed-token-payload.d.ts","sourceRoot":"","sources":["../../../../../../../generic/src/authorization/jwt/verify/get-decoded-jwt-signed-token-payload.ts"],"names":[],"mappings":"AAAA,OAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C;;;;GAIG;AACH,QAAA,MAAM,+BAA+B,UAAW,MAAM,KAAG,UAAU,GAAG,IAAI,GAAG,MAG5E,CAAC;AAEF,OAAO,EAAE,+BAA+B,EAAE,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getDecodedJwtSignedTokenPayload = void 0;
|
|
7
|
-
const jsonwebtoken_1 = __importDefault(require("jsonwebtoken"));
|
|
8
|
-
/**
|
|
9
|
-
* This function gets the decoded payload from a signed JWT token.
|
|
10
|
-
*
|
|
11
|
-
* @param token the token to get the payload from
|
|
12
|
-
*/
|
|
13
|
-
const getDecodedJwtSignedTokenPayload = (token) => {
|
|
14
|
-
const payload = jsonwebtoken_1.default.decode(token);
|
|
15
|
-
return payload;
|
|
16
|
-
};
|
|
17
|
-
exports.getDecodedJwtSignedTokenPayload = getDecodedJwtSignedTokenPayload;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import jwt from 'jsonwebtoken';
|
|
2
|
-
/**
|
|
3
|
-
* This verifies a JWT signed token with the given secret key or public key.
|
|
4
|
-
*
|
|
5
|
-
* @param tokenToVerify the jwt token to verify
|
|
6
|
-
* @param secretKey the secret key to verify the token with
|
|
7
|
-
* @param publicKey the public key to verify the token with
|
|
8
|
-
* @returns
|
|
9
|
-
*/
|
|
10
|
-
declare const verifyJwtSignedToken: (tokenToVerify: string, secretKey?: string, publicKey?: string) => string | jwt.JwtPayload;
|
|
11
|
-
export { verifyJwtSignedToken };
|
|
12
|
-
//# sourceMappingURL=verify-jwt-signed-token.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"verify-jwt-signed-token.d.ts","sourceRoot":"","sources":["../../../../../../../generic/src/authorization/jwt/verify/verify-jwt-signed-token.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,cAAc,CAAC;AAQ/B;;;;;;;GAOG;AACH,QAAA,MAAM,oBAAoB,kBACP,MAAM,cACT,MAAM,cACN,MAAM,KACnB,MAAM,GAAG,GAAG,CAAC,UAgBf,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|