@darco2903/cdn-api 1.1.1 → 1.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 CHANGED
@@ -2,4 +2,5 @@ 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 STORAGE_PUBLIC_ID_LENGTH = 8;
package/dist/consts.js CHANGED
@@ -1,4 +1,5 @@
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 STORAGE_PUBLIC_ID_LENGTH = 8;
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 { cdnAssetTokenDataDecodedSchema, } from "./common.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: [JWT_ALGORITHM] }, (e, decoded) => {
8
+ jwt.verify(token, pubKey, { algorithms: JWT_ALGORITHMS }, (e, decoded) => {
9
9
  if (e) {
10
10
  reject({
11
11
  name: e.name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@darco2903/cdn-api",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "type": "module",