create-sprint 0.0.64 → 0.0.66
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.
|
@@ -15,17 +15,14 @@ export const jwtValidateController: Handler = (req: SprintRequest, res: SprintRe
|
|
|
15
15
|
};
|
|
16
16
|
`;
|
|
17
17
|
}
|
|
18
|
-
return `
|
|
19
|
-
import { verifyEncrypted, getJwtFromEnv } from "sprint-es/jwt";
|
|
20
|
-
|
|
21
|
-
export const homeController = (req: SprintRequest, res: SprintResponse) => {
|
|
18
|
+
return `export const homeController = (req, res) => {
|
|
22
19
|
res.json({
|
|
23
20
|
message: "Hello World",
|
|
24
21
|
status: "ok"
|
|
25
22
|
});
|
|
26
23
|
};
|
|
27
24
|
|
|
28
|
-
export const jwtValidateController = (req
|
|
25
|
+
export const jwtValidateController = (req, res) => {
|
|
29
26
|
return res.json(req.custom.user);
|
|
30
27
|
};
|
|
31
28
|
`;
|
|
@@ -68,17 +65,19 @@ export const jwtGenerateController: Handler = (req: SprintRequest, res: SprintRe
|
|
|
68
65
|
`;
|
|
69
66
|
}
|
|
70
67
|
else {
|
|
71
|
-
return `import {
|
|
72
|
-
import { signEncrypted, getJwtFromEnv } from "sprint-es/jwt";
|
|
68
|
+
return `import { signEncrypted } from "sprint-es/jwt";
|
|
73
69
|
|
|
74
|
-
|
|
70
|
+
const privateKey = process.env.JWT_PRIVATE_KEY;
|
|
71
|
+
const encryptionSecret = process.env.JWT_ENCRYPTION_SECRET;
|
|
72
|
+
|
|
73
|
+
export const adminController = (req, res) => {
|
|
75
74
|
res.json({
|
|
76
75
|
message: "Admin Dashboard",
|
|
77
76
|
status: "ok"
|
|
78
77
|
});
|
|
79
78
|
};
|
|
80
79
|
|
|
81
|
-
export const adminUsersController = (req
|
|
80
|
+
export const adminUsersController = (req, res) => {
|
|
82
81
|
res.json({
|
|
83
82
|
users: [
|
|
84
83
|
{ id: 1, name: "John Doe", role: "admin" },
|
|
@@ -87,9 +86,7 @@ export const adminUsersController = (req: SprintRequest, res: SprintResponse) =>
|
|
|
87
86
|
});
|
|
88
87
|
};
|
|
89
88
|
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
export const jwtGenerateController = (req: SprintRequest, res: SprintResponse) => {
|
|
89
|
+
export const jwtGenerateController = (req, res) => {
|
|
93
90
|
const { userId, role } = req.body || {};
|
|
94
91
|
|
|
95
92
|
try {
|
|
@@ -69,9 +69,10 @@ export default defineMiddleware({
|
|
|
69
69
|
`;
|
|
70
70
|
}
|
|
71
71
|
return `import { defineMiddleware } from "sprint-es";
|
|
72
|
-
import { verifyEncrypted
|
|
72
|
+
import { verifyEncrypted } from "sprint-es/jwt";
|
|
73
73
|
|
|
74
|
-
const
|
|
74
|
+
const publicKey = process.env.JWT_PUBLIC_KEY;
|
|
75
|
+
const encryptionSecret = process.env.JWT_ENCRYPTION_SECRET;
|
|
75
76
|
|
|
76
77
|
export default defineMiddleware({
|
|
77
78
|
name: "userAuth",
|
package/package.json
CHANGED
|
@@ -15,17 +15,14 @@ export const jwtValidateController: Handler = (req: SprintRequest, res: SprintRe
|
|
|
15
15
|
};
|
|
16
16
|
`;
|
|
17
17
|
}
|
|
18
|
-
return `
|
|
19
|
-
import { verifyEncrypted, getJwtFromEnv } from "sprint-es/jwt";
|
|
20
|
-
|
|
21
|
-
export const homeController = (req: SprintRequest, res: SprintResponse) => {
|
|
18
|
+
return `export const homeController = (req, res) => {
|
|
22
19
|
res.json({
|
|
23
20
|
message: "Hello World",
|
|
24
21
|
status: "ok"
|
|
25
22
|
});
|
|
26
23
|
};
|
|
27
24
|
|
|
28
|
-
export const jwtValidateController = (req
|
|
25
|
+
export const jwtValidateController = (req, res) => {
|
|
29
26
|
return res.json(req.custom.user);
|
|
30
27
|
};
|
|
31
28
|
`;
|
|
@@ -67,17 +64,19 @@ export const jwtGenerateController: Handler = (req: SprintRequest, res: SprintRe
|
|
|
67
64
|
};
|
|
68
65
|
`;
|
|
69
66
|
} else {
|
|
70
|
-
return `import {
|
|
71
|
-
import { signEncrypted, getJwtFromEnv } from "sprint-es/jwt";
|
|
67
|
+
return `import { signEncrypted } from "sprint-es/jwt";
|
|
72
68
|
|
|
73
|
-
|
|
69
|
+
const privateKey = process.env.JWT_PRIVATE_KEY;
|
|
70
|
+
const encryptionSecret = process.env.JWT_ENCRYPTION_SECRET;
|
|
71
|
+
|
|
72
|
+
export const adminController = (req, res) => {
|
|
74
73
|
res.json({
|
|
75
74
|
message: "Admin Dashboard",
|
|
76
75
|
status: "ok"
|
|
77
76
|
});
|
|
78
77
|
};
|
|
79
78
|
|
|
80
|
-
export const adminUsersController = (req
|
|
79
|
+
export const adminUsersController = (req, res) => {
|
|
81
80
|
res.json({
|
|
82
81
|
users: [
|
|
83
82
|
{ id: 1, name: "John Doe", role: "admin" },
|
|
@@ -86,9 +85,7 @@ export const adminUsersController = (req: SprintRequest, res: SprintResponse) =>
|
|
|
86
85
|
});
|
|
87
86
|
};
|
|
88
87
|
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
export const jwtGenerateController = (req: SprintRequest, res: SprintResponse) => {
|
|
88
|
+
export const jwtGenerateController = (req, res) => {
|
|
92
89
|
const { userId, role } = req.body || {};
|
|
93
90
|
|
|
94
91
|
try {
|
|
@@ -69,9 +69,10 @@ export default defineMiddleware({
|
|
|
69
69
|
`;
|
|
70
70
|
}
|
|
71
71
|
return `import { defineMiddleware } from "sprint-es";
|
|
72
|
-
import { verifyEncrypted
|
|
72
|
+
import { verifyEncrypted } from "sprint-es/jwt";
|
|
73
73
|
|
|
74
|
-
const
|
|
74
|
+
const publicKey = process.env.JWT_PUBLIC_KEY;
|
|
75
|
+
const encryptionSecret = process.env.JWT_ENCRYPTION_SECRET;
|
|
75
76
|
|
|
76
77
|
export default defineMiddleware({
|
|
77
78
|
name: "userAuth",
|