@celljs/jwt 3.0.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/node/index.js
CHANGED
|
@@ -1,21 +1,8 @@
|
|
|
1
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
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
|
|
18
|
-
__exportStar(require("./jwt-
|
|
19
|
-
__exportStar(require("./
|
|
20
|
-
__exportStar(require("./
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./jwt-protocol"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./jwt-service"), exports);
|
|
6
|
+
tslib_1.__exportStar(require("./errors"), exports);
|
|
7
|
+
tslib_1.__exportStar(require("./jwt-secret-service"), exports);
|
|
21
8
|
//# sourceMappingURL=index.js.map
|
package/lib/node/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":";;;AAAA,yDAA+B;AAC/B,wDAA8B;AAC9B,mDAAyB;AACzB,+DAAqC"}
|
|
@@ -1,15 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.jwtSecretService = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
13
5
|
const core_1 = require("@celljs/core");
|
|
14
6
|
const errors_1 = require("./errors");
|
|
15
7
|
const jwt_protocol_1 = require("./jwt-protocol");
|
|
@@ -31,11 +23,11 @@ let jwtSecretService = class jwtSecretService {
|
|
|
31
23
|
throw new errors_1.PrivateKeyNotFoundError();
|
|
32
24
|
}
|
|
33
25
|
};
|
|
34
|
-
__decorate([
|
|
26
|
+
tslib_1.__decorate([
|
|
35
27
|
(0, core_1.Value)('cell.jwt'),
|
|
36
|
-
__metadata("design:type", Object)
|
|
28
|
+
tslib_1.__metadata("design:type", Object)
|
|
37
29
|
], jwtSecretService.prototype, "jwtOptions", void 0);
|
|
38
|
-
jwtSecretService = __decorate([
|
|
30
|
+
jwtSecretService = tslib_1.__decorate([
|
|
39
31
|
(0, core_1.Component)(jwt_protocol_1.JwtSecretService)
|
|
40
32
|
], jwtSecretService);
|
|
41
33
|
exports.jwtSecretService = jwtSecretService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jwt-secret-service.js","sourceRoot":"","sources":["../../src/node/jwt-secret-service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"jwt-secret-service.js","sourceRoot":"","sources":["../../src/node/jwt-secret-service.ts"],"names":[],"mappings":";;;;AAAA,uCAAgD;AAChD,qCAA2E;AAC3E,iDAAsE;AAG/D,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAKzB,KAAK,CAAC,YAAY;;QACd,MAAM,MAAM,GAAG,MAAA,MAAA,IAAI,CAAC,UAAU,0CAAE,SAAS,mCAAI,MAAA,IAAI,CAAC,UAAU,0CAAE,MAAM,CAAC;QACrE,IAAI,MAAM,EAAE;YACR,OAAO,MAAM,CAAC;SACjB;QACD,MAAM,IAAI,+BAAsB,EAAE,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,aAAa;;QACf,MAAM,MAAM,GAAG,MAAA,MAAA,IAAI,CAAC,UAAU,0CAAE,UAAU,mCAAI,MAAA,IAAI,CAAC,UAAU,0CAAE,MAAM,CAAC;QACtE,IAAI,MAAM,EAAE;YACR,OAAO,MAAM,CAAC;SACjB;QACD,MAAM,IAAI,gCAAuB,EAAE,CAAC;IACxC,CAAC;CACJ,CAAA;AAlBG;IAAC,IAAA,YAAK,EAAC,UAAU,CAAC;;oDACyB;AAHlC,gBAAgB;IAD5B,IAAA,gBAAS,EAAC,+BAAgB,CAAC;GACf,gBAAgB,CAoB5B;AApBY,4CAAgB"}
|
package/lib/node/jwt-service.js
CHANGED
|
@@ -1,22 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.JwtServiceImpl = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
13
5
|
const core_1 = require("@celljs/core");
|
|
14
6
|
const jwt_protocol_1 = require("./jwt-protocol");
|
|
15
7
|
const jwt = require("jsonwebtoken");
|
|
16
8
|
let JwtServiceImpl = class JwtServiceImpl {
|
|
17
9
|
async sign(payload, options, privateKey) {
|
|
18
10
|
var _a;
|
|
19
|
-
const mergedOptions =
|
|
11
|
+
const mergedOptions = { ...(_a = this.jwtOptions) === null || _a === void 0 ? void 0 : _a.signOptions, ...options };
|
|
20
12
|
const secret = privateKey !== null && privateKey !== void 0 ? privateKey : await this.jwtSecretService.getPrivateKey();
|
|
21
13
|
return new Promise((resolve, reject) => {
|
|
22
14
|
jwt.sign(payload, secret, mergedOptions, (err, token) => {
|
|
@@ -31,7 +23,7 @@ let JwtServiceImpl = class JwtServiceImpl {
|
|
|
31
23
|
}
|
|
32
24
|
async verify(token, options, publicKey) {
|
|
33
25
|
var _a;
|
|
34
|
-
const mergedOptions =
|
|
26
|
+
const mergedOptions = { ...(_a = this.jwtOptions) === null || _a === void 0 ? void 0 : _a.verifyOptions, ...options };
|
|
35
27
|
const secret = publicKey !== null && publicKey !== void 0 ? publicKey : await this.jwtSecretService.getPublicKey();
|
|
36
28
|
return new Promise((resolve, reject) => {
|
|
37
29
|
jwt.verify(token, secret, mergedOptions, (err, decoded) => {
|
|
@@ -52,15 +44,15 @@ let JwtServiceImpl = class JwtServiceImpl {
|
|
|
52
44
|
return decoded;
|
|
53
45
|
}
|
|
54
46
|
};
|
|
55
|
-
__decorate([
|
|
47
|
+
tslib_1.__decorate([
|
|
56
48
|
(0, core_1.Value)('cell.jwt'),
|
|
57
|
-
__metadata("design:type", Object)
|
|
49
|
+
tslib_1.__metadata("design:type", Object)
|
|
58
50
|
], JwtServiceImpl.prototype, "jwtOptions", void 0);
|
|
59
|
-
__decorate([
|
|
51
|
+
tslib_1.__decorate([
|
|
60
52
|
(0, core_1.Autowired)(jwt_protocol_1.JwtSecretService),
|
|
61
|
-
__metadata("design:type", Object)
|
|
53
|
+
tslib_1.__metadata("design:type", Object)
|
|
62
54
|
], JwtServiceImpl.prototype, "jwtSecretService", void 0);
|
|
63
|
-
JwtServiceImpl = __decorate([
|
|
55
|
+
JwtServiceImpl = tslib_1.__decorate([
|
|
64
56
|
(0, core_1.Component)(jwt_protocol_1.JwtService)
|
|
65
57
|
], JwtServiceImpl);
|
|
66
58
|
exports.JwtServiceImpl = JwtServiceImpl;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jwt-service.js","sourceRoot":"","sources":["../../src/node/jwt-service.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"jwt-service.js","sourceRoot":"","sources":["../../src/node/jwt-service.ts"],"names":[],"mappings":";;;;AAAA,uCAA2D;AAC3D,iDAAyI;AACzI,oCAAoC;AAG7B,IAAM,cAAc,GAApB,MAAM,cAAc;IAQvB,KAAK,CAAC,IAAI,CAAC,OAAiC,EAAE,OAAqB,EAAE,UAAmB;;QACpF,MAAM,aAAa,GAAG,EAAE,GAAG,MAAA,IAAI,CAAC,UAAU,0CAAE,WAAW,EAAE,GAAG,OAAO,EAAE,CAAC;QACtE,MAAM,MAAM,GAAG,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,MAAM,IAAI,CAAC,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CAEJ,CAAA;AA1CG;IAAC,IAAA,YAAK,EAAC,UAAU,CAAC;;kDACyB;AAE3C;IAAC,IAAA,gBAAS,EAAC,+BAAgB,CAAC;;wDAC0B;AAN7C,cAAc;IAD1B,IAAA,gBAAS,EAAC,yBAAU,CAAC;GACT,cAAc,CA4C1B;AA5CY,wCAAc"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/jwt",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "lib/node/index.js",
|
|
6
6
|
"typings": "lib/node/index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@celljs/core": "3.
|
|
8
|
+
"@celljs/core": "3.1.0",
|
|
9
9
|
"jsonwebtoken": "^9.0.0"
|
|
10
10
|
},
|
|
11
11
|
"publishConfig": {
|
|
@@ -36,8 +36,8 @@
|
|
|
36
36
|
"test": "cell-component test:js"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@celljs/component": "3.
|
|
39
|
+
"@celljs/component": "3.1.0",
|
|
40
40
|
"@types/jsonwebtoken": "^8.5.8"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "6bb7168beaf93b3c54ef92ce51775e9603163444"
|
|
43
43
|
}
|