@iqauth/sdk 2.1.0 → 2.3.0

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.
Files changed (64) hide show
  1. package/README.md +43 -3
  2. package/dist/browser-session.d.mts +1 -2
  3. package/dist/browser-session.d.ts +1 -2
  4. package/dist/browser-session.js +89 -68
  5. package/dist/browser-session.mjs +2 -1
  6. package/dist/browser.d.mts +2 -2
  7. package/dist/browser.d.ts +2 -2
  8. package/dist/browser.js +69 -7
  9. package/dist/browser.mjs +2 -2
  10. package/dist/{chunk-ZESHDJDU.mjs → chunk-EKTNEZIH.mjs} +5 -8
  11. package/dist/{chunk-JQRTY5MY.mjs → chunk-KGEPDXHU.mjs} +12 -8
  12. package/dist/{chunk-S3M2IXCE.mjs → chunk-RACIPVLD.mjs} +15 -9
  13. package/dist/chunk-UNYDG2L4.mjs +209 -0
  14. package/dist/{chunk-MDUHPQMM.mjs → chunk-W3F4JYGP.mjs} +8 -180
  15. package/dist/chunk-WQWBJSSS.mjs +119 -0
  16. package/dist/cli/index.js +21 -0
  17. package/dist/cli/index.mjs +1 -1
  18. package/dist/{client-DXbHb2ul.d.ts → client-DTX4hNdS.d.ts} +16 -21
  19. package/dist/{client-Dv4v92Mj.d.mts → client-vdh2a9fJ.d.mts} +16 -21
  20. package/dist/{doctor-OHJRZBBT.mjs → doctor-A5E7LSFW.mjs} +2 -1
  21. package/dist/{express-BZmF1llh.d.mts → express-A0-dWEMy.d.mts} +1 -1
  22. package/dist/{express-B4o3P8vK.d.ts → express-Bo_pJKHN.d.ts} +1 -1
  23. package/dist/express.d.mts +75 -5
  24. package/dist/express.d.ts +75 -5
  25. package/dist/express.js +353 -94
  26. package/dist/express.mjs +210 -12
  27. package/dist/fastify.js +153 -88
  28. package/dist/fastify.mjs +10 -9
  29. package/dist/hono.js +152 -88
  30. package/dist/hono.mjs +9 -9
  31. package/dist/index.d.mts +3 -4
  32. package/dist/index.d.ts +3 -4
  33. package/dist/index.js +148 -72
  34. package/dist/index.mjs +16 -12
  35. package/dist/mobile.d.mts +1 -2
  36. package/dist/mobile.d.ts +1 -2
  37. package/dist/mobile.js +89 -68
  38. package/dist/mobile.mjs +2 -1
  39. package/dist/next.d.mts +9 -0
  40. package/dist/next.d.ts +9 -0
  41. package/dist/next.js +164 -1649
  42. package/dist/next.mjs +13 -16
  43. package/dist/{publishableKey-B5DIK81A.d.mts → publishableKey-BaR0HoAH.d.mts} +10 -1
  44. package/dist/{publishableKey-B5DIK81A.d.ts → publishableKey-BaR0HoAH.d.ts} +10 -1
  45. package/dist/react.d.mts +35 -3
  46. package/dist/react.d.ts +35 -3
  47. package/dist/react.js +78 -18
  48. package/dist/react.mjs +14 -2
  49. package/dist/server/handlers.d.mts +2 -0
  50. package/dist/server/handlers.d.ts +2 -0
  51. package/dist/server/handlers.js +72 -17
  52. package/dist/server/handlers.mjs +3 -2
  53. package/dist/server.d.mts +2 -3
  54. package/dist/server.d.ts +2 -3
  55. package/dist/server.js +151 -89
  56. package/dist/server.mjs +7 -6
  57. package/dist/service.d.mts +1 -2
  58. package/dist/service.d.ts +1 -2
  59. package/dist/service.js +89 -68
  60. package/dist/service.mjs +2 -1
  61. package/dist/{signIn-CEMdUAwd.d.mts → signIn-Cd0P4y9d.d.mts} +9 -1
  62. package/dist/{signIn-VRNzlNyG.d.ts → signIn-DKakyzeu.d.ts} +9 -1
  63. package/package.json +3 -2
  64. package/dist/chunk-5WFR6Y33.mjs +0 -59
@@ -1,4 +1,4 @@
1
- import { b as ParsedPublishableKey } from './publishableKey-B5DIK81A.mjs';
1
+ import { c as ParsedPublishableKey } from './publishableKey-BaR0HoAH.mjs';
2
2
  import { d as SessionUser, J as JwtClaims } from './types-Cxl3bQHt.mjs';
3
3
 
4
4
  /**
@@ -216,6 +216,14 @@ interface SignOutOptions {
216
216
  logoutPath?: string;
217
217
  /** Skip the network call to IQAuth and just clear the local session. */
218
218
  localOnly?: boolean;
219
+ /**
220
+ * Also clear the IQAuth single-sign-on session (the `iq_sso` cookie on the
221
+ * issuer host). When `true` (the default), the next visit to `/sign-in`
222
+ * will show the login form instead of silently resuming the prior session.
223
+ * Set to `false` to preserve SSO across other apps in the same IQAuth
224
+ * tenant (e.g. log out of one app but stay signed in to others).
225
+ */
226
+ endSsoSession?: boolean;
219
227
  }
220
228
  interface CallbackResult {
221
229
  ok: boolean;
@@ -1,4 +1,4 @@
1
- import { b as ParsedPublishableKey } from './publishableKey-B5DIK81A.js';
1
+ import { c as ParsedPublishableKey } from './publishableKey-BaR0HoAH.js';
2
2
  import { d as SessionUser, J as JwtClaims } from './types-Cxl3bQHt.js';
3
3
 
4
4
  /**
@@ -216,6 +216,14 @@ interface SignOutOptions {
216
216
  logoutPath?: string;
217
217
  /** Skip the network call to IQAuth and just clear the local session. */
218
218
  localOnly?: boolean;
219
+ /**
220
+ * Also clear the IQAuth single-sign-on session (the `iq_sso` cookie on the
221
+ * issuer host). When `true` (the default), the next visit to `/sign-in`
222
+ * will show the login form instead of silently resuming the prior session.
223
+ * Set to `false` to preserve SSO across other apps in the same IQAuth
224
+ * tenant (e.g. log out of one app but stay signed in to others).
225
+ */
226
+ endSsoSession?: boolean;
219
227
  }
220
228
  interface CallbackResult {
221
229
  ok: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iqauth/sdk",
3
- "version": "2.1.0",
3
+ "version": "2.3.0",
4
4
  "description": "TypeScript SDK for IQAuth — the canonical way for all IQ projects to integrate with IQAuthService",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -83,7 +83,8 @@
83
83
  "typecheck": "tsc --noEmit"
84
84
  },
85
85
  "dependencies": {
86
- "jsonwebtoken": "^9.0.2"
86
+ "jsonwebtoken": "^9.0.2",
87
+ "jose": "^4.15.9"
87
88
  },
88
89
  "peerDependencies": {
89
90
  "react": ">=18",
@@ -1,59 +0,0 @@
1
- import {
2
- __require
3
- } from "./chunk-Y6FXYEAI.mjs";
4
-
5
- // src/publishableKey.ts
6
- function b64urlEncode(input) {
7
- if (typeof btoa === "function") {
8
- const bytes = new TextEncoder().encode(input);
9
- let bin = "";
10
- for (let i = 0; i < bytes.byteLength; i++) bin += String.fromCharCode(bytes[i]);
11
- return btoa(bin).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, "");
12
- }
13
- const { Buffer } = __require("buffer");
14
- return Buffer.from(input, "utf8").toString("base64").replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/g, "");
15
- }
16
- function b64urlDecode(input) {
17
- const pad = input.length % 4 === 0 ? "" : "=".repeat(4 - input.length % 4);
18
- const normalized = input.replace(/-/g, "+").replace(/_/g, "/") + pad;
19
- if (typeof atob === "function") {
20
- const bin = atob(normalized);
21
- const bytes = new Uint8Array(bin.length);
22
- for (let i = 0; i < bin.length; i++) bytes[i] = bin.charCodeAt(i);
23
- return new TextDecoder().decode(bytes);
24
- }
25
- const { Buffer } = __require("buffer");
26
- return Buffer.from(normalized, "base64").toString("utf8");
27
- }
28
- function encodePublishableKey(mode, payload) {
29
- if (mode !== "test" && mode !== "live") throw new Error(`Invalid mode: ${mode}`);
30
- return `pk_${mode}_${b64urlEncode(JSON.stringify(payload))}`;
31
- }
32
- function parsePublishableKey(raw) {
33
- if (typeof raw !== "string") return null;
34
- const m = raw.match(/^pk_(test|live)_([A-Za-z0-9_-]+)$/);
35
- if (!m) return null;
36
- try {
37
- const json = JSON.parse(b64urlDecode(m[2]));
38
- if (!json || typeof json !== "object") return null;
39
- if (typeof json.iss !== "string" || typeof json.appId !== "string" || typeof json.tenantId !== "string" || typeof json.kid !== "string") {
40
- return null;
41
- }
42
- return { mode: m[1], iss: json.iss, appId: json.appId, tenantId: json.tenantId, kid: json.kid, raw };
43
- } catch {
44
- return null;
45
- }
46
- }
47
- function isPublishableKey(raw) {
48
- return typeof raw === "string" && /^pk_(test|live)_/.test(raw);
49
- }
50
- function isSecretKey(raw) {
51
- return typeof raw === "string" && /^sk_(test|live)_/.test(raw);
52
- }
53
-
54
- export {
55
- encodePublishableKey,
56
- parsePublishableKey,
57
- isPublishableKey,
58
- isSecretKey
59
- };