@darco2903/auth-api 2.1.1 → 2.1.2
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/consts.d.ts +1 -0
- package/dist/consts.js +1 -0
- package/dist/server.js +2 -2
- package/package.json +1 -1
package/dist/consts.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { Algorithm } from "jsonwebtoken";
|
|
|
2
2
|
export declare const API_VERSION = "v2";
|
|
3
3
|
export declare const API_PATH_PREFIX = "/api/v2";
|
|
4
4
|
export declare const JWT_ALGORITHM: Algorithm;
|
|
5
|
+
export declare const JWT_ALGORITHMS: Algorithm[];
|
|
5
6
|
export declare const NAME_MIN_LENGTH = 3;
|
|
6
7
|
export declare const NAME_MAX_LENGTH = 32;
|
|
7
8
|
export declare const EMAIL_MAX_LENGTH = 255;
|
package/dist/consts.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export const API_VERSION = "v2";
|
|
2
2
|
export const API_PATH_PREFIX = `/api/${API_VERSION}`;
|
|
3
3
|
export const JWT_ALGORITHM = "ES256";
|
|
4
|
+
export const JWT_ALGORITHMS = [JWT_ALGORITHM, "RS256"];
|
|
4
5
|
export const NAME_MIN_LENGTH = 3;
|
|
5
6
|
export const NAME_MAX_LENGTH = 32;
|
|
6
7
|
export const EMAIL_MAX_LENGTH = 255;
|
package/dist/server.js
CHANGED
|
@@ -2,10 +2,10 @@ export * from "./common.js";
|
|
|
2
2
|
import jwt from "jsonwebtoken";
|
|
3
3
|
import { ResultAsync } from "neverthrow";
|
|
4
4
|
import { accessTokenDataDecodedSchema, } from "./types/index.js";
|
|
5
|
-
import { JWT_ALGORITHM } from "./consts.js";
|
|
5
|
+
import { JWT_ALGORITHM, JWT_ALGORITHMS } from "./consts.js";
|
|
6
6
|
export function JWTVerify(token, pubKey) {
|
|
7
7
|
return ResultAsync.fromPromise(new Promise((resolve, reject) => {
|
|
8
|
-
jwt.verify(token, pubKey, { algorithms:
|
|
8
|
+
jwt.verify(token, pubKey, { algorithms: JWT_ALGORITHMS }, (e, decoded) => {
|
|
9
9
|
if (e) {
|
|
10
10
|
reject({
|
|
11
11
|
name: e.name,
|