@zjazj/server 0.0.6 → 0.0.7

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,13 +98,19 @@ function createVerifier(options) {
98
98
  });
99
99
  payload = result.payload;
100
100
  } catch (error) {
101
- if (error instanceof joseErrors.JWTExpired) throw new UnauthorizedError("token expired");
101
+ if (error instanceof joseErrors.JWTExpired) {
102
+ throw new UnauthorizedError("token expired", { code: "token_expired" });
103
+ }
102
104
  throw new UnauthorizedError("invalid token", { cause: error });
103
105
  }
104
106
  if (!options.audience && !hasOrganizationAudience(payload.aud)) {
105
107
  throw new UnauthorizedError("token audience is not an organization");
106
108
  }
107
- return userFromClaims(payload);
109
+ const user = userFromClaims(payload);
110
+ if (user.support && user.support.until <= Date.now() / 1e3) {
111
+ throw new UnauthorizedError("support session ended", { code: "support_ended" });
112
+ }
113
+ return user;
108
114
  }
109
115
  };
110
116
  }
package/dist/index.js CHANGED
@@ -17,7 +17,7 @@ import {
17
17
  supportFromClaims,
18
18
  userFromClaims,
19
19
  verifierFromEnv
20
- } from "./chunk-YSHW7Q4H.js";
20
+ } from "./chunk-EIZ24ILA.js";
21
21
  import {
22
22
  APP_ID_PATTERN,
23
23
  APP_NAME_PATTERN,
package/dist/testing.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createVerifier
3
- } from "./chunk-YSHW7Q4H.js";
3
+ } from "./chunk-EIZ24ILA.js";
4
4
  import "./chunk-UWDDQH25.js";
5
5
  import "./chunk-NMKEVYGN.js";
6
6
  import "./chunk-ERGI2X5S.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zjazj/server",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "Backend runtime for platform apps: auth, logging, tenant-safe database access and app assembly on Hono.",
5
5
  "type": "module",
6
6
  "license": "UNLICENSED",