@dads-framework/identity-better-auth 0.0.0-stage → 0.2.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 (80) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +280 -2
  3. package/dist/identity-better-auth.tsbuildinfo +1 -0
  4. package/dist/impersonation-store/index.d.ts +3 -0
  5. package/dist/impersonation-store/index.d.ts.map +1 -0
  6. package/dist/impersonation-store/index.js +3 -0
  7. package/dist/impersonation-store/index.js.map +1 -0
  8. package/dist/impersonation-store/postgres-impersonation-store.d.ts +4 -0
  9. package/dist/impersonation-store/postgres-impersonation-store.d.ts.map +1 -0
  10. package/dist/impersonation-store/postgres-impersonation-store.js +75 -0
  11. package/dist/impersonation-store/postgres-impersonation-store.js.map +1 -0
  12. package/dist/index.d.ts +10 -0
  13. package/dist/index.d.ts.map +1 -0
  14. package/dist/index.js +9 -0
  15. package/dist/index.js.map +1 -0
  16. package/dist/lib/account-invitations.d.ts +7 -0
  17. package/dist/lib/account-invitations.d.ts.map +1 -0
  18. package/dist/lib/account-invitations.js +46 -0
  19. package/dist/lib/account-invitations.js.map +1 -0
  20. package/dist/lib/configure-better-auth.d.ts +1509 -0
  21. package/dist/lib/configure-better-auth.d.ts.map +1 -0
  22. package/dist/lib/configure-better-auth.js +85 -0
  23. package/dist/lib/configure-better-auth.js.map +1 -0
  24. package/dist/lib/create-better-auth-identity.d.ts +9 -0
  25. package/dist/lib/create-better-auth-identity.d.ts.map +1 -0
  26. package/dist/lib/create-better-auth-identity.js +37 -0
  27. package/dist/lib/create-better-auth-identity.js.map +1 -0
  28. package/dist/lib/enterprise-callback-context.d.ts +9 -0
  29. package/dist/lib/enterprise-callback-context.d.ts.map +1 -0
  30. package/dist/lib/enterprise-callback-context.js +9 -0
  31. package/dist/lib/enterprise-callback-context.js.map +1 -0
  32. package/dist/lib/enterprise-options.d.ts +31 -0
  33. package/dist/lib/enterprise-options.d.ts.map +1 -0
  34. package/dist/lib/enterprise-options.js +119 -0
  35. package/dist/lib/enterprise-options.js.map +1 -0
  36. package/dist/lib/enterprise-plugin.d.ts +1038 -0
  37. package/dist/lib/enterprise-plugin.d.ts.map +1 -0
  38. package/dist/lib/enterprise-plugin.js +211 -0
  39. package/dist/lib/enterprise-plugin.js.map +1 -0
  40. package/dist/lib/enterprise-routes.d.ts +5 -0
  41. package/dist/lib/enterprise-routes.d.ts.map +1 -0
  42. package/dist/lib/enterprise-routes.js +215 -0
  43. package/dist/lib/enterprise-routes.js.map +1 -0
  44. package/dist/lib/identity-email.d.ts +4 -0
  45. package/dist/lib/identity-email.d.ts.map +1 -0
  46. package/dist/lib/identity-email.js +15 -0
  47. package/dist/lib/identity-email.js.map +1 -0
  48. package/dist/lib/identity-handler.d.ts +9 -0
  49. package/dist/lib/identity-handler.d.ts.map +1 -0
  50. package/dist/lib/identity-handler.js +102 -0
  51. package/dist/lib/identity-handler.js.map +1 -0
  52. package/dist/lib/identity-options.d.ts +15 -0
  53. package/dist/lib/identity-options.d.ts.map +1 -0
  54. package/dist/lib/identity-options.js +17 -0
  55. package/dist/lib/identity-options.js.map +1 -0
  56. package/dist/lib/identity-session-readers.d.ts +23 -0
  57. package/dist/lib/identity-session-readers.d.ts.map +1 -0
  58. package/dist/lib/identity-session-readers.js +81 -0
  59. package/dist/lib/identity-session-readers.js.map +1 -0
  60. package/dist/lib/install-identity-schema-v2.d.ts +4 -0
  61. package/dist/lib/install-identity-schema-v2.d.ts.map +1 -0
  62. package/dist/lib/install-identity-schema-v2.js +8 -0
  63. package/dist/lib/install-identity-schema-v2.js.map +1 -0
  64. package/dist/lib/migrations/20261120070500_identity.migration.d.ts +5 -0
  65. package/dist/lib/migrations/20261120070500_identity.migration.d.ts.map +1 -0
  66. package/dist/lib/migrations/20261120070500_identity.migration.js +81 -0
  67. package/dist/lib/migrations/20261120070500_identity.migration.js.map +1 -0
  68. package/dist/lib/migrations/20261120070530_identity_jwks.migration.d.ts +5 -0
  69. package/dist/lib/migrations/20261120070530_identity_jwks.migration.d.ts.map +1 -0
  70. package/dist/lib/migrations/20261120070530_identity_jwks.migration.js +10 -0
  71. package/dist/lib/migrations/20261120070530_identity_jwks.migration.js.map +1 -0
  72. package/dist/lib/migrations/20261120070600_enterprise_sso.migration.d.ts +5 -0
  73. package/dist/lib/migrations/20261120070600_enterprise_sso.migration.d.ts.map +1 -0
  74. package/dist/lib/migrations/20261120070600_enterprise_sso.migration.js +33 -0
  75. package/dist/lib/migrations/20261120070600_enterprise_sso.migration.js.map +1 -0
  76. package/dist/lib/migrations/20261120070700_staff_impersonation.migration.d.ts +6 -0
  77. package/dist/lib/migrations/20261120070700_staff_impersonation.migration.d.ts.map +1 -0
  78. package/dist/lib/migrations/20261120070700_staff_impersonation.migration.js +37 -0
  79. package/dist/lib/migrations/20261120070700_staff_impersonation.migration.js.map +1 -0
  80. package/package.json +50 -4
@@ -0,0 +1,1038 @@
1
+ import { type SSOOptions, type SSOUserResolutionInput, type SSOUserResolution } from "@better-auth/sso";
2
+ import type { BetterAuthOptions } from "better-auth";
3
+ import { type EnterpriseSsoProvider } from "./enterprise-options.js";
4
+ export declare const OIDC_CALLBACK = "/sso/callback";
5
+ export declare const SAML_CALLBACK = "/sso/saml2/sp/acs";
6
+ export declare function enterpriseSsoPlugin(providers: readonly EnterpriseSsoProvider[], origin: string): {
7
+ id: "sso";
8
+ version: string;
9
+ endpoints: {
10
+ spMetadata: ReturnType<(options?: SSOOptions) => import("better-auth").StrictEndpoint<"/sso/saml2/sp/metadata", {
11
+ method: "GET";
12
+ query: import("better-auth").ZodObject<{
13
+ providerId: import("better-auth").ZodString;
14
+ }, import("zod/v4/core").$strip>;
15
+ metadata: {
16
+ openapi: {
17
+ operationId: string;
18
+ summary: string;
19
+ description: string;
20
+ responses: {
21
+ "200": {
22
+ description: string;
23
+ };
24
+ };
25
+ };
26
+ };
27
+ }, Response>>;
28
+ registerSSOProvider: import("better-auth").StrictEndpoint<"/sso/register", {
29
+ method: "POST";
30
+ body: import("better-auth").ZodObject<{
31
+ [x: string]: import("better-auth").ZodOptional<import("better-auth").ZodAny>;
32
+ }, import("zod/v4/core").$strip>;
33
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
34
+ session: {
35
+ session: Record<string, any> & {
36
+ id: string;
37
+ createdAt: Date;
38
+ updatedAt: Date;
39
+ userId: string;
40
+ expiresAt: Date;
41
+ token: string;
42
+ ipAddress?: string | null | undefined;
43
+ userAgent?: string | null | undefined;
44
+ };
45
+ user: Record<string, any> & {
46
+ id: string;
47
+ createdAt: Date;
48
+ updatedAt: Date;
49
+ email: string;
50
+ emailVerified: boolean;
51
+ name: string;
52
+ image?: string | null | undefined;
53
+ };
54
+ };
55
+ }>>[];
56
+ metadata: {
57
+ $Infer: {
58
+ body: {
59
+ [x: string]: any;
60
+ };
61
+ };
62
+ openapi: {
63
+ operationId: string;
64
+ summary: string;
65
+ description: string;
66
+ responses: {
67
+ "200": {
68
+ description: string;
69
+ content: {
70
+ "application/json": {
71
+ schema: {
72
+ type: "object";
73
+ properties: {
74
+ issuer: {
75
+ type: string;
76
+ format: string;
77
+ description: string;
78
+ };
79
+ domain: {
80
+ type: string;
81
+ description: string;
82
+ };
83
+ domainVerified: {
84
+ type: string;
85
+ description: string;
86
+ };
87
+ domainVerificationToken: {
88
+ type: string;
89
+ description: string;
90
+ };
91
+ oidcConfig: {
92
+ type: string;
93
+ properties: {
94
+ issuer: {
95
+ type: string;
96
+ format: string;
97
+ description: string;
98
+ };
99
+ pkce: {
100
+ type: string;
101
+ description: string;
102
+ };
103
+ clientId: {
104
+ type: string;
105
+ description: string;
106
+ };
107
+ clientSecret: {
108
+ type: string;
109
+ description: string;
110
+ };
111
+ authorizationEndpoint: {
112
+ type: string;
113
+ format: string;
114
+ nullable: boolean;
115
+ description: string;
116
+ };
117
+ discoveryEndpoint: {
118
+ type: string;
119
+ format: string;
120
+ description: string;
121
+ };
122
+ userInfoEndpoint: {
123
+ type: string;
124
+ format: string;
125
+ nullable: boolean;
126
+ description: string;
127
+ };
128
+ scopes: {
129
+ type: string;
130
+ items: {
131
+ type: string;
132
+ };
133
+ nullable: boolean;
134
+ description: string;
135
+ };
136
+ tokenEndpoint: {
137
+ type: string;
138
+ format: string;
139
+ nullable: boolean;
140
+ description: string;
141
+ };
142
+ tokenEndpointAuthentication: {
143
+ type: string;
144
+ enum: string[];
145
+ nullable: boolean;
146
+ description: string;
147
+ };
148
+ jwksEndpoint: {
149
+ type: string;
150
+ format: string;
151
+ nullable: boolean;
152
+ description: string;
153
+ };
154
+ mapping: {
155
+ type: string;
156
+ nullable: boolean;
157
+ properties: {
158
+ email: {
159
+ type: string;
160
+ description: string;
161
+ };
162
+ emailVerified: {
163
+ type: string;
164
+ nullable: boolean;
165
+ description: string;
166
+ };
167
+ name: {
168
+ type: string;
169
+ description: string;
170
+ };
171
+ image: {
172
+ type: string;
173
+ nullable: boolean;
174
+ description: string;
175
+ };
176
+ extraFields: {
177
+ type: string;
178
+ additionalProperties: {
179
+ type: string;
180
+ };
181
+ nullable: boolean;
182
+ description: string;
183
+ };
184
+ };
185
+ };
186
+ };
187
+ required: string[];
188
+ description: string;
189
+ };
190
+ organizationId: {
191
+ type: string;
192
+ nullable: boolean;
193
+ description: string;
194
+ };
195
+ userId: {
196
+ type: string;
197
+ description: string;
198
+ };
199
+ providerId: {
200
+ type: string;
201
+ description: string;
202
+ };
203
+ redirectURI: {
204
+ type: string;
205
+ format: string;
206
+ description: string;
207
+ };
208
+ };
209
+ required: string[];
210
+ };
211
+ };
212
+ };
213
+ };
214
+ };
215
+ };
216
+ };
217
+ }, {
218
+ redirectURI: string;
219
+ oidcConfig: import("@better-auth/sso").OIDCConfig | null;
220
+ samlConfig: import("@better-auth/sso").SAMLConfig | null;
221
+ } & Omit<{
222
+ domainVerified: boolean;
223
+ } & {
224
+ issuer: string;
225
+ oidcConfig?: import("@better-auth/sso").OIDCConfig | undefined;
226
+ samlConfig?: import("@better-auth/sso").SAMLConfig | undefined;
227
+ userId: string;
228
+ providerId: string;
229
+ organizationId?: string | undefined;
230
+ domain: string;
231
+ }, "oidcConfig" | "samlConfig"> & {
232
+ domainVerified: boolean;
233
+ domainVerificationToken: string;
234
+ }>;
235
+ signInSSO: ReturnType<(options?: SSOOptions) => import("better-auth").StrictEndpoint<"/sign-in/sso", {
236
+ method: "POST";
237
+ body: import("better-auth").ZodObject<{
238
+ email: import("better-auth").ZodOptional<import("better-auth").ZodString>;
239
+ organizationSlug: import("better-auth").ZodOptional<import("better-auth").ZodString>;
240
+ providerId: import("better-auth").ZodOptional<import("better-auth").ZodString>;
241
+ domain: import("better-auth").ZodOptional<import("better-auth").ZodString>;
242
+ callbackURL: import("better-auth").ZodString;
243
+ errorCallbackURL: import("better-auth").ZodOptional<import("better-auth").ZodString>;
244
+ newUserCallbackURL: import("better-auth").ZodOptional<import("better-auth").ZodString>;
245
+ scopes: import("better-auth").ZodOptional<import("better-auth").ZodArray<import("better-auth").ZodString>>;
246
+ loginHint: import("better-auth").ZodOptional<import("better-auth").ZodString>;
247
+ additionalParams: import("better-auth").ZodOptional<import("better-auth").ZodRecord<import("better-auth").ZodString, import("better-auth").ZodString>>;
248
+ requestSignUp: import("better-auth").ZodOptional<import("better-auth").ZodBoolean>;
249
+ providerType: import("better-auth").ZodOptional<import("better-auth").ZodEnum<{
250
+ saml: "saml";
251
+ oidc: "oidc";
252
+ }>>;
253
+ }, import("zod/v4/core").$strip>;
254
+ metadata: {
255
+ openapi: {
256
+ operationId: string;
257
+ summary: string;
258
+ description: string;
259
+ requestBody: {
260
+ content: {
261
+ "application/json": {
262
+ schema: {
263
+ type: "object";
264
+ properties: {
265
+ email: {
266
+ type: string;
267
+ description: string;
268
+ };
269
+ organizationSlug: {
270
+ type: string;
271
+ description: string;
272
+ };
273
+ providerId: {
274
+ type: string;
275
+ description: string;
276
+ };
277
+ domain: {
278
+ type: string;
279
+ description: string;
280
+ };
281
+ callbackURL: {
282
+ type: string;
283
+ description: string;
284
+ };
285
+ errorCallbackURL: {
286
+ type: string;
287
+ description: string;
288
+ };
289
+ newUserCallbackURL: {
290
+ type: string;
291
+ description: string;
292
+ };
293
+ scopes: {
294
+ type: string;
295
+ items: {
296
+ type: string;
297
+ };
298
+ description: string;
299
+ };
300
+ loginHint: {
301
+ type: string;
302
+ description: string;
303
+ };
304
+ additionalParams: {
305
+ type: string;
306
+ additionalProperties: {
307
+ type: string;
308
+ };
309
+ description: string;
310
+ };
311
+ requestSignUp: {
312
+ type: string;
313
+ description: string;
314
+ };
315
+ providerType: {
316
+ type: string;
317
+ enum: string[];
318
+ description: string;
319
+ };
320
+ };
321
+ required: string[];
322
+ };
323
+ };
324
+ };
325
+ };
326
+ responses: {
327
+ "200": {
328
+ description: string;
329
+ content: {
330
+ "application/json": {
331
+ schema: {
332
+ type: "object";
333
+ properties: {
334
+ url: {
335
+ type: string;
336
+ format: string;
337
+ description: string;
338
+ };
339
+ redirect: {
340
+ type: string;
341
+ description: string;
342
+ enum: boolean[];
343
+ };
344
+ };
345
+ required: string[];
346
+ };
347
+ };
348
+ };
349
+ };
350
+ };
351
+ };
352
+ };
353
+ }, {
354
+ url: string;
355
+ redirect: boolean;
356
+ }>>;
357
+ callbackSSO: ReturnType<(options?: SSOOptions) => import("better-auth").StrictEndpoint<"/sso/callback/:providerId", {
358
+ method: "GET";
359
+ query: import("better-auth").ZodObject<{
360
+ code: import("better-auth").ZodOptional<import("better-auth").ZodString>;
361
+ state: import("better-auth").ZodOptional<import("better-auth").ZodString>;
362
+ error: import("better-auth").ZodOptional<import("better-auth").ZodString>;
363
+ error_description: import("better-auth").ZodOptional<import("better-auth").ZodString>;
364
+ }, import("zod/v4/core").$strip>;
365
+ allowedMediaTypes: readonly ["application/x-www-form-urlencoded", "application/json"];
366
+ metadata: {
367
+ openapi: {
368
+ operationId: string;
369
+ summary: string;
370
+ description: string;
371
+ responses: {
372
+ "302": {
373
+ description: string;
374
+ };
375
+ };
376
+ };
377
+ scope: "server";
378
+ };
379
+ }, never>>;
380
+ callbackSSOShared: ReturnType<(options?: SSOOptions) => import("better-auth").StrictEndpoint<"/sso/callback", {
381
+ metadata: {
382
+ openapi: {
383
+ operationId: string;
384
+ summary: string;
385
+ description: string;
386
+ responses: {
387
+ "302": {
388
+ description: string;
389
+ };
390
+ };
391
+ };
392
+ scope: "server";
393
+ };
394
+ method: "GET";
395
+ query: import("better-auth").ZodObject<{
396
+ code: import("better-auth").ZodOptional<import("better-auth").ZodString>;
397
+ state: import("better-auth").ZodOptional<import("better-auth").ZodString>;
398
+ error: import("better-auth").ZodOptional<import("better-auth").ZodString>;
399
+ error_description: import("better-auth").ZodOptional<import("better-auth").ZodString>;
400
+ }, import("zod/v4/core").$strip>;
401
+ allowedMediaTypes: readonly ["application/x-www-form-urlencoded", "application/json"];
402
+ }, never>>;
403
+ acsEndpoint: ReturnType<(options?: SSOOptions) => import("better-auth").StrictEndpoint<"/sso/saml2/sp/acs/:providerId", {
404
+ method: ("GET" | "POST")[];
405
+ body: import("better-auth").ZodOptional<import("better-auth").ZodObject<{
406
+ SAMLResponse: import("better-auth").ZodString;
407
+ RelayState: import("better-auth").ZodOptional<import("better-auth").ZodString>;
408
+ }, import("zod/v4/core").$strip>>;
409
+ query: import("better-auth").ZodOptional<import("better-auth").ZodObject<{
410
+ RelayState: import("better-auth").ZodOptional<import("better-auth").ZodString>;
411
+ }, import("zod/v4/core").$strip>>;
412
+ metadata: {
413
+ allowedMediaTypes: string[];
414
+ openapi: {
415
+ operationId: string;
416
+ summary: string;
417
+ description: string;
418
+ responses: {
419
+ "302": {
420
+ description: string;
421
+ };
422
+ "400": {
423
+ description: string;
424
+ };
425
+ "404": {
426
+ description: string;
427
+ };
428
+ };
429
+ };
430
+ scope: "server";
431
+ };
432
+ }, never>>;
433
+ sloEndpoint: ReturnType<(options?: SSOOptions) => import("better-auth").StrictEndpoint<"/sso/saml2/sp/slo/:providerId", {
434
+ method: ("GET" | "POST")[];
435
+ body: import("better-auth").ZodOptional<import("better-auth").ZodObject<{
436
+ SAMLRequest: import("better-auth").ZodOptional<import("better-auth").ZodString>;
437
+ SAMLResponse: import("better-auth").ZodOptional<import("better-auth").ZodString>;
438
+ RelayState: import("better-auth").ZodOptional<import("better-auth").ZodString>;
439
+ SigAlg: import("better-auth").ZodOptional<import("better-auth").ZodString>;
440
+ Signature: import("better-auth").ZodOptional<import("better-auth").ZodString>;
441
+ }, import("zod/v4/core").$strip>>;
442
+ query: import("better-auth").ZodOptional<import("better-auth").ZodObject<{
443
+ SAMLRequest: import("better-auth").ZodOptional<import("better-auth").ZodString>;
444
+ SAMLResponse: import("better-auth").ZodOptional<import("better-auth").ZodString>;
445
+ RelayState: import("better-auth").ZodOptional<import("better-auth").ZodString>;
446
+ SigAlg: import("better-auth").ZodOptional<import("better-auth").ZodString>;
447
+ Signature: import("better-auth").ZodOptional<import("better-auth").ZodString>;
448
+ }, import("zod/v4/core").$strip>>;
449
+ metadata: {
450
+ allowedMediaTypes: string[];
451
+ scope: "server";
452
+ };
453
+ }, void | Response>>;
454
+ initiateSLO: ReturnType<(options?: SSOOptions) => import("better-auth").StrictEndpoint<"/sso/saml2/logout/:providerId", {
455
+ method: "POST";
456
+ body: import("better-auth").ZodObject<{
457
+ callbackURL: import("better-auth").ZodOptional<import("better-auth").ZodString>;
458
+ }, import("zod/v4/core").$strip>;
459
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
460
+ session: {
461
+ session: Record<string, any> & {
462
+ id: string;
463
+ createdAt: Date;
464
+ updatedAt: Date;
465
+ userId: string;
466
+ expiresAt: Date;
467
+ token: string;
468
+ ipAddress?: string | null | undefined;
469
+ userAgent?: string | null | undefined;
470
+ };
471
+ user: Record<string, any> & {
472
+ id: string;
473
+ createdAt: Date;
474
+ updatedAt: Date;
475
+ email: string;
476
+ emailVerified: boolean;
477
+ name: string;
478
+ image?: string | null | undefined;
479
+ };
480
+ };
481
+ }>>[];
482
+ metadata: {
483
+ readonly scope: "server";
484
+ };
485
+ }, never>>;
486
+ listSSOProviders: ReturnType<(options?: SSOOptions) => import("better-auth").StrictEndpoint<"/sso/providers", {
487
+ method: "GET";
488
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
489
+ session: {
490
+ session: Record<string, any> & {
491
+ id: string;
492
+ createdAt: Date;
493
+ updatedAt: Date;
494
+ userId: string;
495
+ expiresAt: Date;
496
+ token: string;
497
+ ipAddress?: string | null | undefined;
498
+ userAgent?: string | null | undefined;
499
+ };
500
+ user: Record<string, any> & {
501
+ id: string;
502
+ createdAt: Date;
503
+ updatedAt: Date;
504
+ email: string;
505
+ emailVerified: boolean;
506
+ name: string;
507
+ image?: string | null | undefined;
508
+ };
509
+ };
510
+ }>>[];
511
+ metadata: {
512
+ openapi: {
513
+ operationId: string;
514
+ summary: string;
515
+ description: string;
516
+ responses: {
517
+ "200": {
518
+ description: string;
519
+ };
520
+ };
521
+ };
522
+ };
523
+ }, {
524
+ providers: {
525
+ providerId: string;
526
+ type: string;
527
+ issuer: string;
528
+ domain: string;
529
+ organizationId: string | null;
530
+ domainVerified: boolean;
531
+ oidcConfig: {
532
+ discoveryEndpoint: string;
533
+ clientIdLastFour: string;
534
+ pkce: boolean;
535
+ authorizationEndpoint: string | undefined;
536
+ tokenEndpoint: string | undefined;
537
+ userInfoEndpoint: string | undefined;
538
+ jwksEndpoint: string | undefined;
539
+ scopes: string[] | undefined;
540
+ tokenEndpointAuthentication: "client_secret_post" | "client_secret_basic" | "private_key_jwt" | undefined;
541
+ } | undefined;
542
+ samlConfig: {
543
+ entryPoint: string;
544
+ callbackUrl: string | undefined;
545
+ idpInitiatedCallbackUrl: string | undefined;
546
+ audience: string | undefined;
547
+ wantAssertionsSigned: boolean | undefined;
548
+ authnRequestsSigned: boolean | undefined;
549
+ identifierFormat: string | undefined;
550
+ signatureAlgorithm: string | undefined;
551
+ digestAlgorithm: string | undefined;
552
+ certificate: ({
553
+ fingerprintSha256: string;
554
+ notBefore: string;
555
+ notAfter: string;
556
+ publicKeyAlgorithm: string;
557
+ } | {
558
+ error: string;
559
+ })[] | undefined;
560
+ } | undefined;
561
+ spMetadataUrl: string;
562
+ }[];
563
+ }>>;
564
+ getSSOProvider: ReturnType<(options?: SSOOptions) => import("better-auth").StrictEndpoint<"/sso/get-provider", {
565
+ method: "GET";
566
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
567
+ session: {
568
+ session: Record<string, any> & {
569
+ id: string;
570
+ createdAt: Date;
571
+ updatedAt: Date;
572
+ userId: string;
573
+ expiresAt: Date;
574
+ token: string;
575
+ ipAddress?: string | null | undefined;
576
+ userAgent?: string | null | undefined;
577
+ };
578
+ user: Record<string, any> & {
579
+ id: string;
580
+ createdAt: Date;
581
+ updatedAt: Date;
582
+ email: string;
583
+ emailVerified: boolean;
584
+ name: string;
585
+ image?: string | null | undefined;
586
+ };
587
+ };
588
+ }>>[];
589
+ query: import("better-auth").ZodObject<{
590
+ providerId: import("better-auth").ZodString;
591
+ }, import("zod/v4/core").$strip>;
592
+ metadata: {
593
+ openapi: {
594
+ operationId: string;
595
+ summary: string;
596
+ description: string;
597
+ responses: {
598
+ "200": {
599
+ description: string;
600
+ };
601
+ "404": {
602
+ description: string;
603
+ };
604
+ "403": {
605
+ description: string;
606
+ };
607
+ };
608
+ };
609
+ };
610
+ }, {
611
+ providerId: string;
612
+ type: string;
613
+ issuer: string;
614
+ domain: string;
615
+ organizationId: string | null;
616
+ domainVerified: boolean;
617
+ oidcConfig: {
618
+ discoveryEndpoint: string;
619
+ clientIdLastFour: string;
620
+ pkce: boolean;
621
+ authorizationEndpoint: string | undefined;
622
+ tokenEndpoint: string | undefined;
623
+ userInfoEndpoint: string | undefined;
624
+ jwksEndpoint: string | undefined;
625
+ scopes: string[] | undefined;
626
+ tokenEndpointAuthentication: "client_secret_post" | "client_secret_basic" | "private_key_jwt" | undefined;
627
+ } | undefined;
628
+ samlConfig: {
629
+ entryPoint: string;
630
+ callbackUrl: string | undefined;
631
+ idpInitiatedCallbackUrl: string | undefined;
632
+ audience: string | undefined;
633
+ wantAssertionsSigned: boolean | undefined;
634
+ authnRequestsSigned: boolean | undefined;
635
+ identifierFormat: string | undefined;
636
+ signatureAlgorithm: string | undefined;
637
+ digestAlgorithm: string | undefined;
638
+ certificate: ({
639
+ fingerprintSha256: string;
640
+ notBefore: string;
641
+ notAfter: string;
642
+ publicKeyAlgorithm: string;
643
+ } | {
644
+ error: string;
645
+ })[] | undefined;
646
+ } | undefined;
647
+ spMetadataUrl: string;
648
+ }>>;
649
+ updateSSOProvider: ReturnType<(options: SSOOptions) => import("better-auth").StrictEndpoint<"/sso/update-provider", {
650
+ method: "POST";
651
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
652
+ session: {
653
+ session: Record<string, any> & {
654
+ id: string;
655
+ createdAt: Date;
656
+ updatedAt: Date;
657
+ userId: string;
658
+ expiresAt: Date;
659
+ token: string;
660
+ ipAddress?: string | null | undefined;
661
+ userAgent?: string | null | undefined;
662
+ };
663
+ user: Record<string, any> & {
664
+ id: string;
665
+ createdAt: Date;
666
+ updatedAt: Date;
667
+ email: string;
668
+ emailVerified: boolean;
669
+ name: string;
670
+ image?: string | null | undefined;
671
+ };
672
+ };
673
+ }>>[];
674
+ body: import("better-auth").ZodObject<{
675
+ issuer: import("better-auth").ZodOptional<import("better-auth").ZodString>;
676
+ domain: import("better-auth").ZodOptional<import("better-auth").ZodString>;
677
+ oidcConfig: import("better-auth").ZodOptional<import("better-auth").ZodObject<{
678
+ clientId: import("better-auth").ZodOptional<import("better-auth").ZodString>;
679
+ clientSecret: import("better-auth").ZodOptional<import("better-auth").ZodOptional<import("better-auth").ZodString>>;
680
+ authorizationEndpoint: import("better-auth").ZodOptional<import("better-auth").ZodOptional<import("better-auth").ZodString>>;
681
+ tokenEndpoint: import("better-auth").ZodOptional<import("better-auth").ZodOptional<import("better-auth").ZodString>>;
682
+ userInfoEndpoint: import("better-auth").ZodOptional<import("better-auth").ZodOptional<import("better-auth").ZodString>>;
683
+ tokenEndpointAuthentication: import("better-auth").ZodOptional<import("better-auth").ZodOptional<import("better-auth").ZodEnum<{
684
+ client_secret_post: "client_secret_post";
685
+ client_secret_basic: "client_secret_basic";
686
+ private_key_jwt: "private_key_jwt";
687
+ }>>>;
688
+ privateKeyId: import("better-auth").ZodOptional<import("better-auth").ZodOptional<import("better-auth").ZodString>>;
689
+ privateKeyAlgorithm: import("better-auth").ZodOptional<import("better-auth").ZodOptional<import("better-auth").ZodString>>;
690
+ jwksEndpoint: import("better-auth").ZodOptional<import("better-auth").ZodOptional<import("better-auth").ZodString>>;
691
+ discoveryEndpoint: import("better-auth").ZodOptional<import("better-auth").ZodOptional<import("better-auth").ZodString>>;
692
+ skipDiscovery: import("better-auth").ZodOptional<import("better-auth").ZodOptional<import("better-auth").ZodBoolean>>;
693
+ scopes: import("better-auth").ZodOptional<import("better-auth").ZodOptional<import("better-auth").ZodArray<import("better-auth").ZodString>>>;
694
+ pkce: import("better-auth").ZodOptional<import("better-auth").ZodOptional<import("better-auth").ZodDefault<import("better-auth").ZodBoolean>>>;
695
+ overrideUserInfo: import("better-auth").ZodOptional<import("better-auth").ZodOptional<import("better-auth").ZodBoolean>>;
696
+ mapping: import("better-auth").ZodOptional<import("better-auth").ZodOptional<import("better-auth").ZodObject<{
697
+ email: import("better-auth").ZodOptional<import("better-auth").ZodString>;
698
+ emailVerified: import("better-auth").ZodOptional<import("better-auth").ZodString>;
699
+ name: import("better-auth").ZodOptional<import("better-auth").ZodString>;
700
+ image: import("better-auth").ZodOptional<import("better-auth").ZodString>;
701
+ extraFields: import("better-auth").ZodOptional<import("better-auth").ZodRecord<import("better-auth").ZodString, import("better-auth").ZodAny>>;
702
+ }, import("zod/v4/core").$strict>>>;
703
+ }, import("zod/v4/core").$strip>>;
704
+ samlConfig: import("better-auth").ZodOptional<import("better-auth").ZodObject<{
705
+ mapping: import("better-auth").ZodOptional<import("better-auth").ZodOptional<import("better-auth").ZodObject<{
706
+ email: import("better-auth").ZodOptional<import("better-auth").ZodString>;
707
+ emailVerified: import("better-auth").ZodOptional<import("better-auth").ZodString>;
708
+ name: import("better-auth").ZodOptional<import("better-auth").ZodString>;
709
+ firstName: import("better-auth").ZodOptional<import("better-auth").ZodString>;
710
+ lastName: import("better-auth").ZodOptional<import("better-auth").ZodString>;
711
+ extraFields: import("better-auth").ZodOptional<import("better-auth").ZodRecord<import("better-auth").ZodString, import("better-auth").ZodAny>>;
712
+ }, import("zod/v4/core").$strict>>>;
713
+ privateKey: import("better-auth").ZodOptional<import("better-auth").ZodOptional<import("better-auth").ZodString>>;
714
+ spMetadata: import("better-auth").ZodOptional<import("better-auth").ZodOptional<import("better-auth").ZodObject<{
715
+ metadata: import("better-auth").ZodOptional<import("better-auth").ZodString>;
716
+ entityID: import("better-auth").ZodOptional<import("better-auth").ZodString>;
717
+ binding: import("better-auth").ZodOptional<import("better-auth").ZodString>;
718
+ privateKey: import("better-auth").ZodOptional<import("better-auth").ZodString>;
719
+ privateKeyPass: import("better-auth").ZodOptional<import("better-auth").ZodString>;
720
+ isAssertionEncrypted: import("better-auth").ZodOptional<import("better-auth").ZodBoolean>;
721
+ encPrivateKey: import("better-auth").ZodOptional<import("better-auth").ZodString>;
722
+ encPrivateKeyPass: import("better-auth").ZodOptional<import("better-auth").ZodString>;
723
+ }, import("zod/v4/core").$strip>>>;
724
+ cert: import("better-auth").ZodOptional<import("better-auth").ZodOptional<import("better-auth").ZodUnion<readonly [import("better-auth").ZodString, import("better-auth").ZodArray<import("better-auth").ZodString>]>>>;
725
+ entryPoint: import("better-auth").ZodOptional<import("better-auth").ZodString>;
726
+ audience: import("better-auth").ZodOptional<import("better-auth").ZodOptional<import("better-auth").ZodString>>;
727
+ callbackUrl: import("better-auth").ZodOptional<import("better-auth").ZodOptional<import("better-auth").ZodString>>;
728
+ wantAssertionsSigned: import("better-auth").ZodOptional<import("better-auth").ZodOptional<import("better-auth").ZodBoolean>>;
729
+ authnRequestsSigned: import("better-auth").ZodOptional<import("better-auth").ZodOptional<import("better-auth").ZodBoolean>>;
730
+ signatureAlgorithm: import("better-auth").ZodOptional<import("better-auth").ZodOptional<import("better-auth").ZodString>>;
731
+ digestAlgorithm: import("better-auth").ZodOptional<import("better-auth").ZodOptional<import("better-auth").ZodString>>;
732
+ identifierFormat: import("better-auth").ZodOptional<import("better-auth").ZodOptional<import("better-auth").ZodString>>;
733
+ idpInitiatedCallbackUrl: import("better-auth").ZodOptional<import("better-auth").ZodNullable<import("better-auth").ZodString>>;
734
+ idpMetadata: import("better-auth").ZodOptional<import("better-auth").ZodObject<{
735
+ cert: import("better-auth").ZodOptional<import("better-auth").ZodUnion<readonly [import("better-auth").ZodString, import("better-auth").ZodArray<import("better-auth").ZodString>]>>;
736
+ privateKey: import("better-auth").ZodOptional<import("better-auth").ZodString>;
737
+ privateKeyPass: import("better-auth").ZodOptional<import("better-auth").ZodString>;
738
+ isAssertionEncrypted: import("better-auth").ZodOptional<import("better-auth").ZodBoolean>;
739
+ encPrivateKey: import("better-auth").ZodOptional<import("better-auth").ZodString>;
740
+ encPrivateKeyPass: import("better-auth").ZodOptional<import("better-auth").ZodString>;
741
+ singleSignOnService: import("better-auth").ZodOptional<import("better-auth").ZodArray<import("better-auth").ZodObject<{
742
+ Binding: import("better-auth").ZodString;
743
+ Location: import("better-auth").ZodString;
744
+ }, import("zod/v4/core").$strip>>>;
745
+ singleLogoutService: import("better-auth").ZodOptional<import("better-auth").ZodArray<import("better-auth").ZodObject<{
746
+ Binding: import("better-auth").ZodString;
747
+ Location: import("better-auth").ZodString;
748
+ }, import("zod/v4/core").$strip>>>;
749
+ metadata: import("better-auth").ZodOptional<import("better-auth").ZodString>;
750
+ entityID: import("better-auth").ZodOptional<import("better-auth").ZodString>;
751
+ }, import("zod/v4/core").$strip>>;
752
+ }, import("zod/v4/core").$strip>>;
753
+ providerId: import("better-auth").ZodString;
754
+ }, import("zod/v4/core").$strip>;
755
+ metadata: {
756
+ openapi: {
757
+ operationId: string;
758
+ summary: string;
759
+ description: string;
760
+ responses: {
761
+ "200": {
762
+ description: string;
763
+ };
764
+ "404": {
765
+ description: string;
766
+ };
767
+ "403": {
768
+ description: string;
769
+ };
770
+ };
771
+ };
772
+ };
773
+ }, {
774
+ providerId: string;
775
+ type: string;
776
+ issuer: string;
777
+ domain: string;
778
+ organizationId: string | null;
779
+ domainVerified: boolean;
780
+ oidcConfig: {
781
+ discoveryEndpoint: string;
782
+ clientIdLastFour: string;
783
+ pkce: boolean;
784
+ authorizationEndpoint: string | undefined;
785
+ tokenEndpoint: string | undefined;
786
+ userInfoEndpoint: string | undefined;
787
+ jwksEndpoint: string | undefined;
788
+ scopes: string[] | undefined;
789
+ tokenEndpointAuthentication: "client_secret_post" | "client_secret_basic" | "private_key_jwt" | undefined;
790
+ } | undefined;
791
+ samlConfig: {
792
+ entryPoint: string;
793
+ callbackUrl: string | undefined;
794
+ idpInitiatedCallbackUrl: string | undefined;
795
+ audience: string | undefined;
796
+ wantAssertionsSigned: boolean | undefined;
797
+ authnRequestsSigned: boolean | undefined;
798
+ identifierFormat: string | undefined;
799
+ signatureAlgorithm: string | undefined;
800
+ digestAlgorithm: string | undefined;
801
+ certificate: ({
802
+ fingerprintSha256: string;
803
+ notBefore: string;
804
+ notAfter: string;
805
+ publicKeyAlgorithm: string;
806
+ } | {
807
+ error: string;
808
+ })[] | undefined;
809
+ } | undefined;
810
+ spMetadataUrl: string;
811
+ }>>;
812
+ deleteSSOProvider: ReturnType<(options?: SSOOptions) => import("better-auth").StrictEndpoint<"/sso/delete-provider", {
813
+ method: "POST";
814
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
815
+ session: {
816
+ session: Record<string, any> & {
817
+ id: string;
818
+ createdAt: Date;
819
+ updatedAt: Date;
820
+ userId: string;
821
+ expiresAt: Date;
822
+ token: string;
823
+ ipAddress?: string | null | undefined;
824
+ userAgent?: string | null | undefined;
825
+ };
826
+ user: Record<string, any> & {
827
+ id: string;
828
+ createdAt: Date;
829
+ updatedAt: Date;
830
+ email: string;
831
+ emailVerified: boolean;
832
+ name: string;
833
+ image?: string | null | undefined;
834
+ };
835
+ };
836
+ }>>[];
837
+ body: import("better-auth").ZodObject<{
838
+ providerId: import("better-auth").ZodString;
839
+ }, import("zod/v4/core").$strip>;
840
+ metadata: {
841
+ openapi: {
842
+ operationId: string;
843
+ summary: string;
844
+ description: string;
845
+ responses: {
846
+ "200": {
847
+ description: string;
848
+ };
849
+ "404": {
850
+ description: string;
851
+ };
852
+ "403": {
853
+ description: string;
854
+ };
855
+ };
856
+ };
857
+ };
858
+ }, {
859
+ success: boolean;
860
+ }>>;
861
+ } & {
862
+ requestDomainVerification: ReturnType<(options: SSOOptions) => import("better-auth").StrictEndpoint<"/sso/request-domain-verification", {
863
+ method: "POST";
864
+ body: import("better-auth").ZodObject<{
865
+ providerId: import("better-auth").ZodString;
866
+ }, import("zod/v4/core").$strip>;
867
+ metadata: {
868
+ openapi: {
869
+ summary: string;
870
+ description: string;
871
+ responses: {
872
+ "404": {
873
+ description: string;
874
+ };
875
+ "409": {
876
+ description: string;
877
+ };
878
+ "201": {
879
+ description: string;
880
+ };
881
+ };
882
+ };
883
+ };
884
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
885
+ session: {
886
+ session: Record<string, any> & {
887
+ id: string;
888
+ createdAt: Date;
889
+ updatedAt: Date;
890
+ userId: string;
891
+ expiresAt: Date;
892
+ token: string;
893
+ ipAddress?: string | null | undefined;
894
+ userAgent?: string | null | undefined;
895
+ };
896
+ user: Record<string, any> & {
897
+ id: string;
898
+ createdAt: Date;
899
+ updatedAt: Date;
900
+ email: string;
901
+ emailVerified: boolean;
902
+ name: string;
903
+ image?: string | null | undefined;
904
+ };
905
+ };
906
+ }>>[];
907
+ }, {
908
+ domainVerificationToken: string;
909
+ }>>;
910
+ verifyDomain: ReturnType<(options: SSOOptions) => import("better-auth").StrictEndpoint<"/sso/verify-domain", {
911
+ method: "POST";
912
+ body: import("better-auth").ZodObject<{
913
+ providerId: import("better-auth").ZodString;
914
+ }, import("zod/v4/core").$strip>;
915
+ metadata: {
916
+ openapi: {
917
+ summary: string;
918
+ description: string;
919
+ responses: {
920
+ "404": {
921
+ description: string;
922
+ };
923
+ "409": {
924
+ description: string;
925
+ };
926
+ "502": {
927
+ description: string;
928
+ };
929
+ "204": {
930
+ description: string;
931
+ };
932
+ };
933
+ };
934
+ };
935
+ use: import("better-auth").Middleware<import("better-auth").MiddlewareOptions, (inputContext: import("better-auth").MiddlewareInputContext<import("better-auth").MiddlewareOptions>) => Promise<{
936
+ session: {
937
+ session: Record<string, any> & {
938
+ id: string;
939
+ createdAt: Date;
940
+ updatedAt: Date;
941
+ userId: string;
942
+ expiresAt: Date;
943
+ token: string;
944
+ ipAddress?: string | null | undefined;
945
+ userAgent?: string | null | undefined;
946
+ };
947
+ user: Record<string, any> & {
948
+ id: string;
949
+ createdAt: Date;
950
+ updatedAt: Date;
951
+ email: string;
952
+ emailVerified: boolean;
953
+ name: string;
954
+ image?: string | null | undefined;
955
+ };
956
+ };
957
+ }>>[];
958
+ }, void>>;
959
+ };
960
+ schema: {
961
+ ssoProvider: {
962
+ modelName: string;
963
+ fields: Record<string, import("better-auth").DBFieldAttribute>;
964
+ };
965
+ };
966
+ $Infer: {
967
+ SSOProvider: {
968
+ domainVerified: boolean;
969
+ } & {
970
+ issuer: string;
971
+ oidcConfig?: import("@better-auth/sso").OIDCConfig | undefined;
972
+ samlConfig?: import("@better-auth/sso").SAMLConfig | undefined;
973
+ userId: string;
974
+ providerId: string;
975
+ organizationId?: string | undefined;
976
+ domain: string;
977
+ };
978
+ };
979
+ options: NoInfer<{
980
+ modelName: string;
981
+ providersLimit: number;
982
+ redirectURI: string;
983
+ domainVerification: {
984
+ enabled: true;
985
+ };
986
+ organizationProvisioning: {
987
+ disabled: true;
988
+ };
989
+ trustEmailVerified: true;
990
+ saml: {
991
+ allowIdpInitiated: false;
992
+ enableInResponseToValidation: true;
993
+ requireTimestamps: true;
994
+ };
995
+ defaultSSO: ({
996
+ domain: string;
997
+ providerId: string;
998
+ oidcConfig: {
999
+ issuer: string;
1000
+ clientId: string;
1001
+ clientSecret: string;
1002
+ authorizationEndpoint: string;
1003
+ tokenEndpoint: string;
1004
+ jwksEndpoint: string;
1005
+ tokenEndpointAuthentication: "client_secret_basic" | "client_secret_post" | undefined;
1006
+ discoveryEndpoint: string;
1007
+ pkce: boolean;
1008
+ scopes: string[];
1009
+ };
1010
+ } | {
1011
+ domain: string;
1012
+ providerId: string;
1013
+ samlConfig: {
1014
+ issuer: string;
1015
+ entryPoint: string;
1016
+ cert: string;
1017
+ callbackUrl: string;
1018
+ idpMetadata: {
1019
+ entityID: string;
1020
+ cert: string;
1021
+ };
1022
+ spMetadata: {
1023
+ entityID: string;
1024
+ };
1025
+ wantAssertionsSigned: boolean;
1026
+ identifierFormat: string;
1027
+ mapping: {
1028
+ email: string | undefined;
1029
+ };
1030
+ };
1031
+ })[];
1032
+ resolveUser: (input: SSOUserResolutionInput, context: import("@better-auth/sso").SSOUserResolutionContext) => import("better-auth").Awaitable<SSOUserResolution>;
1033
+ guardProviderMutation: () => never;
1034
+ }>;
1035
+ };
1036
+ export declare function enterpriseDatabaseHooks(providers: readonly EnterpriseSsoProvider[]): NonNullable<BetterAuthOptions["databaseHooks"]>;
1037
+ export declare function forEmail(providers: readonly EnterpriseSsoProvider[], email: unknown): EnterpriseSsoProvider | undefined;
1038
+ //# sourceMappingURL=enterprise-plugin.d.ts.map