better-auth 0.3.3-beta.1 → 0.3.3-beta.3
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 +114 -50
- package/dist/client/plugins.d.ts +4 -4
- package/dist/client.d.ts +2 -2
- package/dist/{index-8Ml1biZQ.d.ts → index-CMf5Aw2R.d.ts} +17 -4
- package/dist/{index-BlnDgm2S.d.ts → index-CT4RHCuS.d.ts} +4 -8
- package/dist/{index-DHmaFGpa.d.ts → index-Cj2o9gfR.d.ts} +34 -8
- package/dist/index.d.ts +2 -2
- package/dist/index.js +114 -50
- 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 +178 -60
- package/dist/react.d.ts +2 -2
- package/dist/social.d.ts +1 -1
- package/dist/social.js +14 -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-Cj2o9gfR.js';
|
|
3
3
|
import 'kysely';
|
|
4
|
-
import '../index-
|
|
4
|
+
import '../index-CT4RHCuS.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-Cj2o9gfR.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-CT4RHCuS.js';
|
|
7
7
|
import 'arctic';
|
|
8
8
|
import 'better-sqlite3';
|
|
9
9
|
import 'mysql2';
|
package/dist/api.js
CHANGED
|
@@ -362,26 +362,27 @@ var facebook = (options) => {
|
|
|
362
362
|
// src/social-providers/github.ts
|
|
363
363
|
import { betterFetch as betterFetch5 } from "@better-fetch/fetch";
|
|
364
364
|
import { GitHub } from "arctic";
|
|
365
|
-
var github = ({
|
|
366
|
-
clientId,
|
|
367
|
-
clientSecret,
|
|
368
|
-
scope,
|
|
369
|
-
redirectURI
|
|
370
|
-
}) => {
|
|
365
|
+
var github = (options) => {
|
|
371
366
|
const githubArctic = new GitHub(
|
|
372
|
-
clientId,
|
|
373
|
-
clientSecret,
|
|
374
|
-
getRedirectURI("github", redirectURI)
|
|
367
|
+
options.clientId,
|
|
368
|
+
options.clientSecret,
|
|
369
|
+
getRedirectURI("github", options.redirectURI)
|
|
375
370
|
);
|
|
371
|
+
const tokenEndpoint = "https://github.com/login/oauth/access_token";
|
|
376
372
|
return {
|
|
377
373
|
id: "github",
|
|
378
374
|
name: "Github",
|
|
379
375
|
createAuthorizationURL({ state, scopes }) {
|
|
380
|
-
const _scopes = scope || scopes || ["user:email"];
|
|
376
|
+
const _scopes = options.scope || scopes || ["user:email"];
|
|
381
377
|
return githubArctic.createAuthorizationURL(state, _scopes);
|
|
382
378
|
},
|
|
383
|
-
validateAuthorizationCode: async (
|
|
384
|
-
return
|
|
379
|
+
validateAuthorizationCode: async (code, _, redirect) => {
|
|
380
|
+
return validateAuthorizationCode({
|
|
381
|
+
code,
|
|
382
|
+
redirectURI: options.redirectURI || getRedirectURI("google", redirect),
|
|
383
|
+
options,
|
|
384
|
+
tokenEndpoint
|
|
385
|
+
});
|
|
385
386
|
},
|
|
386
387
|
async getUserInfo(token) {
|
|
387
388
|
const { data: profile, error: error2 } = await betterFetch5(
|
|
@@ -415,9 +416,7 @@ var github = ({
|
|
|
415
416
|
name: profile.name,
|
|
416
417
|
email: profile.email,
|
|
417
418
|
image: profile.avatar_url,
|
|
418
|
-
emailVerified
|
|
419
|
-
createdAt: /* @__PURE__ */ new Date(),
|
|
420
|
-
updatedAt: /* @__PURE__ */ new Date()
|
|
419
|
+
emailVerified
|
|
421
420
|
},
|
|
422
421
|
data: profile
|
|
423
422
|
};
|
|
@@ -1397,6 +1396,7 @@ var callbackOAuth = createAuthEndpoint(
|
|
|
1397
1396
|
}
|
|
1398
1397
|
const { callbackURL, currentURL, dontRememberMe } = parsedState.data;
|
|
1399
1398
|
if (!user || data.success === false) {
|
|
1399
|
+
logger.error("Unable to get user info", data.error);
|
|
1400
1400
|
throw c.redirect(
|
|
1401
1401
|
`${c.context.baseURL}/error?error=oauth_validation_failed`
|
|
1402
1402
|
);
|
|
@@ -2239,48 +2239,92 @@ var signUpEmail = createAuthEndpoint(
|
|
|
2239
2239
|
},
|
|
2240
2240
|
async (ctx) => {
|
|
2241
2241
|
if (!ctx.context.options.emailAndPassword?.enabled) {
|
|
2242
|
-
return ctx.json(
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2242
|
+
return ctx.json(
|
|
2243
|
+
{
|
|
2244
|
+
user: null,
|
|
2245
|
+
session: null,
|
|
2246
|
+
error: {
|
|
2247
|
+
message: "Email and password is not enabled"
|
|
2248
|
+
}
|
|
2249
|
+
},
|
|
2250
|
+
{
|
|
2251
|
+
status: 400,
|
|
2252
|
+
body: {
|
|
2253
|
+
message: "Email and password is not enabled"
|
|
2254
|
+
}
|
|
2246
2255
|
}
|
|
2247
|
-
|
|
2256
|
+
);
|
|
2248
2257
|
}
|
|
2249
2258
|
const { name, email, password, image } = ctx.body;
|
|
2250
2259
|
const isValidEmail = z11.string().email().safeParse(email);
|
|
2251
2260
|
if (!isValidEmail.success) {
|
|
2252
|
-
return ctx.json(
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2261
|
+
return ctx.json(
|
|
2262
|
+
{
|
|
2263
|
+
user: null,
|
|
2264
|
+
session: null,
|
|
2265
|
+
error: {
|
|
2266
|
+
message: "Invalid email address"
|
|
2267
|
+
}
|
|
2268
|
+
},
|
|
2269
|
+
{
|
|
2270
|
+
status: 400,
|
|
2271
|
+
body: {
|
|
2272
|
+
message: "Invalid email address"
|
|
2273
|
+
}
|
|
2256
2274
|
}
|
|
2257
|
-
|
|
2275
|
+
);
|
|
2258
2276
|
}
|
|
2259
2277
|
const minPasswordLength = ctx.context.password.config.minPasswordLength;
|
|
2260
2278
|
if (password.length < minPasswordLength) {
|
|
2261
2279
|
ctx.context.logger.error("Password is too short");
|
|
2262
|
-
return ctx.json(
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2280
|
+
return ctx.json(
|
|
2281
|
+
{
|
|
2282
|
+
user: null,
|
|
2283
|
+
session: null,
|
|
2284
|
+
error: {
|
|
2285
|
+
message: "Password is too short"
|
|
2286
|
+
}
|
|
2287
|
+
},
|
|
2288
|
+
{
|
|
2289
|
+
status: 400,
|
|
2290
|
+
body: { message: "Password is too short" }
|
|
2291
|
+
}
|
|
2292
|
+
);
|
|
2266
2293
|
}
|
|
2267
2294
|
const maxPasswordLength = ctx.context.password.config.maxPasswordLength;
|
|
2268
2295
|
if (password.length > maxPasswordLength) {
|
|
2269
2296
|
ctx.context.logger.error("Password is too long");
|
|
2270
|
-
return ctx.json(
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2297
|
+
return ctx.json(
|
|
2298
|
+
{
|
|
2299
|
+
user: null,
|
|
2300
|
+
session: null,
|
|
2301
|
+
error: {
|
|
2302
|
+
message: "Password is too long"
|
|
2303
|
+
}
|
|
2304
|
+
},
|
|
2305
|
+
{
|
|
2306
|
+
status: 400,
|
|
2307
|
+
body: { message: "Password is too long" }
|
|
2308
|
+
}
|
|
2309
|
+
);
|
|
2274
2310
|
}
|
|
2275
2311
|
const dbUser = await ctx.context.internalAdapter.findUserByEmail(email);
|
|
2276
|
-
const hash = await ctx.context.password.hash(password);
|
|
2277
2312
|
if (dbUser?.user) {
|
|
2278
|
-
return ctx.json(
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2313
|
+
return ctx.json(
|
|
2314
|
+
{
|
|
2315
|
+
user: null,
|
|
2316
|
+
session: null,
|
|
2317
|
+
error: {
|
|
2318
|
+
message: "User already exists"
|
|
2319
|
+
}
|
|
2320
|
+
},
|
|
2321
|
+
{
|
|
2322
|
+
status: 400,
|
|
2323
|
+
body: {
|
|
2324
|
+
message: "User already exists"
|
|
2325
|
+
}
|
|
2282
2326
|
}
|
|
2283
|
-
|
|
2327
|
+
);
|
|
2284
2328
|
}
|
|
2285
2329
|
const createdUser = await ctx.context.internalAdapter.createUser({
|
|
2286
2330
|
id: generateRandomString(32, alphabet("a-z", "0-9", "A-Z")),
|
|
@@ -2292,13 +2336,23 @@ var signUpEmail = createAuthEndpoint(
|
|
|
2292
2336
|
updatedAt: /* @__PURE__ */ new Date()
|
|
2293
2337
|
});
|
|
2294
2338
|
if (!createdUser) {
|
|
2295
|
-
return ctx.json(
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2339
|
+
return ctx.json(
|
|
2340
|
+
{
|
|
2341
|
+
user: null,
|
|
2342
|
+
session: null,
|
|
2343
|
+
error: {
|
|
2344
|
+
message: "Could not create user"
|
|
2345
|
+
}
|
|
2346
|
+
},
|
|
2347
|
+
{
|
|
2348
|
+
status: 400,
|
|
2349
|
+
body: {
|
|
2350
|
+
message: "Could not create user"
|
|
2351
|
+
}
|
|
2299
2352
|
}
|
|
2300
|
-
|
|
2353
|
+
);
|
|
2301
2354
|
}
|
|
2355
|
+
const hash = await ctx.context.password.hash(password);
|
|
2302
2356
|
await ctx.context.internalAdapter.linkAccount({
|
|
2303
2357
|
id: generateRandomString(32, alphabet("a-z", "0-9", "A-Z")),
|
|
2304
2358
|
userId: createdUser.id,
|
|
@@ -2311,12 +2365,21 @@ var signUpEmail = createAuthEndpoint(
|
|
|
2311
2365
|
ctx.request
|
|
2312
2366
|
);
|
|
2313
2367
|
if (!session) {
|
|
2314
|
-
return ctx.json(
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2368
|
+
return ctx.json(
|
|
2369
|
+
{
|
|
2370
|
+
user: null,
|
|
2371
|
+
session: null,
|
|
2372
|
+
error: {
|
|
2373
|
+
message: "Could not create session"
|
|
2374
|
+
}
|
|
2375
|
+
},
|
|
2376
|
+
{
|
|
2377
|
+
status: 400,
|
|
2378
|
+
body: {
|
|
2379
|
+
message: "Could not create session"
|
|
2380
|
+
}
|
|
2318
2381
|
}
|
|
2319
|
-
|
|
2382
|
+
);
|
|
2320
2383
|
}
|
|
2321
2384
|
await setSessionCookie(ctx, session.id);
|
|
2322
2385
|
if (ctx.context.options.emailAndPassword.sendEmailVerificationOnSignUp) {
|
|
@@ -2334,7 +2397,8 @@ var signUpEmail = createAuthEndpoint(
|
|
|
2334
2397
|
return ctx.json(
|
|
2335
2398
|
{
|
|
2336
2399
|
user: createdUser,
|
|
2337
|
-
session
|
|
2400
|
+
session,
|
|
2401
|
+
error: null
|
|
2338
2402
|
},
|
|
2339
2403
|
{
|
|
2340
2404
|
body: ctx.body.callbackURL ? {
|
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-CMf5Aw2R.js';
|
|
6
|
+
export { g as getPasskeyActions, c as passkeyClient, a as twoFactorClient } from '../index-CMf5Aw2R.js';
|
|
7
7
|
import { P as Prettify } from '../helper-DPDj8Nix.js';
|
|
8
|
-
import '../index-
|
|
8
|
+
import '../index-CT4RHCuS.js';
|
|
9
9
|
import 'arctic';
|
|
10
10
|
import 'zod';
|
|
11
11
|
import 'better-call';
|
|
12
|
-
import '../index-
|
|
12
|
+
import '../index-Cj2o9gfR.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-Cj2o9gfR.js';
|
|
10
10
|
import 'kysely';
|
|
11
|
-
import './index-
|
|
11
|
+
import './index-CT4RHCuS.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-CT4RHCuS.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-Cj2o9gfR.js';
|
|
9
9
|
import * as nanostores from 'nanostores';
|
|
10
10
|
import { atom } from 'nanostores';
|
|
11
11
|
import * as _simplewebauthn_types from '@simplewebauthn/types';
|
|
@@ -4302,6 +4302,10 @@ declare const magicLink: (options: MagicLinkOptions) => {
|
|
|
4302
4302
|
};
|
|
4303
4303
|
};
|
|
4304
4304
|
|
|
4305
|
+
interface UserWithPhoneNumber extends User {
|
|
4306
|
+
phoneNumber: string;
|
|
4307
|
+
phoneNumberVerified: boolean;
|
|
4308
|
+
}
|
|
4305
4309
|
declare const phoneNumber: (options?: {
|
|
4306
4310
|
otp?: {
|
|
4307
4311
|
/**
|
|
@@ -4320,6 +4324,12 @@ declare const phoneNumber: (options?: {
|
|
|
4320
4324
|
expiresIn?: number;
|
|
4321
4325
|
};
|
|
4322
4326
|
enableAutoSignIn?: boolean;
|
|
4327
|
+
/**
|
|
4328
|
+
* Function to validate phone number
|
|
4329
|
+
*
|
|
4330
|
+
* by default any string is accepted
|
|
4331
|
+
*/
|
|
4332
|
+
phoneNumberValidator?: (phoneNumber: string) => boolean;
|
|
4323
4333
|
}) => {
|
|
4324
4334
|
id: "phone-number";
|
|
4325
4335
|
endpoints: {
|
|
@@ -4411,6 +4421,9 @@ declare const phoneNumber: (options?: {
|
|
|
4411
4421
|
callbackURL?: string | undefined;
|
|
4412
4422
|
}>;
|
|
4413
4423
|
}>): Promise<{
|
|
4424
|
+
user: null;
|
|
4425
|
+
session: null;
|
|
4426
|
+
} | {
|
|
4414
4427
|
user: {
|
|
4415
4428
|
id: string;
|
|
4416
4429
|
email: string;
|
|
@@ -4427,7 +4440,7 @@ declare const phoneNumber: (options?: {
|
|
|
4427
4440
|
ipAddress?: string | undefined;
|
|
4428
4441
|
userAgent?: string | undefined;
|
|
4429
4442
|
};
|
|
4430
|
-
}
|
|
4443
|
+
}>;
|
|
4431
4444
|
path: "/sign-up/phone-number";
|
|
4432
4445
|
options: {
|
|
4433
4446
|
method: "POST";
|
|
@@ -4762,4 +4775,4 @@ declare const anonymous: () => {
|
|
|
4762
4775
|
};
|
|
4763
4776
|
};
|
|
4764
4777
|
|
|
4765
|
-
export { type Invitation as I, type Member as M, type OrganizationOptions as O, type PasskeyOptions as P, twoFactorClient as a, type Passkey as b, passkeyClient as c, phoneNumber as d, anonymous as e, type Organization as f, getPasskeyActions as g, magicLink as m, organization as o, passkey as p, twoFactor as t, username as u };
|
|
4778
|
+
export { type Invitation as I, type Member as M, type OrganizationOptions as O, type PasskeyOptions as P, type UserWithPhoneNumber as U, twoFactorClient as a, type Passkey as b, passkeyClient as c, phoneNumber as d, anonymous as e, type Organization as f, getPasskeyActions as g, magicLink as m, organization as o, passkey as p, twoFactor as t, username as u };
|
|
@@ -431,7 +431,7 @@ interface GithubProfile {
|
|
|
431
431
|
}
|
|
432
432
|
interface GithubOptions extends ProviderOptions {
|
|
433
433
|
}
|
|
434
|
-
declare const github: (
|
|
434
|
+
declare const github: (options: GithubOptions) => {
|
|
435
435
|
id: "github";
|
|
436
436
|
name: string;
|
|
437
437
|
createAuthorizationURL({ state, scopes }: {
|
|
@@ -440,7 +440,7 @@ declare const github: ({ clientId, clientSecret, scope, redirectURI, }: GithubOp
|
|
|
440
440
|
scopes?: string[];
|
|
441
441
|
redirectURI?: string;
|
|
442
442
|
}): URL;
|
|
443
|
-
validateAuthorizationCode: (
|
|
443
|
+
validateAuthorizationCode: (code: string, _: string | undefined, redirect: string | undefined) => Promise<arctic.OAuth2Tokens>;
|
|
444
444
|
getUserInfo(token: arctic.OAuth2Tokens): Promise<{
|
|
445
445
|
user: {
|
|
446
446
|
id: string;
|
|
@@ -448,8 +448,6 @@ declare const github: ({ clientId, clientSecret, scope, redirectURI, }: GithubOp
|
|
|
448
448
|
email: string;
|
|
449
449
|
image: string;
|
|
450
450
|
emailVerified: boolean;
|
|
451
|
-
createdAt: Date;
|
|
452
|
-
updatedAt: Date;
|
|
453
451
|
};
|
|
454
452
|
data: GithubProfile;
|
|
455
453
|
} | null>;
|
|
@@ -751,7 +749,7 @@ declare const oAuthProviders: {
|
|
|
751
749
|
data: FacebookProfile;
|
|
752
750
|
} | null>;
|
|
753
751
|
};
|
|
754
|
-
github: (
|
|
752
|
+
github: (options: GithubOptions) => {
|
|
755
753
|
id: "github";
|
|
756
754
|
name: string;
|
|
757
755
|
createAuthorizationURL({ state, scopes }: {
|
|
@@ -760,7 +758,7 @@ declare const oAuthProviders: {
|
|
|
760
758
|
scopes?: string[];
|
|
761
759
|
redirectURI?: string;
|
|
762
760
|
}): URL;
|
|
763
|
-
validateAuthorizationCode: (
|
|
761
|
+
validateAuthorizationCode: (code: string, _: string | undefined, redirect: string | undefined) => Promise<arctic.OAuth2Tokens>;
|
|
764
762
|
getUserInfo(token: arctic.OAuth2Tokens): Promise<{
|
|
765
763
|
user: {
|
|
766
764
|
id: string;
|
|
@@ -768,8 +766,6 @@ declare const oAuthProviders: {
|
|
|
768
766
|
email: string;
|
|
769
767
|
image: string;
|
|
770
768
|
emailVerified: boolean;
|
|
771
|
-
createdAt: Date;
|
|
772
|
-
updatedAt: Date;
|
|
773
769
|
};
|
|
774
770
|
data: GithubProfile;
|
|
775
771
|
} | null>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Kysely, Migration, PostgresPool, Dialect } from 'kysely';
|
|
2
|
-
import { S as Session, U as User, A as Account, V as Verification, O as OAuthProvider, a as AppleProfile, D as DiscordProfile, F as FacebookProfile, G as GithubProfile, b as GoogleProfile, M as MicrosoftEntraIDProfile, c as SpotifyProfile, T as TwitchProfile, d as TwitterProfile, e as SocialProviders, f as OAuthProviderList } from './index-
|
|
2
|
+
import { S as Session, U as User, A as Account, V as Verification, O as OAuthProvider, a as AppleProfile, D as DiscordProfile, F as FacebookProfile, G as GithubProfile, b as GoogleProfile, M as MicrosoftEntraIDProfile, c as SpotifyProfile, T as TwitchProfile, d as TwitterProfile, e as SocialProviders, f as OAuthProviderList } from './index-CT4RHCuS.js';
|
|
3
3
|
import * as better_call from 'better-call';
|
|
4
4
|
import { ContextTools, CookieOptions, Endpoint, EndpointResponse, Context, Prettify as Prettify$1 } from 'better-call';
|
|
5
5
|
import * as arctic from 'arctic';
|
|
@@ -484,7 +484,7 @@ declare const init: (opts: BetterAuthOptions) => Promise<{
|
|
|
484
484
|
scopes?: string[];
|
|
485
485
|
redirectURI?: string;
|
|
486
486
|
}): URL;
|
|
487
|
-
validateAuthorizationCode: (
|
|
487
|
+
validateAuthorizationCode: (code: string, _: string | undefined, redirect: string | undefined) => Promise<arctic.OAuth2Tokens>;
|
|
488
488
|
getUserInfo(token: arctic.OAuth2Tokens): Promise<{
|
|
489
489
|
user: {
|
|
490
490
|
id: string;
|
|
@@ -492,8 +492,6 @@ declare const init: (opts: BetterAuthOptions) => Promise<{
|
|
|
492
492
|
email: string;
|
|
493
493
|
image: string;
|
|
494
494
|
emailVerified: boolean;
|
|
495
|
-
createdAt: Date;
|
|
496
|
-
updatedAt: Date;
|
|
497
495
|
};
|
|
498
496
|
data: GithubProfile;
|
|
499
497
|
} | null>;
|
|
@@ -2341,6 +2339,12 @@ declare const signUpEmail: {
|
|
|
2341
2339
|
callbackURL?: string | undefined;
|
|
2342
2340
|
}>;
|
|
2343
2341
|
}>): Promise<{
|
|
2342
|
+
user: null;
|
|
2343
|
+
session: null;
|
|
2344
|
+
error: {
|
|
2345
|
+
message: string;
|
|
2346
|
+
};
|
|
2347
|
+
} | {
|
|
2344
2348
|
user: {
|
|
2345
2349
|
id: string;
|
|
2346
2350
|
email: string;
|
|
@@ -2357,7 +2361,8 @@ declare const signUpEmail: {
|
|
|
2357
2361
|
ipAddress?: string | undefined;
|
|
2358
2362
|
userAgent?: string | undefined;
|
|
2359
2363
|
};
|
|
2360
|
-
|
|
2364
|
+
error: null;
|
|
2365
|
+
}>;
|
|
2361
2366
|
path: "/sign-up/email";
|
|
2362
2367
|
options: {
|
|
2363
2368
|
method: "POST";
|
|
@@ -2681,6 +2686,12 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
|
|
|
2681
2686
|
callbackURL?: string | undefined;
|
|
2682
2687
|
}>;
|
|
2683
2688
|
}>): Promise<{
|
|
2689
|
+
user: null;
|
|
2690
|
+
session: null;
|
|
2691
|
+
error: {
|
|
2692
|
+
message: string;
|
|
2693
|
+
};
|
|
2694
|
+
} | {
|
|
2684
2695
|
user: {
|
|
2685
2696
|
id: string;
|
|
2686
2697
|
email: string;
|
|
@@ -2697,7 +2708,8 @@ declare function getEndpoints<C extends AuthContext, Option extends BetterAuthOp
|
|
|
2697
2708
|
ipAddress?: string | undefined;
|
|
2698
2709
|
userAgent?: string | undefined;
|
|
2699
2710
|
};
|
|
2700
|
-
|
|
2711
|
+
error: null;
|
|
2712
|
+
}>;
|
|
2701
2713
|
path: "/sign-up/email";
|
|
2702
2714
|
options: {
|
|
2703
2715
|
method: "POST";
|
|
@@ -3743,6 +3755,12 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
|
|
|
3743
3755
|
callbackURL?: string | undefined;
|
|
3744
3756
|
}>;
|
|
3745
3757
|
}>): Promise<{
|
|
3758
|
+
user: null;
|
|
3759
|
+
session: null;
|
|
3760
|
+
error: {
|
|
3761
|
+
message: string;
|
|
3762
|
+
};
|
|
3763
|
+
} | {
|
|
3746
3764
|
user: {
|
|
3747
3765
|
id: string;
|
|
3748
3766
|
email: string;
|
|
@@ -3759,7 +3777,8 @@ declare const router: <C extends AuthContext, Option extends BetterAuthOptions>(
|
|
|
3759
3777
|
ipAddress?: string | undefined;
|
|
3760
3778
|
userAgent?: string | undefined;
|
|
3761
3779
|
};
|
|
3762
|
-
|
|
3780
|
+
error: null;
|
|
3781
|
+
}>;
|
|
3763
3782
|
path: "/sign-up/email";
|
|
3764
3783
|
options: {
|
|
3765
3784
|
method: "POST";
|
|
@@ -4807,6 +4826,12 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
|
|
|
4807
4826
|
callbackURL?: string | undefined;
|
|
4808
4827
|
}>;
|
|
4809
4828
|
}>): Promise<{
|
|
4829
|
+
user: null;
|
|
4830
|
+
session: null;
|
|
4831
|
+
error: {
|
|
4832
|
+
message: string;
|
|
4833
|
+
};
|
|
4834
|
+
} | {
|
|
4810
4835
|
user: {
|
|
4811
4836
|
id: string;
|
|
4812
4837
|
email: string;
|
|
@@ -4823,7 +4848,8 @@ declare const betterAuth: <O extends BetterAuthOptions>(options: O) => {
|
|
|
4823
4848
|
ipAddress?: string | undefined;
|
|
4824
4849
|
userAgent?: string | undefined;
|
|
4825
4850
|
};
|
|
4826
|
-
|
|
4851
|
+
error: null;
|
|
4852
|
+
}>;
|
|
4827
4853
|
path: "/sign-up/email";
|
|
4828
4854
|
options: {
|
|
4829
4855
|
method: "POST";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export { a as Auth, X as betterAuth } from './index-
|
|
1
|
+
export { a as Auth, X as betterAuth } from './index-Cj2o9gfR.js';
|
|
2
2
|
import 'kysely';
|
|
3
|
-
import './index-
|
|
3
|
+
import './index-CT4RHCuS.js';
|
|
4
4
|
import 'arctic';
|
|
5
5
|
import 'zod';
|
|
6
6
|
import './helper-DPDj8Nix.js';
|