better-auth 0.3.1 → 0.3.2
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/adapters/drizzle.d.ts +2 -2
- package/dist/adapters/mongodb.d.ts +2 -2
- package/dist/adapters/prisma.d.ts +2 -2
- package/dist/api.d.ts +2 -2
- package/dist/api.js +111 -17
- package/dist/cli.js +1 -1
- package/dist/client/plugins.d.ts +4 -4
- package/dist/client.d.ts +2 -2
- package/dist/{index-B-Rb8u6d.d.ts → index-8Ml1biZQ.d.ts} +2 -2
- package/dist/{index-JM-i6hLs.d.ts → index-BlnDgm2S.d.ts} +75 -31
- package/dist/{index-BRcc7HbO.d.ts → index-DHmaFGpa.d.ts} +45 -25
- package/dist/index.d.ts +2 -2
- package/dist/index.js +112 -18
- package/dist/next-js.d.ts +2 -2
- package/dist/node.d.ts +2 -2
- package/dist/plugins.d.ts +4 -4
- package/dist/plugins.js +115 -21
- package/dist/react.d.ts +2 -2
- package/dist/social.d.ts +1 -1
- package/dist/social.js +109 -15
- package/dist/solid-start.d.ts +2 -2
- package/dist/solid.d.ts +2 -2
- package/dist/svelte-kit.d.ts +2 -2
- package/dist/svelte.d.ts +2 -2
- package/dist/types.d.ts +4 -4
- package/dist/vue.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Db } from 'mongodb';
|
|
2
|
-
import { W as Where } from '../index-
|
|
2
|
+
import { W as Where } from '../index-DHmaFGpa.js';
|
|
3
3
|
import 'kysely';
|
|
4
|
-
import '../index-
|
|
4
|
+
import '../index-BlnDgm2S.js';
|
|
5
5
|
import 'arctic';
|
|
6
6
|
import 'zod';
|
|
7
7
|
import '../helper-DPDj8Nix.js';
|
package/dist/api.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export { f as AuthEndpoint, g as AuthMiddleware, n as callbackOAuth, L as changePassword, e as createAuthEndpoint, d as createAuthMiddleware, D as createEmailVerificationToken, V as csrfMiddleware, N as deleteUser, Q as error, y as forgetPassword, z as forgetPasswordCallback, O as getCSRFToken, l as getEndpoints, p as getSession, q as getSessionFromCtx, u as listSessions, T as ok, o as optionsMiddleware, C as resetPassword, v as revokeSession, w as revokeSessions, r as router, E as sendVerificationEmail, t as sessionMiddleware, M as setPassword, m as signInEmail, s as signInOAuth, x as signOut, U as signUpEmail, K as updateUser, J as verifyEmail } from './index-
|
|
1
|
+
export { f as AuthEndpoint, g as AuthMiddleware, n as callbackOAuth, L as changePassword, e as createAuthEndpoint, d as createAuthMiddleware, D as createEmailVerificationToken, V as csrfMiddleware, N as deleteUser, Q as error, y as forgetPassword, z as forgetPasswordCallback, O as getCSRFToken, l as getEndpoints, p as getSession, q as getSessionFromCtx, u as listSessions, T as ok, o as optionsMiddleware, C as resetPassword, v as revokeSession, w as revokeSessions, r as router, E as sendVerificationEmail, t as sessionMiddleware, M as setPassword, m as signInEmail, s as signInOAuth, x as signOut, U as signUpEmail, K as updateUser, J as verifyEmail } from './index-DHmaFGpa.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
import './helper-DPDj8Nix.js';
|
|
4
4
|
import 'better-call';
|
|
5
5
|
import 'kysely';
|
|
6
|
-
import './index-
|
|
6
|
+
import './index-BlnDgm2S.js';
|
|
7
7
|
import 'arctic';
|
|
8
8
|
import 'better-sqlite3';
|
|
9
9
|
import 'mysql2';
|
package/dist/api.js
CHANGED
|
@@ -156,6 +156,8 @@ function getBaseURL(url, path) {
|
|
|
156
156
|
|
|
157
157
|
// src/social-providers/utils.ts
|
|
158
158
|
import { betterFetch } from "@better-fetch/fetch";
|
|
159
|
+
import { sha256 as sha2562 } from "@noble/hashes/sha256";
|
|
160
|
+
import { base64url } from "oslo/encoding";
|
|
159
161
|
function getRedirectURI(providerId, redirectURI) {
|
|
160
162
|
return redirectURI || `${getBaseURL()}/callback/${providerId}`;
|
|
161
163
|
}
|
|
@@ -188,6 +190,27 @@ async function validateAuthorizationCode({
|
|
|
188
190
|
const tokens = new OAuth2Tokens(data);
|
|
189
191
|
return tokens;
|
|
190
192
|
}
|
|
193
|
+
function generateCodeChallenge(codeVerifier) {
|
|
194
|
+
const codeChallengeBytes = sha2562(new TextEncoder().encode(codeVerifier));
|
|
195
|
+
return base64url.encode(codeChallengeBytes, {
|
|
196
|
+
includePadding: false
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
function createAuthorizationURL(id, options, authorizationEndpoint, state, codeVerifier, scopes) {
|
|
200
|
+
const url = new URL(authorizationEndpoint);
|
|
201
|
+
url.searchParams.set("response_type", "code");
|
|
202
|
+
url.searchParams.set("client_id", options.clientId);
|
|
203
|
+
url.searchParams.set("state", state);
|
|
204
|
+
url.searchParams.set("scope", scopes.join(" "));
|
|
205
|
+
url.searchParams.set(
|
|
206
|
+
"redirect_uri",
|
|
207
|
+
options.redirectURI || getRedirectURI(id)
|
|
208
|
+
);
|
|
209
|
+
const codeChallenge = generateCodeChallenge(codeVerifier);
|
|
210
|
+
url.searchParams.set("code_challenge_method", "S256");
|
|
211
|
+
url.searchParams.set("code_challenge", codeChallenge);
|
|
212
|
+
return url;
|
|
213
|
+
}
|
|
191
214
|
|
|
192
215
|
// src/social-providers/apple.ts
|
|
193
216
|
var apple = (options) => {
|
|
@@ -196,7 +219,7 @@ var apple = (options) => {
|
|
|
196
219
|
id: "apple",
|
|
197
220
|
name: "Apple",
|
|
198
221
|
createAuthorizationURL({ state, scopes, redirectURI }) {
|
|
199
|
-
const _scope = scopes || ["email", "name", "openid"];
|
|
222
|
+
const _scope = options.scope || scopes || ["email", "name", "openid"];
|
|
200
223
|
return new URL(
|
|
201
224
|
`https://appleid.apple.com/auth/authorize?client_id=${options.clientId}&response_type=code&redirect_uri=${redirectURI || options.redirectURI}&scope=${_scope.join(" ")}&state=${state}`
|
|
202
225
|
);
|
|
@@ -235,7 +258,7 @@ var discord = (options) => {
|
|
|
235
258
|
id: "discord",
|
|
236
259
|
name: "Discord",
|
|
237
260
|
createAuthorizationURL({ state, scopes }) {
|
|
238
|
-
const _scopes = scopes || ["identify", "email"];
|
|
261
|
+
const _scopes = options.scope || scopes || ["identify", "email"];
|
|
239
262
|
return new URL(
|
|
240
263
|
`https://discord.com/api/oauth2/authorize?scope=${_scopes.join(
|
|
241
264
|
"+"
|
|
@@ -298,7 +321,7 @@ var facebook = (options) => {
|
|
|
298
321
|
id: "facebook",
|
|
299
322
|
name: "Facebook",
|
|
300
323
|
createAuthorizationURL({ state, scopes }) {
|
|
301
|
-
const _scopes = scopes || ["email", "public_profile"];
|
|
324
|
+
const _scopes = options.scope || scopes || ["email", "public_profile"];
|
|
302
325
|
return facebookArctic.createAuthorizationURL(state, _scopes);
|
|
303
326
|
},
|
|
304
327
|
validateAuthorizationCode: async (code, codeVerifier, redirectURI) => {
|
|
@@ -342,6 +365,7 @@ import { GitHub } from "arctic";
|
|
|
342
365
|
var github = ({
|
|
343
366
|
clientId,
|
|
344
367
|
clientSecret,
|
|
368
|
+
scope,
|
|
345
369
|
redirectURI
|
|
346
370
|
}) => {
|
|
347
371
|
const githubArctic = new GitHub(
|
|
@@ -353,7 +377,7 @@ var github = ({
|
|
|
353
377
|
id: "github",
|
|
354
378
|
name: "Github",
|
|
355
379
|
createAuthorizationURL({ state, scopes }) {
|
|
356
|
-
const _scopes = scopes || ["user:email"];
|
|
380
|
+
const _scopes = scope || scopes || ["user:email"];
|
|
357
381
|
return githubArctic.createAuthorizationURL(state, _scopes);
|
|
358
382
|
},
|
|
359
383
|
validateAuthorizationCode: async (state) => {
|
|
@@ -467,7 +491,7 @@ var google = (options) => {
|
|
|
467
491
|
if (!codeVerifier) {
|
|
468
492
|
throw new BetterAuthError("codeVerifier is required for Google");
|
|
469
493
|
}
|
|
470
|
-
const _scopes = scopes || ["email", "profile"];
|
|
494
|
+
const _scopes = options.scope || scopes || ["email", "profile"];
|
|
471
495
|
const url = googleArctic.createAuthorizationURL(
|
|
472
496
|
state,
|
|
473
497
|
codeVerifier,
|
|
@@ -503,8 +527,76 @@ var google = (options) => {
|
|
|
503
527
|
};
|
|
504
528
|
};
|
|
505
529
|
|
|
506
|
-
// src/social-providers/
|
|
530
|
+
// src/social-providers/microsoft-entra-id.ts
|
|
507
531
|
import { betterFetch as betterFetch6 } from "@better-fetch/fetch";
|
|
532
|
+
import { parseJWT as parseJWT3 } from "oslo/jwt";
|
|
533
|
+
var microsoft = (options) => {
|
|
534
|
+
const tenant = options.tenantId || "common";
|
|
535
|
+
const authorizationEndpoint = `https://login.microsoftonline.com/${tenant}/oauth2/v2.0/authorize`;
|
|
536
|
+
const tokenEndpoint = `https://login.microsoftonline.com/${tenant}/oauth2/v2.0/token`;
|
|
537
|
+
return {
|
|
538
|
+
id: "microsoft",
|
|
539
|
+
name: "Microsoft EntraID",
|
|
540
|
+
createAuthorizationURL(data) {
|
|
541
|
+
const scopes = options.scope || data.scopes || ["openid", "profile", "email", "User.Read"];
|
|
542
|
+
return createAuthorizationURL(
|
|
543
|
+
"microsoft",
|
|
544
|
+
options,
|
|
545
|
+
authorizationEndpoint,
|
|
546
|
+
data.state,
|
|
547
|
+
data.codeVerifier,
|
|
548
|
+
scopes
|
|
549
|
+
);
|
|
550
|
+
},
|
|
551
|
+
validateAuthorizationCode(code, codeVerifier, redirectURI) {
|
|
552
|
+
return validateAuthorizationCode({
|
|
553
|
+
code,
|
|
554
|
+
codeVerifier,
|
|
555
|
+
redirectURI: redirectURI || getRedirectURI("microsoft", options.redirectURI),
|
|
556
|
+
options,
|
|
557
|
+
tokenEndpoint
|
|
558
|
+
});
|
|
559
|
+
},
|
|
560
|
+
async getUserInfo(token) {
|
|
561
|
+
const user = parseJWT3(token.idToken())?.payload;
|
|
562
|
+
const profilePhotoSize = options.profilePhotoSize || 48;
|
|
563
|
+
await betterFetch6(
|
|
564
|
+
`https://graph.microsoft.com/v1.0/me/photos/${profilePhotoSize}x${profilePhotoSize}/$value`,
|
|
565
|
+
{
|
|
566
|
+
headers: {
|
|
567
|
+
Authorization: `Bearer ${token.accessToken()}`
|
|
568
|
+
},
|
|
569
|
+
async onResponse(context) {
|
|
570
|
+
if (options.disableProfilePhoto || !context.response.ok) {
|
|
571
|
+
return;
|
|
572
|
+
}
|
|
573
|
+
try {
|
|
574
|
+
const response = context.response.clone();
|
|
575
|
+
const pictureBuffer = await response.arrayBuffer();
|
|
576
|
+
const pictureBase64 = Buffer.from(pictureBuffer).toString("base64");
|
|
577
|
+
user.picture = `data:image/jpeg;base64, ${pictureBase64}`;
|
|
578
|
+
} catch (e) {
|
|
579
|
+
logger.error(e);
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
);
|
|
584
|
+
return {
|
|
585
|
+
user: {
|
|
586
|
+
id: user.sub,
|
|
587
|
+
name: user.name,
|
|
588
|
+
email: user.email,
|
|
589
|
+
image: user.picture,
|
|
590
|
+
emailVerified: true
|
|
591
|
+
},
|
|
592
|
+
data: user
|
|
593
|
+
};
|
|
594
|
+
}
|
|
595
|
+
};
|
|
596
|
+
};
|
|
597
|
+
|
|
598
|
+
// src/social-providers/spotify.ts
|
|
599
|
+
import { betterFetch as betterFetch7 } from "@better-fetch/fetch";
|
|
508
600
|
import { Spotify } from "arctic";
|
|
509
601
|
var spotify = (options) => {
|
|
510
602
|
const spotifyArctic = new Spotify(
|
|
@@ -516,7 +608,7 @@ var spotify = (options) => {
|
|
|
516
608
|
id: "spotify",
|
|
517
609
|
name: "Spotify",
|
|
518
610
|
createAuthorizationURL({ state, scopes }) {
|
|
519
|
-
const _scopes = scopes || ["user-read-email"];
|
|
611
|
+
const _scopes = options.scope || scopes || ["user-read-email"];
|
|
520
612
|
return spotifyArctic.createAuthorizationURL(state, _scopes);
|
|
521
613
|
},
|
|
522
614
|
validateAuthorizationCode: async (code, codeVerifier, redirectURI) => {
|
|
@@ -529,7 +621,7 @@ var spotify = (options) => {
|
|
|
529
621
|
});
|
|
530
622
|
},
|
|
531
623
|
async getUserInfo(token) {
|
|
532
|
-
const { data: profile, error: error2 } = await
|
|
624
|
+
const { data: profile, error: error2 } = await betterFetch7(
|
|
533
625
|
"https://api.spotify.com/v1/me",
|
|
534
626
|
{
|
|
535
627
|
method: "GET",
|
|
@@ -556,7 +648,7 @@ var spotify = (options) => {
|
|
|
556
648
|
};
|
|
557
649
|
|
|
558
650
|
// src/social-providers/twitch.ts
|
|
559
|
-
import { betterFetch as
|
|
651
|
+
import { betterFetch as betterFetch8 } from "@better-fetch/fetch";
|
|
560
652
|
import { Twitch } from "arctic";
|
|
561
653
|
var twitch = (options) => {
|
|
562
654
|
const twitchArctic = new Twitch(
|
|
@@ -568,7 +660,7 @@ var twitch = (options) => {
|
|
|
568
660
|
id: "twitch",
|
|
569
661
|
name: "Twitch",
|
|
570
662
|
createAuthorizationURL({ state, scopes }) {
|
|
571
|
-
const _scopes = scopes || ["activity:write", "read"];
|
|
663
|
+
const _scopes = options.scope || scopes || ["activity:write", "read"];
|
|
572
664
|
return twitchArctic.createAuthorizationURL(state, _scopes);
|
|
573
665
|
},
|
|
574
666
|
validateAuthorizationCode: async (code, codeVerifier, redirectURI) => {
|
|
@@ -580,7 +672,7 @@ var twitch = (options) => {
|
|
|
580
672
|
});
|
|
581
673
|
},
|
|
582
674
|
async getUserInfo(token) {
|
|
583
|
-
const { data: profile, error: error2 } = await
|
|
675
|
+
const { data: profile, error: error2 } = await betterFetch8(
|
|
584
676
|
"https://api.twitch.tv/helix/users",
|
|
585
677
|
{
|
|
586
678
|
method: "GET",
|
|
@@ -607,7 +699,7 @@ var twitch = (options) => {
|
|
|
607
699
|
};
|
|
608
700
|
|
|
609
701
|
// src/social-providers/twitter.ts
|
|
610
|
-
import { betterFetch as
|
|
702
|
+
import { betterFetch as betterFetch9 } from "@better-fetch/fetch";
|
|
611
703
|
import { Twitter } from "arctic";
|
|
612
704
|
var twitter = (options) => {
|
|
613
705
|
const twitterArctic = new Twitter(
|
|
@@ -619,7 +711,7 @@ var twitter = (options) => {
|
|
|
619
711
|
id: "twitter",
|
|
620
712
|
name: "Twitter",
|
|
621
713
|
createAuthorizationURL(data) {
|
|
622
|
-
const _scopes = data.scopes || ["account_info.read"];
|
|
714
|
+
const _scopes = options.scope || data.scopes || ["account_info.read"];
|
|
623
715
|
return twitterArctic.createAuthorizationURL(
|
|
624
716
|
data.state,
|
|
625
717
|
data.codeVerifier,
|
|
@@ -636,7 +728,7 @@ var twitter = (options) => {
|
|
|
636
728
|
});
|
|
637
729
|
},
|
|
638
730
|
async getUserInfo(token) {
|
|
639
|
-
const { data: profile, error: error2 } = await
|
|
731
|
+
const { data: profile, error: error2 } = await betterFetch9(
|
|
640
732
|
"https://api.x.com/2/users/me?user.fields=profile_image_url",
|
|
641
733
|
{
|
|
642
734
|
method: "GET",
|
|
@@ -665,7 +757,7 @@ var twitter = (options) => {
|
|
|
665
757
|
};
|
|
666
758
|
};
|
|
667
759
|
|
|
668
|
-
// src/types
|
|
760
|
+
// src/social-providers/types.ts
|
|
669
761
|
import "arctic";
|
|
670
762
|
|
|
671
763
|
// src/social-providers/index.ts
|
|
@@ -674,6 +766,7 @@ var oAuthProviders = {
|
|
|
674
766
|
discord,
|
|
675
767
|
facebook,
|
|
676
768
|
github,
|
|
769
|
+
microsoft,
|
|
677
770
|
google,
|
|
678
771
|
spotify,
|
|
679
772
|
twitch,
|
|
@@ -1295,6 +1388,7 @@ var callbackOAuth = createAuthEndpoint(
|
|
|
1295
1388
|
...user,
|
|
1296
1389
|
id
|
|
1297
1390
|
});
|
|
1391
|
+
console.log({ user, data });
|
|
1298
1392
|
const parsedState = parseState(c.query.state);
|
|
1299
1393
|
if (!parsedState.success) {
|
|
1300
1394
|
c.context.logger.error("Unable to parse state");
|
|
@@ -1438,7 +1532,7 @@ var signOut = createAuthEndpoint(
|
|
|
1438
1532
|
|
|
1439
1533
|
// src/api/routes/forget-password.ts
|
|
1440
1534
|
import { TimeSpan as TimeSpan2 } from "oslo";
|
|
1441
|
-
import { createJWT, parseJWT as
|
|
1535
|
+
import { createJWT, parseJWT as parseJWT4 } from "oslo/jwt";
|
|
1442
1536
|
import { validateJWT } from "oslo/jwt";
|
|
1443
1537
|
import { z as z8 } from "zod";
|
|
1444
1538
|
var forgetPassword = createAuthEndpoint(
|
|
@@ -1533,7 +1627,7 @@ var forgetPasswordCallback = createAuthEndpoint(
|
|
|
1533
1627
|
throw Error("Token expired");
|
|
1534
1628
|
}
|
|
1535
1629
|
} catch (e) {
|
|
1536
|
-
const decoded =
|
|
1630
|
+
const decoded = parseJWT4(token);
|
|
1537
1631
|
const jwt = schema.safeParse(decoded?.payload);
|
|
1538
1632
|
if (jwt.success) {
|
|
1539
1633
|
throw ctx.redirect(`${jwt.data?.redirectTo}?error=invalid_token`);
|
package/dist/cli.js
CHANGED
|
@@ -850,7 +850,7 @@ var kyselyAdapter = (db, config) => {
|
|
|
850
850
|
const migrations = await compileMigrations();
|
|
851
851
|
return {
|
|
852
852
|
code: migrations,
|
|
853
|
-
fileName: `./better-auth_migrations/${(/* @__PURE__ */ new Date()).toISOString()}.sql`
|
|
853
|
+
fileName: `./better-auth_migrations/${(/* @__PURE__ */ new Date()).toISOString().replace(/:/g, "-")}.sql`
|
|
854
854
|
};
|
|
855
855
|
}
|
|
856
856
|
};
|
package/dist/client/plugins.d.ts
CHANGED
|
@@ -2,14 +2,14 @@ import * as nanostores from 'nanostores';
|
|
|
2
2
|
import { A as AccessControl, S as StatementsPrimitive, R as Role } from '../statement-CfnyN34h.js';
|
|
3
3
|
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
4
4
|
import { BetterFetchOption } from '@better-fetch/fetch';
|
|
5
|
-
import { o as organization, f as Organization, M as Member, I as Invitation, u as username, m as magicLink, d as phoneNumber, e as anonymous } from '../index-
|
|
6
|
-
export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-
|
|
5
|
+
import { o as organization, f as Organization, M as Member, I as Invitation, u as username, m as magicLink, d as phoneNumber, e as anonymous } from '../index-8Ml1biZQ.js';
|
|
6
|
+
export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-8Ml1biZQ.js';
|
|
7
7
|
import { P as Prettify } from '../helper-DPDj8Nix.js';
|
|
8
|
-
import '../index-
|
|
8
|
+
import '../index-BlnDgm2S.js';
|
|
9
9
|
import 'arctic';
|
|
10
10
|
import 'zod';
|
|
11
11
|
import 'better-call';
|
|
12
|
-
import '../index-
|
|
12
|
+
import '../index-DHmaFGpa.js';
|
|
13
13
|
import 'kysely';
|
|
14
14
|
import 'better-sqlite3';
|
|
15
15
|
import 'mysql2';
|
package/dist/client.d.ts
CHANGED
|
@@ -6,9 +6,9 @@ import { BetterFetch, BetterFetchError, BetterFetchOption } from '@better-fetch/
|
|
|
6
6
|
import { U as UnionToIntersection, P as Prettify, S as StripEmptyObjects } from './helper-DPDj8Nix.js';
|
|
7
7
|
import { ClientOptions, InferClientAPI, InferActions, InferAdditionalFromClient, InferSessionFromClient, InferUserFromClient, BetterAuthClientPlugin, IsSignal } from './types.js';
|
|
8
8
|
export { AtomListener, InferPluginsFromClient } from './types.js';
|
|
9
|
-
import './index-
|
|
9
|
+
import './index-DHmaFGpa.js';
|
|
10
10
|
import 'kysely';
|
|
11
|
-
import './index-
|
|
11
|
+
import './index-BlnDgm2S.js';
|
|
12
12
|
import 'arctic';
|
|
13
13
|
import 'better-call';
|
|
14
14
|
import 'better-sqlite3';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { U as User, S as Session } from './index-
|
|
1
|
+
import { U as User, S as Session } from './index-BlnDgm2S.js';
|
|
2
2
|
import * as better_call from 'better-call';
|
|
3
3
|
import { z, ZodObject, ZodOptional, ZodArray, ZodLiteral } from 'zod';
|
|
4
4
|
import { P as Prettify } from './helper-DPDj8Nix.js';
|
|
5
5
|
import { A as AccessControl, R as Role, S as StatementsPrimitive, g as defaultRoles } from './statement-CfnyN34h.js';
|
|
6
6
|
import * as _better_fetch_fetch from '@better-fetch/fetch';
|
|
7
7
|
import { BetterFetch, BetterFetchOption } from '@better-fetch/fetch';
|
|
8
|
-
import { H as HookEndpointContext } from './index-
|
|
8
|
+
import { H as HookEndpointContext } from './index-DHmaFGpa.js';
|
|
9
9
|
import * as nanostores from 'nanostores';
|
|
10
10
|
import { atom } from 'nanostores';
|
|
11
11
|
import * as _simplewebauthn_types from '@simplewebauthn/types';
|
|
@@ -193,10 +193,7 @@ interface TwitterProfile {
|
|
|
193
193
|
};
|
|
194
194
|
[claims: string]: unknown;
|
|
195
195
|
}
|
|
196
|
-
interface TwitterOption {
|
|
197
|
-
clientId: string;
|
|
198
|
-
clientSecret: string;
|
|
199
|
-
redirectURI?: string;
|
|
196
|
+
interface TwitterOption extends ProviderOptions {
|
|
200
197
|
}
|
|
201
198
|
declare const twitter: (options: TwitterOption) => {
|
|
202
199
|
id: "twitter";
|
|
@@ -238,10 +235,7 @@ interface TwitchProfile {
|
|
|
238
235
|
*/
|
|
239
236
|
picture: string;
|
|
240
237
|
}
|
|
241
|
-
interface TwitchOptions {
|
|
242
|
-
clientId: string;
|
|
243
|
-
clientSecret: string;
|
|
244
|
-
redirectURI?: string;
|
|
238
|
+
interface TwitchOptions extends ProviderOptions {
|
|
245
239
|
}
|
|
246
240
|
declare const twitch: (options: TwitchOptions) => {
|
|
247
241
|
id: "twitch";
|
|
@@ -273,10 +267,7 @@ interface SpotifyProfile {
|
|
|
273
267
|
url: string;
|
|
274
268
|
}[];
|
|
275
269
|
}
|
|
276
|
-
interface SpotifyOptions {
|
|
277
|
-
clientId: string;
|
|
278
|
-
clientSecret: string;
|
|
279
|
-
redirectURI?: string;
|
|
270
|
+
interface SpotifyOptions extends ProviderOptions {
|
|
280
271
|
}
|
|
281
272
|
declare const spotify: (options: SpotifyOptions) => {
|
|
282
273
|
id: "spotify";
|
|
@@ -346,6 +337,50 @@ declare const google: (options: GoogleOptions) => {
|
|
|
346
337
|
} | null>;
|
|
347
338
|
};
|
|
348
339
|
|
|
340
|
+
interface MicrosoftEntraIDProfile extends Record<string, any> {
|
|
341
|
+
sub: string;
|
|
342
|
+
name: string;
|
|
343
|
+
email: string;
|
|
344
|
+
picture: string;
|
|
345
|
+
}
|
|
346
|
+
interface MicrosoftOptions extends ProviderOptions {
|
|
347
|
+
/**
|
|
348
|
+
* The tenant ID of the Microsoft account
|
|
349
|
+
* @default "common"
|
|
350
|
+
*/
|
|
351
|
+
tenantId?: string;
|
|
352
|
+
/**
|
|
353
|
+
* The size of the profile photo
|
|
354
|
+
* @default 48
|
|
355
|
+
*/
|
|
356
|
+
profilePhotoSize?: 48 | 64 | 96 | 120 | 240 | 360 | 432 | 504 | 648;
|
|
357
|
+
/**
|
|
358
|
+
* Disable profile photo
|
|
359
|
+
*/
|
|
360
|
+
disableProfilePhoto?: boolean;
|
|
361
|
+
}
|
|
362
|
+
declare const microsoft: (options: MicrosoftOptions) => {
|
|
363
|
+
id: "microsoft";
|
|
364
|
+
name: string;
|
|
365
|
+
createAuthorizationURL(data: {
|
|
366
|
+
state: string;
|
|
367
|
+
codeVerifier: string;
|
|
368
|
+
scopes?: string[];
|
|
369
|
+
redirectURI?: string;
|
|
370
|
+
}): URL;
|
|
371
|
+
validateAuthorizationCode(code: string, codeVerifier: string | undefined, redirectURI: string | undefined): Promise<arctic.OAuth2Tokens>;
|
|
372
|
+
getUserInfo(token: arctic.OAuth2Tokens): Promise<{
|
|
373
|
+
user: {
|
|
374
|
+
id: string;
|
|
375
|
+
name: string;
|
|
376
|
+
email: string;
|
|
377
|
+
image: string;
|
|
378
|
+
emailVerified: true;
|
|
379
|
+
};
|
|
380
|
+
data: MicrosoftEntraIDProfile;
|
|
381
|
+
}>;
|
|
382
|
+
};
|
|
383
|
+
|
|
349
384
|
interface GithubProfile {
|
|
350
385
|
login: string;
|
|
351
386
|
id: string;
|
|
@@ -394,12 +429,9 @@ interface GithubProfile {
|
|
|
394
429
|
first_name: string;
|
|
395
430
|
last_name: string;
|
|
396
431
|
}
|
|
397
|
-
interface GithubOptions {
|
|
398
|
-
clientId: string;
|
|
399
|
-
clientSecret: string;
|
|
400
|
-
redirectURI?: string;
|
|
432
|
+
interface GithubOptions extends ProviderOptions {
|
|
401
433
|
}
|
|
402
|
-
declare const github: ({ clientId, clientSecret, redirectURI, }: GithubOptions) => {
|
|
434
|
+
declare const github: ({ clientId, clientSecret, scope, redirectURI, }: GithubOptions) => {
|
|
403
435
|
id: "github";
|
|
404
436
|
name: string;
|
|
405
437
|
createAuthorizationURL({ state, scopes }: {
|
|
@@ -437,10 +469,7 @@ interface FacebookProfile {
|
|
|
437
469
|
};
|
|
438
470
|
};
|
|
439
471
|
}
|
|
440
|
-
interface FacebookOptions {
|
|
441
|
-
clientId: string;
|
|
442
|
-
clientSecret: string;
|
|
443
|
-
redirectURI?: string;
|
|
472
|
+
interface FacebookOptions extends ProviderOptions {
|
|
444
473
|
}
|
|
445
474
|
declare const facebook: (options: FacebookOptions) => {
|
|
446
475
|
id: "facebook";
|
|
@@ -532,10 +561,7 @@ interface DiscordProfile extends Record<string, any> {
|
|
|
532
561
|
/** undocumented field; the CDN URL of their profile picture */
|
|
533
562
|
image_url: string;
|
|
534
563
|
}
|
|
535
|
-
interface DiscordOptions {
|
|
536
|
-
clientId: string;
|
|
537
|
-
clientSecret: string;
|
|
538
|
-
redirectURI?: string;
|
|
564
|
+
interface DiscordOptions extends ProviderOptions {
|
|
539
565
|
}
|
|
540
566
|
declare const discord: (options: DiscordOptions) => {
|
|
541
567
|
id: "discord";
|
|
@@ -601,10 +627,7 @@ interface AppleProfile {
|
|
|
601
627
|
*/
|
|
602
628
|
name: string;
|
|
603
629
|
}
|
|
604
|
-
interface AppleOptions {
|
|
605
|
-
clientId: string;
|
|
606
|
-
clientSecret: string;
|
|
607
|
-
redirectURI?: string;
|
|
630
|
+
interface AppleOptions extends ProviderOptions {
|
|
608
631
|
}
|
|
609
632
|
declare const apple: (options: AppleOptions) => {
|
|
610
633
|
id: "apple";
|
|
@@ -728,7 +751,7 @@ declare const oAuthProviders: {
|
|
|
728
751
|
data: FacebookProfile;
|
|
729
752
|
} | null>;
|
|
730
753
|
};
|
|
731
|
-
github: ({ clientId, clientSecret, redirectURI, }: GithubOptions) => {
|
|
754
|
+
github: ({ clientId, clientSecret, scope, redirectURI, }: GithubOptions) => {
|
|
732
755
|
id: "github";
|
|
733
756
|
name: string;
|
|
734
757
|
createAuthorizationURL({ state, scopes }: {
|
|
@@ -751,6 +774,27 @@ declare const oAuthProviders: {
|
|
|
751
774
|
data: GithubProfile;
|
|
752
775
|
} | null>;
|
|
753
776
|
};
|
|
777
|
+
microsoft: (options: MicrosoftOptions) => {
|
|
778
|
+
id: "microsoft";
|
|
779
|
+
name: string;
|
|
780
|
+
createAuthorizationURL(data: {
|
|
781
|
+
state: string;
|
|
782
|
+
codeVerifier: string;
|
|
783
|
+
scopes?: string[];
|
|
784
|
+
redirectURI?: string;
|
|
785
|
+
}): URL;
|
|
786
|
+
validateAuthorizationCode(code: string, codeVerifier: string | undefined, redirectURI: string | undefined): Promise<arctic.OAuth2Tokens>;
|
|
787
|
+
getUserInfo(token: arctic.OAuth2Tokens): Promise<{
|
|
788
|
+
user: {
|
|
789
|
+
id: string;
|
|
790
|
+
name: string;
|
|
791
|
+
email: string;
|
|
792
|
+
image: string;
|
|
793
|
+
emailVerified: true;
|
|
794
|
+
};
|
|
795
|
+
data: MicrosoftEntraIDProfile;
|
|
796
|
+
}>;
|
|
797
|
+
};
|
|
754
798
|
google: (options: GoogleOptions) => {
|
|
755
799
|
id: "google";
|
|
756
800
|
name: string;
|
|
@@ -843,4 +887,4 @@ type SocialProviders = typeof oAuthProviders extends {
|
|
|
843
887
|
enabled?: boolean;
|
|
844
888
|
}>>> : never : never;
|
|
845
889
|
|
|
846
|
-
export { type Account as A, type DiscordProfile as D, type FacebookProfile as F, type GithubProfile as G, type OAuthProvider as O, type ProviderOptions as P, type Session as S, type TwitchProfile as T, type User as U, type Verification as V, type AppleProfile as a, type GoogleProfile as b, type SpotifyProfile as c, type TwitterProfile as d, type SocialProviders as e, type OAuthProviderList as f, oAuthProviderList as g, type GithubOptions as h, github as i, type GoogleOptions as j, google as k, type AppleOptions as l, apple as m, type
|
|
890
|
+
export { type Account as A, type DiscordProfile as D, type FacebookProfile as F, type GithubProfile as G, type MicrosoftEntraIDProfile as M, type OAuthProvider as O, type ProviderOptions as P, type Session as S, type TwitchProfile as T, type User as U, type Verification as V, type AppleProfile as a, type GoogleProfile as b, type SpotifyProfile as c, type TwitterProfile as d, type SocialProviders as e, type OAuthProviderList as f, oAuthProviderList as g, type GithubOptions as h, github as i, type GoogleOptions as j, google as k, type AppleOptions as l, apple as m, type MicrosoftOptions as n, oAuthProviders as o, microsoft as p, type DiscordOptions as q, discord as r, type SpotifyOptions as s, spotify as t, type TwitchOptions as u, twitch as v, type FacebookOptions as w, facebook as x, type TwitterOption as y, twitter as z };
|