@hammadj/better-auth-sso 1.5.0-beta.9

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 (42) hide show
  1. package/.turbo/turbo-build.log +116 -0
  2. package/LICENSE.md +20 -0
  3. package/dist/client.d.mts +10 -0
  4. package/dist/client.mjs +15 -0
  5. package/dist/client.mjs.map +1 -0
  6. package/dist/index.d.mts +738 -0
  7. package/dist/index.mjs +2953 -0
  8. package/dist/index.mjs.map +1 -0
  9. package/package.json +87 -0
  10. package/src/client.ts +29 -0
  11. package/src/constants.ts +58 -0
  12. package/src/domain-verification.test.ts +551 -0
  13. package/src/index.ts +265 -0
  14. package/src/linking/index.ts +2 -0
  15. package/src/linking/org-assignment.test.ts +325 -0
  16. package/src/linking/org-assignment.ts +176 -0
  17. package/src/linking/types.ts +10 -0
  18. package/src/oidc/discovery.test.ts +1157 -0
  19. package/src/oidc/discovery.ts +494 -0
  20. package/src/oidc/errors.ts +92 -0
  21. package/src/oidc/index.ts +31 -0
  22. package/src/oidc/types.ts +219 -0
  23. package/src/oidc.test.ts +688 -0
  24. package/src/providers.test.ts +1326 -0
  25. package/src/routes/domain-verification.ts +275 -0
  26. package/src/routes/providers.ts +565 -0
  27. package/src/routes/schemas.ts +96 -0
  28. package/src/routes/sso.ts +2750 -0
  29. package/src/saml/algorithms.test.ts +449 -0
  30. package/src/saml/algorithms.ts +338 -0
  31. package/src/saml/assertions.test.ts +239 -0
  32. package/src/saml/assertions.ts +62 -0
  33. package/src/saml/index.ts +13 -0
  34. package/src/saml/parser.ts +56 -0
  35. package/src/saml-state.ts +78 -0
  36. package/src/saml.test.ts +4319 -0
  37. package/src/types.ts +365 -0
  38. package/src/utils.test.ts +103 -0
  39. package/src/utils.ts +81 -0
  40. package/tsconfig.json +14 -0
  41. package/tsdown.config.ts +9 -0
  42. package/vitest.config.ts +3 -0
@@ -0,0 +1,116 @@
1
+
2
+ > @hammadj/better-auth-sso@1.5.0-beta.9 build /Users/hammadjutt/Dev/better-auth-fork/packages/sso
3
+ > tsdown
4
+
5
+ β„Ή tsdown v0.20.1 powered by rolldown v1.0.0-rc.1
6
+ β„Ή config file: /Users/hammadjutt/Dev/better-auth-fork/packages/sso/tsdown.config.ts
7
+ β„Ή entry: src/index.ts, src/client.ts
8
+ β„Ή tsconfig: tsconfig.json
9
+ β„Ή Build start
10
+ β„Ή Cleaning 5 files
11
+ β„Ή dist/index.mjs 120.85 kB β”‚ gzip: 24.06 kB
12
+ β„Ή dist/client.mjs  0.28 kB β”‚ gzip: 0.21 kB
13
+ β„Ή dist/index.mjs.map 244.11 kB β”‚ gzip: 46.78 kB
14
+ β„Ή dist/client.mjs.map  0.94 kB β”‚ gzip: 0.50 kB
15
+ β„Ή dist/index.d.mts  27.80 kB β”‚ gzip: 7.47 kB
16
+ β„Ή dist/client.d.mts  0.30 kB β”‚ gzip: 0.22 kB
17
+ β„Ή 6 files, total: 394.28 kB
18
+ src/index.ts (2:37) [UNRESOLVED_IMPORT] Warning: Could not resolve 'better-auth/api' in src/index.ts
19
+ β•­─[ src/index.ts:2:38 ]
20
+ β”‚
21
+ 2 β”‚ import { createAuthMiddleware } from "better-auth/api";
22
+  β”‚ ────────┬────────
23
+  β”‚ ╰────────── Module not found, treating it as an external dependency
24
+ ───╯
25
+
26
+ src/routes/providers.ts (6:7) [UNRESOLVED_IMPORT] Warning: Could not resolve 'better-auth/api' in src/routes/providers.ts
27
+ β•­─[ src/routes/providers.ts:6:8 ]
28
+ β”‚
29
+ 6 β”‚ } from "better-auth/api";
30
+  β”‚ ────────┬────────
31
+  β”‚ ╰────────── Module not found, treating it as an external dependency
32
+ ───╯
33
+
34
+ src/routes/sso.ts (16:7) [UNRESOLVED_IMPORT] Warning: Could not resolve 'better-auth/api' in src/routes/sso.ts
35
+ β•­─[ src/routes/sso.ts:16:8 ]
36
+ β”‚
37
+ 16 β”‚ } from "better-auth/api";
38
+  β”‚ ────────┬────────
39
+  β”‚ ╰────────── Module not found, treating it as an external dependency
40
+ ────╯
41
+
42
+ src/routes/sso.ts (17:33) [UNRESOLVED_IMPORT] Warning: Could not resolve 'better-auth/cookies' in src/routes/sso.ts
43
+ β•­─[ src/routes/sso.ts:17:34 ]
44
+ β”‚
45
+ 17 β”‚ import { setSessionCookie } from "better-auth/cookies";
46
+  β”‚ ──────────┬──────────
47
+  β”‚ ╰──────────── Module not found, treating it as an external dependency
48
+ ────╯
49
+
50
+ src/routes/sso.ts (18:37) [UNRESOLVED_IMPORT] Warning: Could not resolve 'better-auth/crypto' in src/routes/sso.ts
51
+ β•­─[ src/routes/sso.ts:18:38 ]
52
+ β”‚
53
+ 18 β”‚ import { generateRandomString } from "better-auth/crypto";
54
+  β”‚ ──────────┬─────────
55
+  β”‚ ╰─────────── Module not found, treating it as an external dependency
56
+ ────╯
57
+
58
+ src/routes/sso.ts (19:36) [UNRESOLVED_IMPORT] Warning: Could not resolve 'better-auth/oauth2' in src/routes/sso.ts
59
+ β•­─[ src/routes/sso.ts:19:37 ]
60
+ β”‚
61
+ 19 β”‚ import { handleOAuthUserInfo } from "better-auth/oauth2";
62
+  β”‚ ──────────┬─────────
63
+  β”‚ ╰─────────── Module not found, treating it as an external dependency
64
+ ────╯
65
+
66
+ src/routes/domain-verification.ts (6:7) [UNRESOLVED_IMPORT] Warning: Could not resolve 'better-auth/api' in src/routes/domain-verification.ts
67
+ β•­─[ src/routes/domain-verification.ts:6:8 ]
68
+ β”‚
69
+ 6 β”‚ } from "better-auth/api";
70
+  β”‚ ────────┬────────
71
+  β”‚ ╰────────── Module not found, treating it as an external dependency
72
+ ───╯
73
+
74
+ src/routes/domain-verification.ts (7:37) [UNRESOLVED_IMPORT] Warning: Could not resolve 'better-auth/crypto' in src/routes/domain-verification.ts
75
+ β•­─[ src/routes/domain-verification.ts:7:38 ]
76
+ β”‚
77
+ 7 β”‚ import { generateRandomString } from "better-auth/crypto";
78
+  β”‚ ──────────┬─────────
79
+  β”‚ ╰─────────── Module not found, treating it as an external dependency
80
+ ───╯
81
+
82
+ src/oidc/errors.ts (8:25) [UNRESOLVED_IMPORT] Warning: Could not resolve 'better-auth/api' in src/oidc/errors.ts
83
+ β•­─[ src/oidc/errors.ts:8:26 ]
84
+ β”‚
85
+ 8 β”‚ import { APIError } from "better-auth/api";
86
+  β”‚ ────────┬────────
87
+  β”‚ ╰────────── Module not found, treating it as an external dependency
88
+ ───╯
89
+
90
+ src/saml/assertions.ts (2:25) [UNRESOLVED_IMPORT] Warning: Could not resolve 'better-auth/api' in src/saml/assertions.ts
91
+ β•­─[ src/saml/assertions.ts:2:26 ]
92
+ β”‚
93
+ 2 β”‚ import { APIError } from "better-auth/api";
94
+  β”‚ ────────┬────────
95
+  β”‚ ╰────────── Module not found, treating it as an external dependency
96
+ ───╯
97
+
98
+ src/saml/algorithms.ts (1:25) [UNRESOLVED_IMPORT] Warning: Could not resolve 'better-auth/api' in src/saml/algorithms.ts
99
+ β•­─[ src/saml/algorithms.ts:1:26 ]
100
+ β”‚
101
+ 1 β”‚ import { APIError } from "better-auth/api";
102
+  β”‚ ────────┬────────
103
+  β”‚ ╰────────── Module not found, treating it as an external dependency
104
+ ───╯
105
+
106
+ src/saml-state.ts (3:37) [UNRESOLVED_IMPORT] Warning: Could not resolve 'better-auth/crypto' in src/saml-state.ts
107
+ β•­─[ src/saml-state.ts:3:38 ]
108
+ β”‚
109
+ 3 β”‚ import { generateRandomString } from "better-auth/crypto";
110
+  β”‚ ──────────┬─────────
111
+  β”‚ ╰─────────── Module not found, treating it as an external dependency
112
+ ───╯
113
+
114
+ [PLUGIN_TIMINGS] Warning: Your build spent significant time in plugin `rolldown-plugin-dts:generate`. See https://rolldown.rs/options/checks#plugintimings for more details.
115
+
116
+ βœ” Build complete in 13686ms
package/LICENSE.md ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License (MIT)
2
+ Copyright (c) 2024 - present, Bereket Engida
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
5
+ this software and associated documentation files (the β€œSoftware”), to deal in
6
+ the Software without restriction, including without limitation the rights to
7
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
8
+ the Software, and to permit persons to whom the Software is furnished to do so,
9
+ subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED β€œAS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19
+ ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20
+ DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,10 @@
1
+ //#region src/client.d.ts
2
+ interface SSOClientOptions {
3
+ domainVerification?: {
4
+ enabled: boolean;
5
+ } | undefined;
6
+ }
7
+ declare const ssoClient: <CO extends SSOClientOptions>(options?: CO | undefined) => BetterAuthClientPlugin;
8
+ //#endregion
9
+ export { ssoClient };
10
+ //# sourceMappingURL=client.d.mts.map
@@ -0,0 +1,15 @@
1
+ //#region src/client.ts
2
+ const ssoClient = (options) => {
3
+ return {
4
+ id: "sso-client",
5
+ $InferServerPlugin: {},
6
+ pathMethods: {
7
+ "/sso/providers": "GET",
8
+ "/sso/providers/:providerId": "GET"
9
+ }
10
+ };
11
+ };
12
+
13
+ //#endregion
14
+ export { ssoClient };
15
+ //# sourceMappingURL=client.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.mjs","names":[],"sources":["../src/client.ts"],"sourcesContent":["import type { BetterAuthClientPlugin } from \"better-auth/client\";\nimport type { SSOPlugin } from \"./index\";\n\ninterface SSOClientOptions {\n\tdomainVerification?:\n\t\t| {\n\t\t\t\tenabled: boolean;\n\t\t }\n\t\t| undefined;\n}\n\nexport const ssoClient = <CO extends SSOClientOptions>(\n\toptions?: CO | undefined,\n) => {\n\treturn {\n\t\tid: \"sso-client\",\n\t\t$InferServerPlugin: {} as SSOPlugin<{\n\t\t\tdomainVerification: {\n\t\t\t\tenabled: CO[\"domainVerification\"] extends { enabled: true }\n\t\t\t\t\t? true\n\t\t\t\t\t: false;\n\t\t\t};\n\t\t}>,\n\t\tpathMethods: {\n\t\t\t\"/sso/providers\": \"GET\",\n\t\t\t\"/sso/providers/:providerId\": \"GET\",\n\t\t},\n\t} satisfies BetterAuthClientPlugin;\n};\n"],"mappings":";AAWA,MAAa,aACZ,YACI;AACJ,QAAO;EACN,IAAI;EACJ,oBAAoB,EAAE;EAOtB,aAAa;GACZ,kBAAkB;GAClB,8BAA8B;GAC9B;EACD"}