@sylphx/sdk 0.19.2 → 0.19.3

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.
@@ -2841,11 +2841,14 @@ async function verifyAccessToken(token, options) {
2841
2841
  try {
2842
2842
  const jwk = await importJWK(key, "RS256");
2843
2843
  const { payload } = await jwtVerify(token, jwk, {
2844
- issuer: platformUrl
2844
+ issuer: platformUrl,
2845
+ ...options.audience !== void 0 ? { audience: options.audience } : {}
2845
2846
  });
2846
2847
  if (!isAccessTokenPayload(payload)) {
2847
2848
  throw new Error("Invalid token payload structure");
2848
2849
  }
2850
+ const cnfRaw = payload.cnf;
2851
+ const cnf = cnfRaw && typeof cnfRaw === "object" && "jkt" in cnfRaw ? { jkt: typeof cnfRaw.jkt === "string" ? cnfRaw.jkt : void 0 } : void 0;
2849
2852
  return {
2850
2853
  sub: payload.sub,
2851
2854
  pid: payload.pid,
@@ -2855,8 +2858,14 @@ async function verifyAccessToken(token, options) {
2855
2858
  email_verified: payload.email_verified,
2856
2859
  app_id: payload.app_id,
2857
2860
  role: payload.role,
2861
+ // Org context — preserved so downstream org-scoped authz works
2862
+ // (ADR-2062). Absent on plain user tokens.
2863
+ org_id: typeof payload.org_id === "string" ? payload.org_id : void 0,
2864
+ org_slug: typeof payload.org_slug === "string" ? payload.org_slug : void 0,
2865
+ org_role: typeof payload.org_role === "string" ? payload.org_role : void 0,
2858
2866
  iat: payload.iat,
2859
- exp: payload.exp
2867
+ exp: payload.exp,
2868
+ ...cnf ? { cnf } : {}
2860
2869
  };
2861
2870
  } catch (err) {
2862
2871
  lastError = err;