c2-http 1.0.98 → 1.0.99
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IJWTPayload } from "../../dto/IJWTPayload";
|
|
2
2
|
declare class GenerateTokenFlow {
|
|
3
|
-
execute(jwtPayload: IJWTPayload): string;
|
|
3
|
+
execute(jwtPayload: IJWTPayload, timeToExpireInMinutes?: number): string;
|
|
4
4
|
}
|
|
5
5
|
declare const _default: GenerateTokenFlow;
|
|
6
6
|
export default _default;
|
|
@@ -25,13 +25,13 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
const jwt = __importStar(require("jsonwebtoken"));
|
|
27
27
|
class GenerateTokenFlow {
|
|
28
|
-
execute(jwtPayload) {
|
|
28
|
+
execute(jwtPayload, timeToExpireInMinutes = 1080) {
|
|
29
29
|
if (!process.env.JWT_SECRET) {
|
|
30
30
|
throw new Error("key of token not found");
|
|
31
31
|
}
|
|
32
32
|
const now = new Date();
|
|
33
33
|
const exp = new Date(now);
|
|
34
|
-
exp.setMinutes(now.getMinutes() +
|
|
34
|
+
exp.setMinutes(now.getMinutes() + timeToExpireInMinutes);
|
|
35
35
|
const payload = {
|
|
36
36
|
iss: process.env.API_NAME,
|
|
37
37
|
iat: now.getTime(),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "c2-http",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.99",
|
|
4
4
|
"description": "Biblioteca Typescript para API NodeJS",
|
|
5
5
|
"repository": "https://cabralsilva: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@github.com/cabralsilva/c2-http.git",
|
|
6
6
|
"author": "Daniel Cabral <cabralconsultoriaemsoftware@gmail.com>",
|