hapta 1.0.15 → 1.0.17

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.
@@ -98,8 +98,8 @@ type DecodeFn = (token: string) => Promise<any>;
98
98
  export type ServiceConfigs = {
99
99
  Authenticate: AuthenticateFn;
100
100
  Register: RegisterFn;
101
- Verify?: VerifyFn;
102
- Decode?:DecodeFn
101
+ Verify: VerifyFn;
102
+ Decode:DecodeFn
103
103
  };
104
104
 
105
105
  // ---
package/index.ts CHANGED
@@ -500,17 +500,18 @@ async function buildRequestContext(req: Request, headers: Headers): Promise<Cont
500
500
  const reqJSON = await req.json().catch(() => ({}));
501
501
 
502
502
  const authHeader = headers.get("Authorization");
503
- const token = authHeader?.startsWith("Bearer ") ? authHeader.split(" ")[1] : null;
503
+ const token = authHeader ? authHeader.trim() : null;
504
504
 
505
505
  let isAuthenticated = false;
506
506
  let principal: any = { isAuthenticated };
507
507
 
508
508
  if (token) {
509
509
  try {
510
- const validated = jwt.verify(token, config.Server.JWT_SECRET);
510
+ const validated = jwt.verify(token, config.Server.JWT_Secret);
511
511
  principal = { ...validated, isAuthenticated: true };
512
512
  isAuthenticated = true;
513
513
  } catch (error) {
514
+ console.log(error)
514
515
  isAuthenticated = false;
515
516
  }
516
517
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "bin": {
4
4
  "hapta": "./index.ts"
5
5
  },
6
- "version": "1.0.15",
6
+ "version": "1.0.17",
7
7
  "description": "modular, scalable, and feature-rich backend framework designed to extend Pocketbase with authentication, schema validation, caching, and tenant-based service orchestration.",
8
8
  "dependencies": {
9
9
  "jsonwebtoken": "^9.0.3",