@bigso/auth-sdk 0.5.6 → 0.5.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.
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  verifySignedPayload
3
- } from "../chunk-PB3GVAEJ.js";
3
+ } from "../chunk-BXRGCGYR.js";
4
4
 
5
5
  // src/utils/crypto.ts
6
6
  async function sha256Base64Url(input) {
@@ -0,0 +1,34 @@
1
+ // src/utils/jws.ts
2
+ import { createRemoteJWKSet, jwtVerify } from "jose";
3
+ async function verifySignedPayload(token, jwksUrl, expectedAudience) {
4
+ const JWKS = createRemoteJWKSet(new URL(jwksUrl));
5
+ const { payload } = await jwtVerify(token, JWKS, {
6
+ audience: expectedAudience
7
+ });
8
+ return payload;
9
+ }
10
+ async function verifyAccessToken(accessToken, jwksUrl) {
11
+ const JWKS = createRemoteJWKSet(new URL(jwksUrl));
12
+ const { payload } = await jwtVerify(accessToken, JWKS);
13
+ if (!payload.sub || !payload.jti) {
14
+ throw new Error("Invalid token structure: missing sub or jti");
15
+ }
16
+ return {
17
+ sub: payload.sub,
18
+ jti: payload.jti,
19
+ iss: payload.iss,
20
+ aud: payload.aud || "",
21
+ exp: payload.exp,
22
+ iat: payload.iat,
23
+ tenants: payload.tenants || [],
24
+ tenantId: payload.tenantId || "",
25
+ systemRole: payload.systemRole || "user",
26
+ scope: payload.scope,
27
+ deviceFingerprint: payload.deviceFingerprint
28
+ };
29
+ }
30
+
31
+ export {
32
+ verifySignedPayload,
33
+ verifyAccessToken
34
+ };
@@ -47,6 +47,7 @@ async function verifyAccessToken(accessToken, jwksUrl) {
47
47
  exp: payload.exp,
48
48
  iat: payload.iat,
49
49
  tenants: payload.tenants || [],
50
+ tenantId: payload.tenantId || "",
50
51
  systemRole: payload.systemRole || "user",
51
52
  scope: payload.scope,
52
53
  deviceFingerprint: payload.deviceFingerprint
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  verifyAccessToken,
3
3
  verifySignedPayload
4
- } from "../chunk-PB3GVAEJ.js";
4
+ } from "../chunk-BXRGCGYR.js";
5
5
 
6
6
  // src/node/SsoClient.ts
7
7
  var BigsoSsoClient = class {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bigso/auth-sdk",
3
- "version": "0.5.6",
3
+ "version": "0.5.7",
4
4
  "description": "SDK de autenticación para SSO v2 - JWT Bearer + PKCE",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",