@hanzo/iam 0.9.0 → 0.9.1

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 (71) hide show
  1. package/dist/auth.cjs +111 -0
  2. package/dist/auth.cjs.map +1 -0
  3. package/dist/auth.d.cts +19 -0
  4. package/dist/auth.d.ts +7 -4
  5. package/dist/auth.js +94 -121
  6. package/dist/auth.js.map +1 -1
  7. package/dist/betterauth.cjs +34 -0
  8. package/dist/betterauth.cjs.map +1 -0
  9. package/dist/betterauth.d.cts +64 -0
  10. package/dist/betterauth.d.ts +7 -10
  11. package/dist/betterauth.js +28 -62
  12. package/dist/betterauth.js.map +1 -1
  13. package/dist/billing.cjs +8 -0
  14. package/dist/billing.cjs.map +1 -0
  15. package/dist/billing.d.cts +2 -0
  16. package/dist/billing.d.ts +2 -16
  17. package/dist/billing.js +5 -17
  18. package/dist/billing.js.map +1 -1
  19. package/dist/browser.cjs +680 -0
  20. package/dist/browser.cjs.map +1 -0
  21. package/dist/browser.d.cts +217 -0
  22. package/dist/browser.d.ts +10 -7
  23. package/dist/browser.js +645 -663
  24. package/dist/browser.js.map +1 -1
  25. package/dist/index.cjs +1087 -0
  26. package/dist/index.cjs.map +1 -0
  27. package/dist/{client.d.ts → index.d.cts} +23 -4
  28. package/dist/index.d.ts +86 -23
  29. package/dist/index.js +1077 -29
  30. package/dist/index.js.map +1 -1
  31. package/dist/nextauth.cjs +35 -0
  32. package/dist/nextauth.cjs.map +1 -0
  33. package/dist/nextauth.d.cts +55 -0
  34. package/dist/nextauth.d.ts +4 -7
  35. package/dist/nextauth.js +30 -66
  36. package/dist/nextauth.js.map +1 -1
  37. package/dist/passport.cjs +49 -0
  38. package/dist/passport.cjs.map +1 -0
  39. package/dist/passport.d.cts +47 -0
  40. package/dist/passport.d.ts +8 -5
  41. package/dist/passport.js +45 -65
  42. package/dist/passport.js.map +1 -1
  43. package/dist/react.cjs +1434 -0
  44. package/dist/react.cjs.map +1 -0
  45. package/dist/react.d.cts +133 -0
  46. package/dist/react.d.ts +18 -50
  47. package/dist/react.js +1399 -494
  48. package/dist/react.js.map +1 -1
  49. package/dist/types.cjs +4 -0
  50. package/dist/types.cjs.map +1 -0
  51. package/dist/types.d.cts +219 -0
  52. package/dist/types.d.ts +25 -24
  53. package/dist/types.js +2 -5
  54. package/dist/types.js.map +1 -1
  55. package/package.json +24 -13
  56. package/dist/auth.d.ts.map +0 -1
  57. package/dist/betterauth.d.ts.map +0 -1
  58. package/dist/billing.d.ts.map +0 -1
  59. package/dist/browser.d.ts.map +0 -1
  60. package/dist/client.d.ts.map +0 -1
  61. package/dist/client.js +0 -292
  62. package/dist/client.js.map +0 -1
  63. package/dist/index.d.ts.map +0 -1
  64. package/dist/nextauth.d.ts.map +0 -1
  65. package/dist/passport.d.ts.map +0 -1
  66. package/dist/pkce.d.ts +0 -13
  67. package/dist/pkce.d.ts.map +0 -1
  68. package/dist/pkce.js +0 -36
  69. package/dist/pkce.js.map +0 -1
  70. package/dist/react.d.ts.map +0 -1
  71. package/dist/types.d.ts.map +0 -1
@@ -1,64 +1,30 @@
1
- /**
2
- * BetterAuth SSO provider configuration for IAM.
3
- *
4
- * Returns a provider config object compatible with BetterAuth's
5
- * `socialProviders` or generic OAuth plugin.
6
- *
7
- * @example
8
- * ```ts
9
- * import { betterAuth } from "better-auth";
10
- * import { iamProvider } from "@hanzo/iam/betterauth";
11
- *
12
- * export const auth = betterAuth({
13
- * socialProviders: [
14
- * iamProvider({
15
- * serverUrl: process.env.IAM_SERVER_URL!,
16
- * clientId: process.env.IAM_CLIENT_ID!,
17
- * clientSecret: process.env.IAM_CLIENT_SECRET!,
18
- * }),
19
- * ],
20
- * });
21
- * ```
22
- *
23
- * @packageDocumentation
24
- */
25
- /**
26
- * Create a BetterAuth-compatible social provider for IAM.
27
- *
28
- * Works with BetterAuth's SSO plugin or generic OAuth integration.
29
- * Uses standard OIDC endpoints.
30
- */
31
- export function iamProvider(config) {
32
- const baseUrl = config.serverUrl.replace(/\/+$/, "");
33
- return {
34
- id: "iam",
35
- name: "IAM",
36
- type: "oidc",
37
- issuer: baseUrl,
38
- clientId: config.clientId,
39
- clientSecret: config.clientSecret,
40
- authorization: {
41
- url: `${baseUrl}/oauth/authorize`,
42
- params: { scope: "openid profile email" },
43
- },
44
- token: { url: `${baseUrl}/oauth/token` },
45
- userinfo: { url: `${baseUrl}/oauth/userinfo` },
46
- profile(profile) {
47
- return {
48
- id: profile.sub ?? profile.id ?? "",
49
- name: profile.displayName ??
50
- profile.name ??
51
- profile.preferred_username ??
52
- "",
53
- email: profile.email ?? "",
54
- image: profile.avatar ?? profile.picture ?? null,
55
- };
56
- },
57
- };
1
+ // src/betterauth.ts
2
+ function iamProvider(config) {
3
+ const baseUrl = config.serverUrl.replace(/\/+$/, "");
4
+ return {
5
+ id: "iam",
6
+ name: "IAM",
7
+ type: "oidc",
8
+ issuer: baseUrl,
9
+ clientId: config.clientId,
10
+ clientSecret: config.clientSecret,
11
+ authorization: {
12
+ url: `${baseUrl}/oauth/authorize`,
13
+ params: { scope: "openid profile email" }
14
+ },
15
+ token: { url: `${baseUrl}/oauth/token` },
16
+ userinfo: { url: `${baseUrl}/oauth/userinfo` },
17
+ profile(profile) {
18
+ return {
19
+ id: profile.sub ?? profile.id ?? "",
20
+ name: profile.displayName ?? profile.name ?? profile.preferred_username ?? "",
21
+ email: profile.email ?? "",
22
+ image: profile.avatar ?? profile.picture ?? null
23
+ };
24
+ }
25
+ };
58
26
  }
59
- // Backwards-compatible aliases
60
- /** @deprecated Use iamProvider instead */
61
- export { iamProvider as hanzoIamProvider };
62
- /** @deprecated Use iamProvider instead */
63
- export { iamProvider as hanzoIamSocialProvider };
27
+
28
+ export { iamProvider as hanzoIamProvider, iamProvider as hanzoIamSocialProvider, iamProvider };
29
+ //# sourceMappingURL=betterauth.js.map
64
30
  //# sourceMappingURL=betterauth.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"betterauth.js","sourceRoot":"","sources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,MAAA,EACmB;AACnB,EAAA,MAAM,OAAA,GAAU,MAAA,CAAO,SAAA,CAAU,OAAA,CAAQ,QAAQ,EAAE,CAAA;AAEnD,EAAA,OAAO;AAAA,IACL,EAAA,EAAI,KAAA;AAAA,IACJ,IAAA,EAAM,KAAA;AAAA,IACN,IAAA,EAAM,MAAA;AAAA,IACN,MAAA,EAAQ,OAAA;AAAA,IACR,UAAU,MAAA,CAAO,QAAA;AAAA,IACjB,cAAc,MAAA,CAAO,YAAA;AAAA,IACrB,aAAA,EAAe;AAAA,MACb,GAAA,EAAK,GAAG,OAAO,CAAA,gBAAA,CAAA;AAAA,MACf,MAAA,EAAQ,EAAE,KAAA,EAAO,sBAAA;AAAuB,KAC1C;AAAA,IACA,KAAA,EAAO,EAAE,GAAA,EAAK,CAAA,EAAG,OAAO,CAAA,YAAA,CAAA,EAAe;AAAA,IACvC,QAAA,EAAU,EAAE,GAAA,EAAK,CAAA,EAAG,OAAO,CAAA,eAAA,CAAA,EAAkB;AAAA,IAC7C,QAAQ,OAAA,EAAkC;AACxC,MAAA,OAAO;AAAA,QACL,EAAA,EAAK,OAAA,CAAQ,GAAA,IAAmB,OAAA,CAAQ,EAAA,IAAiB,EAAA;AAAA,QACzD,MACG,OAAA,CAAQ,WAAA,IACR,OAAA,CAAQ,IAAA,IACR,QAAQ,kBAAA,IACT,EAAA;AAAA,QACF,KAAA,EAAQ,QAAQ,KAAA,IAAoB,EAAA;AAAA,QACpC,KAAA,EAAQ,OAAA,CAAQ,MAAA,IAAsB,OAAA,CAAQ,OAAA,IAAsB;AAAA,OACtE;AAAA,IACF;AAAA,GACF;AACF","file":"betterauth.js","sourcesContent":["/**\n * BetterAuth SSO provider configuration for IAM.\n *\n * Returns a provider config object compatible with BetterAuth's\n * `socialProviders` or generic OAuth plugin.\n *\n * @example\n * ```ts\n * import { betterAuth } from \"better-auth\";\n * import { iamProvider } from \"@hanzo/iam/betterauth\";\n *\n * export const auth = betterAuth({\n * socialProviders: [\n * iamProvider({\n * serverUrl: process.env.IAM_SERVER_URL!,\n * clientId: process.env.IAM_CLIENT_ID!,\n * clientSecret: process.env.IAM_CLIENT_SECRET!,\n * }),\n * ],\n * });\n * ```\n *\n * @packageDocumentation\n */\n\nimport type { IamConfig } from \"./types.js\";\n\nexport interface IamSocialProvider {\n id: string;\n name: string;\n type: \"oidc\";\n issuer: string;\n clientId: string;\n clientSecret?: string;\n authorization: { url: string; params: { scope: string } };\n token: { url: string };\n userinfo: { url: string };\n profile: (profile: Record<string, unknown>) => {\n id: string;\n name: string;\n email: string;\n image: string | null;\n };\n}\n\n/**\n * Create a BetterAuth-compatible social provider for IAM.\n *\n * Works with BetterAuth's SSO plugin or generic OAuth integration.\n * Uses standard OIDC endpoints.\n */\nexport function iamProvider(\n config: IamConfig & { redirectUri?: string },\n): IamSocialProvider {\n const baseUrl = config.serverUrl.replace(/\\/+$/, \"\");\n\n return {\n id: \"iam\",\n name: \"IAM\",\n type: \"oidc\",\n issuer: baseUrl,\n clientId: config.clientId,\n clientSecret: config.clientSecret,\n authorization: {\n url: `${baseUrl}/oauth/authorize`,\n params: { scope: \"openid profile email\" },\n },\n token: { url: `${baseUrl}/oauth/token` },\n userinfo: { url: `${baseUrl}/oauth/userinfo` },\n profile(profile: Record<string, unknown>) {\n return {\n id: (profile.sub as string) ?? (profile.id as string) ?? \"\",\n name:\n (profile.displayName as string) ??\n (profile.name as string) ??\n (profile.preferred_username as string) ??\n \"\",\n email: (profile.email as string) ?? \"\",\n image: (profile.avatar as string) ?? (profile.picture as string) ?? null,\n };\n },\n };\n}\n\n// Backwards-compatible aliases\n/** @deprecated Use iamProvider instead */\nexport { iamProvider as hanzoIamProvider };\n/** @deprecated Use iamProvider instead */\nexport { iamProvider as hanzoIamSocialProvider };\n/** @deprecated Use IamSocialProvider instead */\nexport type { IamSocialProvider as HanzoIamSocialProvider };\n"]}
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ // src/billing.ts
4
+ throw new Error(
5
+ "@hanzo/iam/billing has been removed. Use @hanzo/commerce or commerce.js instead. See: https://docs.hanzo.ai/services/commerce/sdk"
6
+ );
7
+ //# sourceMappingURL=billing.cjs.map
8
+ //# sourceMappingURL=billing.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/billing.ts"],"names":[],"mappings":";;;AAeA,MAAM,IAAI,KAAA;AAAA,EACR;AAEF,CAAA","file":"billing.cjs","sourcesContent":["/**\n * @hanzo/iam/billing — REMOVED\n *\n * Billing has moved to @hanzo/commerce (or commerce.js).\n *\n * ```ts\n * // Use this instead:\n * import { Commerce } from '@hanzo/commerce'\n * const commerce = new Commerce({ commerceUrl: '...' })\n * await commerce.getBalance(userId)\n * ```\n *\n * @deprecated This module is no longer functional. Use @hanzo/commerce.\n */\n\nthrow new Error(\n '@hanzo/iam/billing has been removed. Use @hanzo/commerce or commerce.js instead. ' +\n 'See: https://docs.hanzo.ai/services/commerce/sdk'\n)\n"]}
@@ -0,0 +1,2 @@
1
+
2
+ export { }
package/dist/billing.d.ts CHANGED
@@ -1,16 +1,2 @@
1
- /**
2
- * @hanzo/iam/billing — REMOVED
3
- *
4
- * Billing has moved to @hanzo/commerce (or commerce.js).
5
- *
6
- * ```ts
7
- * // Use this instead:
8
- * import { Commerce } from '@hanzo/commerce'
9
- * const commerce = new Commerce({ commerceUrl: '...' })
10
- * await commerce.getBalance(userId)
11
- * ```
12
- *
13
- * @deprecated This module is no longer functional. Use @hanzo/commerce.
14
- */
15
- export {};
16
- //# sourceMappingURL=billing.d.ts.map
1
+
2
+ export { }
package/dist/billing.js CHANGED
@@ -1,18 +1,6 @@
1
- /**
2
- * @hanzo/iam/billing — REMOVED
3
- *
4
- * Billing has moved to @hanzo/commerce (or commerce.js).
5
- *
6
- * ```ts
7
- * // Use this instead:
8
- * import { Commerce } from '@hanzo/commerce'
9
- * const commerce = new Commerce({ commerceUrl: '...' })
10
- * await commerce.getBalance(userId)
11
- * ```
12
- *
13
- * @deprecated This module is no longer functional. Use @hanzo/commerce.
14
- */
15
- throw new Error('@hanzo/iam/billing has been removed. Use @hanzo/commerce or commerce.js instead. ' +
16
- 'See: https://docs.hanzo.ai/services/commerce/sdk');
17
- export {};
1
+ // src/billing.ts
2
+ throw new Error(
3
+ "@hanzo/iam/billing has been removed. Use @hanzo/commerce or commerce.js instead. See: https://docs.hanzo.ai/services/commerce/sdk"
4
+ );
5
+ //# sourceMappingURL=billing.js.map
18
6
  //# sourceMappingURL=billing.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"billing.js","sourceRoot":"","sources":["../src/billing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,MAAM,IAAI,KAAK,CACb,mFAAmF;IACnF,kDAAkD,CACnD,CAAA"}
1
+ {"version":3,"sources":["../src/billing.ts"],"names":[],"mappings":";AAeA,MAAM,IAAI,KAAA;AAAA,EACR;AAEF,CAAA","file":"billing.js","sourcesContent":["/**\n * @hanzo/iam/billing — REMOVED\n *\n * Billing has moved to @hanzo/commerce (or commerce.js).\n *\n * ```ts\n * // Use this instead:\n * import { Commerce } from '@hanzo/commerce'\n * const commerce = new Commerce({ commerceUrl: '...' })\n * await commerce.getBalance(userId)\n * ```\n *\n * @deprecated This module is no longer functional. Use @hanzo/commerce.\n */\n\nthrow new Error(\n '@hanzo/iam/billing has been removed. Use @hanzo/commerce or commerce.js instead. ' +\n 'See: https://docs.hanzo.ai/services/commerce/sdk'\n)\n"]}