@iqauth/sdk 2.0.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 (112) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +287 -0
  3. package/dist/browser-session.d.mts +12 -0
  4. package/dist/browser-session.d.ts +12 -0
  5. package/dist/browser-session.js +1812 -0
  6. package/dist/browser-session.mjs +28 -0
  7. package/dist/browser.d.mts +46 -0
  8. package/dist/browser.d.ts +46 -0
  9. package/dist/browser.js +768 -0
  10. package/dist/browser.mjs +47 -0
  11. package/dist/chunk-5HF3OBNO.mjs +189 -0
  12. package/dist/chunk-5WFR6Y33.mjs +59 -0
  13. package/dist/chunk-6I6RM4MN.mjs +51 -0
  14. package/dist/chunk-73R6BEGO.mjs +176 -0
  15. package/dist/chunk-E46DKOVI.mjs +632 -0
  16. package/dist/chunk-JQWYIIIS.mjs +1740 -0
  17. package/dist/chunk-X3K3WOBR.mjs +64 -0
  18. package/dist/chunk-Y6FXYEAI.mjs +10 -0
  19. package/dist/cli/index.d.mts +1 -0
  20. package/dist/cli/index.d.ts +1 -0
  21. package/dist/cli/index.js +581 -0
  22. package/dist/cli/index.mjs +57 -0
  23. package/dist/client-C1DXfB8Z.d.mts +911 -0
  24. package/dist/client-CggvJmmm.d.ts +911 -0
  25. package/dist/dev-FUTJZSWN.mjs +56 -0
  26. package/dist/doctor-OHJRZBBT.mjs +89 -0
  27. package/dist/errors-CDdl24MP.d.mts +52 -0
  28. package/dist/errors-CDdl24MP.d.ts +52 -0
  29. package/dist/express-BKAXB5Nl.d.ts +61 -0
  30. package/dist/express-CpfyYTmw.d.mts +61 -0
  31. package/dist/express.d.mts +45 -0
  32. package/dist/express.d.ts +45 -0
  33. package/dist/express.js +2252 -0
  34. package/dist/express.mjs +122 -0
  35. package/dist/fastify.d.mts +23 -0
  36. package/dist/fastify.d.ts +23 -0
  37. package/dist/fastify.js +2062 -0
  38. package/dist/fastify.mjs +118 -0
  39. package/dist/hono.d.mts +22 -0
  40. package/dist/hono.d.ts +22 -0
  41. package/dist/hono.js +2051 -0
  42. package/dist/hono.mjs +107 -0
  43. package/dist/index.d.mts +6 -0
  44. package/dist/index.d.ts +6 -0
  45. package/dist/index.js +2070 -0
  46. package/dist/index.mjs +83 -0
  47. package/dist/init-LLCSQGNL.mjs +198 -0
  48. package/dist/keys-NLWFAOEM.mjs +63 -0
  49. package/dist/mobile.d.mts +11 -0
  50. package/dist/mobile.d.ts +11 -0
  51. package/dist/mobile.js +1809 -0
  52. package/dist/mobile.mjs +25 -0
  53. package/dist/next.d.mts +37 -0
  54. package/dist/next.d.ts +37 -0
  55. package/dist/next.js +2078 -0
  56. package/dist/next.mjs +130 -0
  57. package/dist/publishableKey-B5DIK81A.d.mts +24 -0
  58. package/dist/publishableKey-B5DIK81A.d.ts +24 -0
  59. package/dist/react.d.mts +196 -0
  60. package/dist/react.d.ts +196 -0
  61. package/dist/react.js +1457 -0
  62. package/dist/react.mjs +787 -0
  63. package/dist/server/handlers.d.mts +96 -0
  64. package/dist/server/handlers.d.ts +96 -0
  65. package/dist/server/handlers.js +243 -0
  66. package/dist/server/handlers.mjs +14 -0
  67. package/dist/server.d.mts +14 -0
  68. package/dist/server.d.ts +14 -0
  69. package/dist/server.js +2195 -0
  70. package/dist/server.mjs +47 -0
  71. package/dist/service.d.mts +11 -0
  72. package/dist/service.d.ts +11 -0
  73. package/dist/service.js +1809 -0
  74. package/dist/service.mjs +25 -0
  75. package/dist/signIn-C8f6qVjD.d.mts +238 -0
  76. package/dist/signIn-Cy2lbEXb.d.ts +238 -0
  77. package/dist/types-Cxl3bQHt.d.mts +900 -0
  78. package/dist/types-Cxl3bQHt.d.ts +900 -0
  79. package/docs/APP_INTEGRATION_MATRIX.md +59 -0
  80. package/docs/BROWSER_SESSION_MIGRATION.md +69 -0
  81. package/docs/FRESH_IMPLEMENTATION_GUIDE.md +188 -0
  82. package/docs/TARBALL_RELEASE_WORKFLOW.md +98 -0
  83. package/docs/V1_TO_V2_UPGRADE_GUIDE.md +318 -0
  84. package/docs/guides/api-keys.md +130 -0
  85. package/docs/guides/app-registration.md +149 -0
  86. package/docs/guides/auth-flows.md +168 -0
  87. package/docs/guides/branding.md +160 -0
  88. package/docs/guides/entitlements.md +115 -0
  89. package/docs/guides/entity-hierarchy.md +200 -0
  90. package/docs/guides/error-handling.md +251 -0
  91. package/docs/guides/gdpr-compliance.md +123 -0
  92. package/docs/guides/invitations.md +143 -0
  93. package/docs/guides/mfa-enrollment.md +170 -0
  94. package/docs/guides/middleware-reference.md +205 -0
  95. package/docs/guides/mobile-native.md +110 -0
  96. package/docs/guides/roles-and-permissions.md +220 -0
  97. package/docs/guides/scoped-authorization.md +247 -0
  98. package/docs/guides/server-platform-integration.md +52 -0
  99. package/docs/guides/service-automation-integration.md +36 -0
  100. package/docs/guides/session-management.md +97 -0
  101. package/docs/guides/tenant-management.md +216 -0
  102. package/docs/guides/token-verification.md +178 -0
  103. package/docs/guides/user-management.md +184 -0
  104. package/docs/guides/webhooks.md +136 -0
  105. package/docs/integration-prompts/README.md +20 -0
  106. package/docs/integration-prompts/first-party-browser-app.md +29 -0
  107. package/docs/integration-prompts/install-from-tarball.md +41 -0
  108. package/docs/integration-prompts/migrate-from-local-packages-source.md +57 -0
  109. package/docs/integration-prompts/native-mobile-app.md +24 -0
  110. package/docs/integration-prompts/server-platform-app.md +20 -0
  111. package/docs/integration-prompts/service-automation-app.md +20 -0
  112. package/package.json +115 -0
@@ -0,0 +1,25 @@
1
+ import {
2
+ IQAuthClient
3
+ } from "./chunk-JQWYIIIS.mjs";
4
+ import {
5
+ ErrorCodes,
6
+ IQAuthError
7
+ } from "./chunk-6I6RM4MN.mjs";
8
+ import "./chunk-Y6FXYEAI.mjs";
9
+
10
+ // src/mobile.ts
11
+ var MobileIQAuthClient = class extends IQAuthClient {
12
+ constructor(config) {
13
+ super({ ...config, environment: "mobile" });
14
+ }
15
+ };
16
+ function createMobileClient(config) {
17
+ return new MobileIQAuthClient(config);
18
+ }
19
+ export {
20
+ ErrorCodes,
21
+ IQAuthClient,
22
+ IQAuthError,
23
+ MobileIQAuthClient,
24
+ createMobileClient
25
+ };
@@ -0,0 +1,37 @@
1
+ import { IQAuthHelperConfig } from './server/handlers.mjs';
2
+ import { J as JwtClaims } from './types-Cxl3bQHt.mjs';
3
+
4
+ /**
5
+ * @iqauth/sdk/next — Next.js (App Router) adapter.
6
+ *
7
+ * // app/middleware.ts
8
+ * export { middleware } from "@iqauth/sdk/next";
9
+ * export const config = { matcher: ["/((?!api/iqauth|_next/static|_next/image|favicon.ico).*)"] };
10
+ *
11
+ * // app/api/iqauth/[action]/route.ts
12
+ * import { handler } from "@iqauth/sdk/next";
13
+ * export const POST = handler({ publishableKey: process.env.IQAUTH_PUBLISHABLE_KEY!, secretKey: process.env.IQAUTH_SECRET_KEY! });
14
+ *
15
+ * // server component
16
+ * import { getAuth } from "@iqauth/sdk/next";
17
+ * const claims = await getAuth();
18
+ */
19
+
20
+ interface IQAuthNextOptions extends IQAuthHelperConfig {
21
+ /** Path prefix where the helper routes live. */
22
+ mountPath?: string;
23
+ }
24
+ declare function handler(options: IQAuthNextOptions): (req: Request) => Promise<Response>;
25
+ /**
26
+ * Edge-compatible Next.js middleware factory. Returns a function suitable
27
+ * for `export const middleware = createMiddleware({ ... })`.
28
+ */
29
+ declare function createMiddleware(options: IQAuthNextOptions): (req: Request) => Promise<Response | undefined>;
30
+ /**
31
+ * Server-component helper. Reads the access token from the request cookies
32
+ * via `next/headers` (must be called in a request scope). Returns `null`
33
+ * for unauthenticated requests.
34
+ */
35
+ declare function getAuth(options: IQAuthNextOptions): Promise<JwtClaims | null>;
36
+
37
+ export { type IQAuthNextOptions, createMiddleware, getAuth, handler };
package/dist/next.d.ts ADDED
@@ -0,0 +1,37 @@
1
+ import { IQAuthHelperConfig } from './server/handlers.js';
2
+ import { J as JwtClaims } from './types-Cxl3bQHt.js';
3
+
4
+ /**
5
+ * @iqauth/sdk/next — Next.js (App Router) adapter.
6
+ *
7
+ * // app/middleware.ts
8
+ * export { middleware } from "@iqauth/sdk/next";
9
+ * export const config = { matcher: ["/((?!api/iqauth|_next/static|_next/image|favicon.ico).*)"] };
10
+ *
11
+ * // app/api/iqauth/[action]/route.ts
12
+ * import { handler } from "@iqauth/sdk/next";
13
+ * export const POST = handler({ publishableKey: process.env.IQAUTH_PUBLISHABLE_KEY!, secretKey: process.env.IQAUTH_SECRET_KEY! });
14
+ *
15
+ * // server component
16
+ * import { getAuth } from "@iqauth/sdk/next";
17
+ * const claims = await getAuth();
18
+ */
19
+
20
+ interface IQAuthNextOptions extends IQAuthHelperConfig {
21
+ /** Path prefix where the helper routes live. */
22
+ mountPath?: string;
23
+ }
24
+ declare function handler(options: IQAuthNextOptions): (req: Request) => Promise<Response>;
25
+ /**
26
+ * Edge-compatible Next.js middleware factory. Returns a function suitable
27
+ * for `export const middleware = createMiddleware({ ... })`.
28
+ */
29
+ declare function createMiddleware(options: IQAuthNextOptions): (req: Request) => Promise<Response | undefined>;
30
+ /**
31
+ * Server-component helper. Reads the access token from the request cookies
32
+ * via `next/headers` (must be called in a request scope). Returns `null`
33
+ * for unauthenticated requests.
34
+ */
35
+ declare function getAuth(options: IQAuthNextOptions): Promise<JwtClaims | null>;
36
+
37
+ export { type IQAuthNextOptions, createMiddleware, getAuth, handler };