@hanzo/iam 0.8.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.
- package/dist/auth.cjs +111 -0
- package/dist/auth.cjs.map +1 -0
- package/dist/auth.d.cts +19 -0
- package/dist/auth.d.ts +7 -4
- package/dist/auth.js +94 -121
- package/dist/auth.js.map +1 -1
- package/dist/betterauth.cjs +34 -0
- package/dist/betterauth.cjs.map +1 -0
- package/dist/betterauth.d.cts +64 -0
- package/dist/betterauth.d.ts +7 -10
- package/dist/betterauth.js +28 -62
- package/dist/betterauth.js.map +1 -1
- package/dist/billing.cjs +8 -0
- package/dist/billing.cjs.map +1 -0
- package/dist/billing.d.cts +2 -0
- package/dist/billing.d.ts +2 -16
- package/dist/billing.js +5 -17
- package/dist/billing.js.map +1 -1
- package/dist/browser.cjs +680 -0
- package/dist/browser.cjs.map +1 -0
- package/dist/browser.d.cts +217 -0
- package/dist/browser.d.ts +16 -13
- package/dist/browser.js +645 -663
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +1087 -0
- package/dist/index.cjs.map +1 -0
- package/dist/{client.d.ts → index.d.cts} +23 -4
- package/dist/index.d.ts +86 -23
- package/dist/index.js +1077 -29
- package/dist/index.js.map +1 -1
- package/dist/nextauth.cjs +35 -0
- package/dist/nextauth.cjs.map +1 -0
- package/dist/nextauth.d.cts +55 -0
- package/dist/nextauth.d.ts +4 -7
- package/dist/nextauth.js +30 -66
- package/dist/nextauth.js.map +1 -1
- package/dist/passport.cjs +49 -0
- package/dist/passport.cjs.map +1 -0
- package/dist/passport.d.cts +47 -0
- package/dist/passport.d.ts +8 -5
- package/dist/passport.js +45 -65
- package/dist/passport.js.map +1 -1
- package/dist/react.cjs +1434 -0
- package/dist/react.cjs.map +1 -0
- package/dist/react.d.cts +133 -0
- package/dist/react.d.ts +19 -50
- package/dist/react.js +1399 -494
- package/dist/react.js.map +1 -1
- package/dist/types.cjs +4 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +219 -0
- package/dist/types.d.ts +25 -24
- package/dist/types.js +2 -5
- package/dist/types.js.map +1 -1
- package/package.json +24 -13
- package/src/browser.ts +13 -13
- package/src/react.ts +7 -6
- package/dist/auth.d.ts.map +0 -1
- package/dist/betterauth.d.ts.map +0 -1
- package/dist/billing.d.ts.map +0 -1
- package/dist/browser.d.ts.map +0 -1
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -292
- package/dist/client.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/nextauth.d.ts.map +0 -1
- package/dist/passport.d.ts.map +0 -1
- package/dist/pkce.d.ts +0 -13
- package/dist/pkce.d.ts.map +0 -1
- package/dist/pkce.js +0 -36
- package/dist/pkce.js.map +0 -1
- package/dist/react.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
package/dist/betterauth.js
CHANGED
|
@@ -1,64 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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
|
package/dist/betterauth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"sources":["../src/betterauth.ts"],"names":[],"mappings":";AAmDO,SAAS,YACd,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"]}
|
package/dist/billing.cjs
ADDED
|
@@ -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"]}
|
package/dist/billing.d.ts
CHANGED
|
@@ -1,16 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
package/dist/billing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
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"]}
|