@bool-ts/guard-sdk 1.1.0-beta.4 → 1.1.0-beta.5

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/package.json CHANGED
@@ -46,5 +46,5 @@
46
46
  "test": "bun --hot run __test/index.ts"
47
47
  },
48
48
  "types": "./dist/index.d.ts",
49
- "version": "1.1.0-beta.4"
49
+ "version": "1.1.0-beta.5"
50
50
  }
@@ -14,7 +14,7 @@ export class Guard implements IGuard {
14
14
  authState: TAuthState
15
15
  ) {
16
16
  const actionMetadataKeys = Reflect.getOwnMetadataKeys(
17
- routeModel.class.prototype,
17
+ routeModel.class,
18
18
  routeModel.funcName
19
19
  );
20
20
 
@@ -7,16 +7,23 @@ import {
7
7
  Inject,
8
8
  RequestHeaders
9
9
  } from "@bool-ts/core";
10
- import { object, string } from "zod/v4";
10
+ import { jwt, NEVER, object, string } from "zod/v4";
11
11
  import { Keys } from "../constants";
12
12
 
13
13
  const headersSchema = object({
14
14
  authorization: string()
15
15
  .startsWith("Bearer ")
16
- .min(24)
17
- .transform((value) => {
16
+ .transform((value, ctx) => {
18
17
  const [schema, token] = value.split(" ");
19
18
 
19
+ const jwtValidation = jwt().safeParse(token);
20
+
21
+ if (!jwtValidation.success) {
22
+ ctx.addIssue("Token must be match jsonwebtoken format.");
23
+
24
+ return NEVER;
25
+ }
26
+
20
27
  return Object.freeze({
21
28
  schema,
22
29
  token