@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.
- package/README.md +43 -3
- package/dist/browser-session.d.mts +1 -2
- package/dist/browser-session.d.ts +1 -2
- package/dist/browser-session.js +89 -68
- package/dist/browser-session.mjs +2 -1
- package/dist/browser.d.mts +2 -2
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +69 -7
- package/dist/browser.mjs +2 -2
- package/dist/{chunk-ZESHDJDU.mjs → chunk-EKTNEZIH.mjs} +5 -8
- package/dist/{chunk-JQRTY5MY.mjs → chunk-KGEPDXHU.mjs} +12 -8
- package/dist/{chunk-S3M2IXCE.mjs → chunk-RACIPVLD.mjs} +15 -9
- package/dist/chunk-UNYDG2L4.mjs +209 -0
- package/dist/{chunk-MDUHPQMM.mjs → chunk-W3F4JYGP.mjs} +8 -180
- package/dist/chunk-WQWBJSSS.mjs +119 -0
- package/dist/cli/index.js +21 -0
- package/dist/cli/index.mjs +1 -1
- package/dist/{client-DXbHb2ul.d.ts → client-DTX4hNdS.d.ts} +16 -21
- package/dist/{client-Dv4v92Mj.d.mts → client-vdh2a9fJ.d.mts} +16 -21
- package/dist/{doctor-OHJRZBBT.mjs → doctor-A5E7LSFW.mjs} +2 -1
- package/dist/{express-BZmF1llh.d.mts → express-A0-dWEMy.d.mts} +1 -1
- package/dist/{express-B4o3P8vK.d.ts → express-Bo_pJKHN.d.ts} +1 -1
- package/dist/express.d.mts +75 -5
- package/dist/express.d.ts +75 -5
- package/dist/express.js +353 -94
- package/dist/express.mjs +210 -12
- package/dist/fastify.js +153 -88
- package/dist/fastify.mjs +10 -9
- package/dist/hono.js +152 -88
- package/dist/hono.mjs +9 -9
- package/dist/index.d.mts +3 -4
- package/dist/index.d.ts +3 -4
- package/dist/index.js +148 -72
- package/dist/index.mjs +16 -12
- package/dist/mobile.d.mts +1 -2
- package/dist/mobile.d.ts +1 -2
- package/dist/mobile.js +89 -68
- package/dist/mobile.mjs +2 -1
- package/dist/next.d.mts +9 -0
- package/dist/next.d.ts +9 -0
- package/dist/next.js +164 -1649
- package/dist/next.mjs +13 -16
- package/dist/{publishableKey-B5DIK81A.d.mts → publishableKey-BaR0HoAH.d.mts} +10 -1
- package/dist/{publishableKey-B5DIK81A.d.ts → publishableKey-BaR0HoAH.d.ts} +10 -1
- package/dist/react.d.mts +35 -3
- package/dist/react.d.ts +35 -3
- package/dist/react.js +78 -18
- package/dist/react.mjs +14 -2
- package/dist/server/handlers.d.mts +2 -0
- package/dist/server/handlers.d.ts +2 -0
- package/dist/server/handlers.js +72 -17
- package/dist/server/handlers.mjs +3 -2
- package/dist/server.d.mts +2 -3
- package/dist/server.d.ts +2 -3
- package/dist/server.js +151 -89
- package/dist/server.mjs +7 -6
- package/dist/service.d.mts +1 -2
- package/dist/service.d.ts +1 -2
- package/dist/service.js +89 -68
- package/dist/service.mjs +2 -1
- package/dist/{signIn-CEMdUAwd.d.mts → signIn-Cd0P4y9d.d.mts} +9 -1
- package/dist/{signIn-VRNzlNyG.d.ts → signIn-DKakyzeu.d.ts} +9 -1
- package/package.json +3 -2
- package/dist/chunk-5WFR6Y33.mjs +0 -59
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
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 {
|
|
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.
|
|
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",
|
package/dist/chunk-5WFR6Y33.mjs
DELETED
|
@@ -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
|
-
};
|