better-auth 1.6.26 → 1.6.28
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/index.d.mts +6 -1
- package/dist/api/dispatch.d.mts +1 -0
- package/dist/api/index.d.mts +508 -505
- package/dist/api/middlewares/authorization.d.mts +10 -14
- package/dist/api/middlewares/authorization.mjs +1 -2
- package/dist/api/middlewares/index.d.mts +1 -2
- package/dist/api/middlewares/origin-check.d.mts +5 -3
- package/dist/api/routes/account.d.mts +16 -13
- package/dist/api/routes/callback.d.mts +3 -1
- package/dist/api/routes/email-verification.d.mts +8 -4
- package/dist/api/routes/error.d.mts +3 -1
- package/dist/api/routes/index.d.mts +1 -2
- package/dist/api/routes/ok.d.mts +3 -1
- package/dist/api/routes/password.d.mts +10 -8
- package/dist/api/routes/session.d.mts +32 -30
- package/dist/api/routes/session.mjs +2 -3
- package/dist/api/routes/sign-in.d.mts +5 -3
- package/dist/api/routes/sign-out.d.mts +3 -1
- package/dist/api/routes/sign-up.d.mts +4 -3
- package/dist/api/routes/update-session.d.mts +5 -4
- package/dist/api/routes/update-user.d.mts +19 -18
- package/dist/auth/full.d.mts +1 -1
- package/dist/auth/minimal.d.mts +1 -1
- package/dist/client/config.d.mts +14 -12
- package/dist/client/config.mjs +2 -2
- package/dist/client/equality.d.mts +1 -0
- package/dist/client/index.d.mts +5 -6
- package/dist/client/lynx/index.d.mts +5 -4
- package/dist/client/lynx/lynx-store.d.mts +2 -1
- package/dist/client/parser.d.mts +3 -7
- package/dist/client/path-to-object.d.mts +4 -3
- package/dist/client/plugins/index.d.mts +1 -1
- package/dist/client/plugins/infer-plugin.d.mts +1 -0
- package/dist/client/query.d.mts +1 -0
- package/dist/client/react/index.d.mts +5 -4
- package/dist/client/react/react-store.d.mts +2 -1
- package/dist/client/session-atom.mjs +59 -46
- package/dist/client/session-refresh.d.mts +1 -0
- package/dist/client/solid/index.d.mts +5 -4
- package/dist/client/svelte/index.d.mts +5 -4
- package/dist/client/types.d.mts +2 -2
- package/dist/client/vanilla.d.mts +2 -1
- package/dist/client/vue/index.d.mts +5 -4
- package/dist/context/create-context.mjs +3 -3
- package/dist/context/helpers.mjs +2 -2
- package/dist/cookies/index.d.mts +7 -6
- package/dist/cookies/session-store.d.mts +0 -1
- package/dist/cookies/session-store.mjs +1 -2
- package/dist/crypto/index.d.mts +9 -2
- package/dist/crypto/jwt.d.mts +1 -0
- package/dist/crypto/password.d.mts +5 -1
- package/dist/db/adapter-base.d.mts +1 -0
- package/dist/db/adapter-kysely.d.mts +1 -0
- package/dist/db/field-converter.d.mts +1 -0
- package/dist/db/field.d.mts +10 -9
- package/dist/db/get-migration.d.mts +1 -0
- package/dist/db/get-schema.d.mts +1 -0
- package/dist/db/internal-adapter.d.mts +1 -0
- package/dist/db/internal-adapter.mjs +1 -2
- package/dist/db/revoke-unproven-account-access.d.mts +1 -0
- package/dist/db/schema.d.mts +2 -2
- package/dist/db/to-zod.d.mts +7 -3
- package/dist/db/with-hooks.d.mts +1 -0
- package/dist/index.d.mts +3 -4
- package/dist/integrations/next-js.d.mts +7 -4
- package/dist/integrations/node.d.mts +3 -2
- package/dist/integrations/svelte-kit.d.mts +9 -2
- package/dist/integrations/tanstack-start-solid.d.mts +5 -2
- package/dist/integrations/tanstack-start.d.mts +5 -2
- package/dist/oauth2/link-account.d.mts +1 -1
- package/dist/oauth2/state.d.mts +1 -0
- package/dist/oauth2/utils.d.mts +1 -0
- package/dist/package.mjs +1 -1
- package/dist/plugins/access/access.d.mts +1 -0
- package/dist/plugins/access/types.d.mts +5 -4
- package/dist/plugins/additional-fields/client.d.mts +1 -0
- package/dist/plugins/admin/access/statement.d.mts +0 -1
- package/dist/plugins/admin/admin.d.mts +137 -132
- package/dist/plugins/admin/client.d.mts +30 -30
- package/dist/plugins/admin/client.mjs +1 -1
- package/dist/plugins/admin/error-codes.d.mts +25 -23
- package/dist/plugins/admin/index.d.mts +1 -1
- package/dist/plugins/admin/schema.d.mts +1 -1
- package/dist/plugins/admin/types.d.mts +2 -3
- package/dist/plugins/anonymous/client.d.mts +11 -9
- package/dist/plugins/anonymous/client.mjs +1 -1
- package/dist/plugins/anonymous/error-codes.d.mts +10 -8
- package/dist/plugins/anonymous/index.d.mts +19 -15
- package/dist/plugins/anonymous/types.d.mts +1 -1
- package/dist/plugins/bearer/index.d.mts +8 -5
- package/dist/plugins/captcha/index.d.mts +8 -5
- package/dist/plugins/captcha/types.d.mts +1 -0
- package/dist/plugins/custom-session/client.d.mts +1 -0
- package/dist/plugins/custom-session/index.d.mts +12 -7
- package/dist/plugins/device-authorization/client.d.mts +1 -0
- package/dist/plugins/device-authorization/index.d.mts +22 -19
- package/dist/plugins/email-otp/client.d.mts +6 -4
- package/dist/plugins/email-otp/client.mjs +1 -1
- package/dist/plugins/email-otp/error-codes.d.mts +5 -3
- package/dist/plugins/email-otp/index.d.mts +76 -69
- package/dist/plugins/email-otp/types.d.mts +1 -0
- package/dist/plugins/generic-oauth/client.d.mts +11 -10
- package/dist/plugins/generic-oauth/client.mjs +1 -1
- package/dist/plugins/generic-oauth/error-codes.d.mts +10 -8
- package/dist/plugins/generic-oauth/index.d.mts +45 -41
- package/dist/plugins/generic-oauth/providers/auth0.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/gumroad.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/hubspot.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/index.d.mts +1 -2
- package/dist/plugins/generic-oauth/providers/keycloak.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/line.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/microsoft-entra-id.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/okta.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/patreon.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/slack.d.mts +1 -0
- package/dist/plugins/generic-oauth/providers/yandex.d.mts +1 -0
- package/dist/plugins/generic-oauth/types.d.mts +2 -1
- package/dist/plugins/haveibeenpwned/index.d.mts +6 -3
- package/dist/plugins/index.d.mts +1 -4
- package/dist/plugins/jwt/client.d.mts +2 -1
- package/dist/plugins/jwt/index.d.mts +12 -9
- package/dist/plugins/jwt/sign.d.mts +2 -2
- package/dist/plugins/jwt/types.d.mts +1 -1
- package/dist/plugins/jwt/utils.d.mts +4 -2
- package/dist/plugins/jwt/verify.d.mts +1 -0
- package/dist/plugins/last-login-method/index.d.mts +6 -3
- package/dist/plugins/magic-link/client.d.mts +1 -0
- package/dist/plugins/magic-link/index.d.mts +6 -4
- package/dist/plugins/mcp/client/adapters.d.mts +1 -0
- package/dist/plugins/mcp/client/index.mjs +2 -4
- package/dist/plugins/mcp/index.d.mts +12 -11
- package/dist/plugins/multi-session/client.d.mts +4 -2
- package/dist/plugins/multi-session/client.mjs +1 -1
- package/dist/plugins/multi-session/error-codes.d.mts +3 -1
- package/dist/plugins/multi-session/index.d.mts +12 -8
- package/dist/plugins/oauth-popup/client.d.mts +12 -6
- package/dist/plugins/oauth-popup/client.mjs +3 -5
- package/dist/plugins/oauth-popup/error-codes.d.mts +6 -4
- package/dist/plugins/oauth-popup/index.d.mts +12 -8
- package/dist/plugins/oauth-popup/index.mjs +1 -1
- package/dist/plugins/oauth-popup/types.d.mts +2 -1
- package/dist/plugins/oauth-proxy/index.d.mts +9 -6
- package/dist/plugins/oauth-proxy/index.mjs +2 -2
- package/dist/plugins/oidc-provider/client.d.mts +2 -1
- package/dist/plugins/oidc-provider/index.d.mts +20 -18
- package/dist/plugins/oidc-provider/schema.d.mts +1 -0
- package/dist/plugins/oidc-provider/types.d.mts +1 -1
- package/dist/plugins/one-tap/client.d.mts +3 -1
- package/dist/plugins/one-tap/index.d.mts +3 -1
- package/dist/plugins/one-time-token/client.d.mts +2 -1
- package/dist/plugins/one-time-token/index.d.mts +7 -6
- package/dist/plugins/open-api/generator.d.mts +1 -0
- package/dist/plugins/open-api/generator.mjs +5 -5
- package/dist/plugins/open-api/index.d.mts +5 -3
- package/dist/plugins/organization/access/statement.d.mts +0 -1
- package/dist/plugins/organization/adapter.d.mts +82 -56
- package/dist/plugins/organization/client.d.mts +103 -104
- package/dist/plugins/organization/client.mjs +4 -7
- package/dist/plugins/organization/error-codes.d.mts +61 -59
- package/dist/plugins/organization/has-permission.d.mts +1 -0
- package/dist/plugins/organization/has-permission.mjs +1 -1
- package/dist/plugins/organization/index.d.mts +1 -1
- package/dist/plugins/organization/organization.d.mts +33 -9
- package/dist/plugins/organization/organization.mjs +1 -1
- package/dist/plugins/organization/permission.d.mts +2 -2
- package/dist/plugins/organization/routes/crud-access-control.d.mts +147 -27
- package/dist/plugins/organization/routes/crud-invites.d.mts +186 -65
- package/dist/plugins/organization/routes/crud-invites.mjs +1 -1
- package/dist/plugins/organization/routes/crud-members.d.mts +178 -56
- package/dist/plugins/organization/routes/crud-members.mjs +1 -1
- package/dist/plugins/organization/routes/crud-org.d.mts +130 -57
- package/dist/plugins/organization/routes/crud-team.d.mts +235 -66
- package/dist/plugins/organization/schema.d.mts +4 -4
- package/dist/plugins/organization/schema.mjs +1 -1
- package/dist/plugins/organization/types.d.mts +14 -14
- package/dist/plugins/phone-number/client.d.mts +15 -13
- package/dist/plugins/phone-number/client.mjs +1 -1
- package/dist/plugins/phone-number/error-codes.d.mts +14 -12
- package/dist/plugins/phone-number/index.d.mts +47 -41
- package/dist/plugins/phone-number/types.d.mts +1 -1
- package/dist/plugins/siwe/client.d.mts +1 -0
- package/dist/plugins/siwe/index.d.mts +5 -4
- package/dist/plugins/test-utils/index.d.mts +4 -2
- package/dist/plugins/test-utils/types.d.mts +0 -1
- package/dist/plugins/two-factor/backup-codes/index.d.mts +7 -5
- package/dist/plugins/two-factor/backup-codes/index.mjs +1 -1
- package/dist/plugins/two-factor/client.d.mts +15 -12
- package/dist/plugins/two-factor/client.mjs +1 -1
- package/dist/plugins/two-factor/error-code.d.mts +12 -10
- package/dist/plugins/two-factor/index.d.mts +36 -32
- package/dist/plugins/two-factor/otp/index.d.mts +4 -2
- package/dist/plugins/two-factor/totp/index.d.mts +7 -5
- package/dist/plugins/two-factor/types.d.mts +1 -1
- package/dist/plugins/username/client.d.mts +11 -9
- package/dist/plugins/username/client.mjs +1 -1
- package/dist/plugins/username/error-codes.d.mts +10 -8
- package/dist/plugins/username/index.d.mts +22 -17
- package/dist/plugins/username/schema.d.mts +5 -3
- package/dist/state.d.mts +1 -0
- package/dist/test-utils/test-instance.d.mts +3 -5
- package/dist/types/adapter.d.mts +1 -1
- package/dist/types/api.d.mts +2 -1
- package/dist/types/auth.d.mts +1 -0
- package/dist/types/helper.d.mts +5 -5
- package/dist/types/index.d.mts +2 -2
- package/dist/types/models.d.mts +1 -0
- package/dist/types/plugins.d.mts +3 -2
- package/dist/utils/index.d.mts +1 -2
- package/dist/utils/url.d.mts +1 -0
- package/package.json +12 -11
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import * as _$_better_auth_core0 from "@better-auth/core";
|
|
2
|
+
import * as _$_better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
|
|
3
|
+
|
|
1
4
|
//#region src/plugins/haveibeenpwned/index.d.ts
|
|
2
5
|
declare module "@better-auth/core" {
|
|
3
6
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
@@ -27,7 +30,7 @@ interface HaveIBeenPwnedOptions {
|
|
|
27
30
|
declare const haveIBeenPwned: (options?: HaveIBeenPwnedOptions | undefined) => {
|
|
28
31
|
id: "have-i-been-pwned";
|
|
29
32
|
version: string;
|
|
30
|
-
init(ctx:
|
|
33
|
+
init(ctx: _$_better_auth_core0.AuthContext): {
|
|
31
34
|
context: {
|
|
32
35
|
password: {
|
|
33
36
|
hash(password: string): Promise<string>;
|
|
@@ -39,13 +42,13 @@ declare const haveIBeenPwned: (options?: HaveIBeenPwnedOptions | undefined) => {
|
|
|
39
42
|
minPasswordLength: number;
|
|
40
43
|
maxPasswordLength: number;
|
|
41
44
|
};
|
|
42
|
-
checkPassword: (userId: string, ctx:
|
|
45
|
+
checkPassword: (userId: string, ctx: _$_better_auth_core0.GenericEndpointContext<_$_better_auth_core0.BetterAuthOptions>) => Promise<boolean>;
|
|
43
46
|
};
|
|
44
47
|
};
|
|
45
48
|
};
|
|
46
49
|
options: HaveIBeenPwnedOptions | undefined;
|
|
47
50
|
$ERROR_CODES: {
|
|
48
|
-
PASSWORD_COMPROMISED:
|
|
51
|
+
PASSWORD_COMPROMISED: _$_better_auth_core_utils_error_codes0.RawError<"PASSWORD_COMPROMISED">;
|
|
49
52
|
};
|
|
50
53
|
};
|
|
51
54
|
//#endregion
|
package/dist/plugins/index.d.mts
CHANGED
|
@@ -2,13 +2,11 @@ import { InferOptionSchema, InferPluginContext, InferPluginErrorCodes, InferPlug
|
|
|
2
2
|
import { HIDE_METADATA } from "../utils/hide-metadata.mjs";
|
|
3
3
|
import { AccessControl, ArrayElement, ExactRoleStatements, Role, RoleAuthorizeRequest, RoleInput, RoleStatements, Statements, SubArray, Subset } from "./access/types.mjs";
|
|
4
4
|
import { AuthorizeResponse, createAccessControl, role } from "./access/access.mjs";
|
|
5
|
-
import "./access/index.mjs";
|
|
6
5
|
import { OrganizationOptions } from "./organization/types.mjs";
|
|
7
6
|
import { InferInvitation, InferMember, InferOrganization, InferOrganizationRolesFromOption, InferOrganizationZodRolesFromOption, InferTeam, Invitation, InvitationInput, InvitationStatus, Member, MemberInput, Organization, OrganizationInput, OrganizationRole, OrganizationSchema, Team, TeamInput, TeamMember, TeamMemberInput, defaultRolesSchema, invitationSchema, invitationStatus, memberSchema, organizationRoleSchema, organizationSchema, roleSchema, teamMemberSchema, teamSchema } from "./organization/schema.mjs";
|
|
8
7
|
import { getOrgAdapter } from "./organization/adapter.mjs";
|
|
9
8
|
import { AdminOptions, InferAdminRolesFromOption, SessionWithImpersonatedBy, UserWithRole } from "./admin/types.mjs";
|
|
10
9
|
import { admin } from "./admin/admin.mjs";
|
|
11
|
-
import "./admin/index.mjs";
|
|
12
10
|
import { AnonymousOptions, AnonymousSession, UserWithAnonymous } from "./anonymous/types.mjs";
|
|
13
11
|
import { anonymous } from "./anonymous/index.mjs";
|
|
14
12
|
import { BearerOptions, bearer } from "./bearer/index.mjs";
|
|
@@ -69,5 +67,4 @@ import { USERNAME_ERROR_CODES } from "./username/error-codes.mjs";
|
|
|
69
67
|
import { UsernameOptions, username } from "./username/index.mjs";
|
|
70
68
|
import { hasPermission } from "./organization/has-permission.mjs";
|
|
71
69
|
import { DefaultOrganizationPlugin, DynamicAccessControlEndpoints, OrganizationCreator, OrganizationEndpoints, OrganizationPlugin, TeamEndpoints, organization, parseRoles } from "./organization/organization.mjs";
|
|
72
|
-
|
|
73
|
-
export { AccessControl, type AdminOptions, type AnonymousOptions, type AnonymousSession, ArrayElement, type Auth0Options, type AuthorizationQuery, AuthorizeResponse, type BackupCodeOptions, type BaseCaptchaOptions, BaseOAuthProviderOptions, BearerOptions, type CaptchaFoxOptions, type CaptchaOptions, type Client, type CloudflareTurnstileOptions, type CodeVerificationValue, CustomSessionPluginOptions, DefaultOrganizationPlugin, DeviceAuthorizationOptions, DynamicAccessControlEndpoints, MULTI_SESSION_ERROR_CODES as ERROR_CODES, type EmailOTPOptions, ExactRoleStatements, type FieldSchema, type GenericOAuthConfig, type GenericOAuthOptions, type GoogleRecaptchaOptions, type GumroadOptions, type HCaptchaOptions, HIDE_METADATA, HaveIBeenPwnedOptions, type HubSpotOptions, type InferAdminRolesFromOption, type InferInvitation, type InferMember, InferOptionSchema, type InferOrganization, type InferOrganizationRolesFromOption, type InferOrganizationZodRolesFromOption, InferPluginContext, InferPluginErrorCodes, InferPluginIDs, type InferTeam, type Invitation, type InvitationInput, type InvitationStatus, type JWKOptions, type JWSAlgorithms, type Jwk, type JwtOptions, type KeycloakOptions, LastLoginMethodOptions, type LineOptions, type LoginResult, MagicLinkOptions, type Member, type MemberInput, type MicrosoftEntraIdOptions, MultiSessionConfig, OAUTH_POPUP_COMPLETE_SCRIPT, OAUTH_POPUP_DATA_ELEMENT_ID, OAUTH_POPUP_ERROR_CODES, OAUTH_POPUP_MESSAGE_TYPE, OAUTH_POPUP_SCRIPT_CSP_HASH, type OAuthAccessToken, type OAuthPopupData, type OAuthPopupMessage, OAuthProxyOptions, type OIDCMetadata, type OIDCOptions, type OTPOptions, type OktaOptions, OneTapOptions, OneTimeTokenOptions, type OpenAPIModelSchema, OpenAPIOptions, type OpenAPIParameter, type OpenAPISchema, type Organization, OrganizationCreator, OrganizationEndpoints, type OrganizationInput, type OrganizationOptions, OrganizationPlugin, type OrganizationRole, type OrganizationSchema, POPUP_MARKER_COOKIE, type Path, type PatreonOptions, type PhoneNumberOptions, type Provider, Role, RoleAuthorizeRequest, RoleInput, RoleStatements, SIWEPluginOptions, type SessionWithImpersonatedBy, type SlackOptions, Statements, SubArray, Subset, type TOTPOptions, TWO_FACTOR_ERROR_CODES, type Team, TeamEndpoints, type TeamInput, type TeamMember, type TeamMemberInput, type TestCookie, type TestHelpers, type TestUtilsOptions, type TimeString, type TokenBody, TwoFactorOptions, TwoFactorProvider, TwoFactorTable, USERNAME_ERROR_CODES, type UserWithAnonymous, type UserWithPhoneNumber, type UserWithRole, UserWithTwoFactor, UsernameOptions, type YandexOptions, admin, anonymous, auth0, type backupCode2fa, bearer, captcha, createAccessControl, createJwk, customSession, type defaultRolesSchema, deviceAuthorization, deviceAuthorizationOptionsSchema, emailOTP, type encodeBackupCodes, type generateBackupCodes, generateExportedKeyPair, type generator, genericOAuth, type getBackupCodes, getClient, getJwtToken, getMCPProtectedResourceMetadata, getMCPProviderMetadata, getMetadata, getOrgAdapter, gumroad, hasPermission, haveIBeenPwned, hubspot, type invitationSchema, type invitationStatus, jwt, keycloak, lastLoginMethod, line, magicLink, mcp, type memberSchema, microsoftEntraId, type ms, multiSession, oAuthDiscoveryMetadata, oAuthProtectedResourceMetadata, oAuthProxy, oauthPopup, oidcProvider, okta, oneTap, oneTimeToken, openAPI, organization, type organizationRoleSchema, type organizationSchema, type otp2fa, parseRoles, patreon, phoneNumber, role, type roleSchema, type sec, signJWT, siwe, slack, type teamMemberSchema, type teamSchema, testUtils, toExpJWT, type totp2fa, twoFactor, twoFactorClient, username, type verifyBackupCode, verifyJWT, withMcpAuth, yandex };
|
|
70
|
+
export { AccessControl, AdminOptions, AnonymousOptions, AnonymousSession, ArrayElement, Auth0Options, AuthorizationQuery, AuthorizeResponse, BackupCodeOptions, BaseCaptchaOptions, BaseOAuthProviderOptions, BearerOptions, CaptchaFoxOptions, CaptchaOptions, Client, CloudflareTurnstileOptions, CodeVerificationValue, CustomSessionPluginOptions, DefaultOrganizationPlugin, DeviceAuthorizationOptions, DynamicAccessControlEndpoints, MULTI_SESSION_ERROR_CODES as ERROR_CODES, EmailOTPOptions, ExactRoleStatements, FieldSchema, GenericOAuthConfig, GenericOAuthOptions, GoogleRecaptchaOptions, GumroadOptions, HCaptchaOptions, HIDE_METADATA, HaveIBeenPwnedOptions, HubSpotOptions, InferAdminRolesFromOption, InferInvitation, InferMember, InferOptionSchema, InferOrganization, InferOrganizationRolesFromOption, InferOrganizationZodRolesFromOption, InferPluginContext, InferPluginErrorCodes, InferPluginIDs, InferTeam, Invitation, InvitationInput, InvitationStatus, JWKOptions, JWSAlgorithms, Jwk, JwtOptions, KeycloakOptions, LastLoginMethodOptions, LineOptions, LoginResult, MagicLinkOptions, Member, MemberInput, MicrosoftEntraIdOptions, MultiSessionConfig, OAUTH_POPUP_COMPLETE_SCRIPT, OAUTH_POPUP_DATA_ELEMENT_ID, OAUTH_POPUP_ERROR_CODES, OAUTH_POPUP_MESSAGE_TYPE, OAUTH_POPUP_SCRIPT_CSP_HASH, OAuthAccessToken, OAuthPopupData, OAuthPopupMessage, OAuthProxyOptions, OIDCMetadata, OIDCOptions, OTPOptions, OktaOptions, OneTapOptions, OneTimeTokenOptions, OpenAPIModelSchema, OpenAPIOptions, OpenAPIParameter, OpenAPISchema, Organization, OrganizationCreator, OrganizationEndpoints, OrganizationInput, OrganizationOptions, OrganizationPlugin, OrganizationRole, OrganizationSchema, POPUP_MARKER_COOKIE, Path, PatreonOptions, PhoneNumberOptions, Provider, Role, RoleAuthorizeRequest, RoleInput, RoleStatements, SIWEPluginOptions, SessionWithImpersonatedBy, SlackOptions, Statements, SubArray, Subset, TOTPOptions, TWO_FACTOR_ERROR_CODES, Team, TeamEndpoints, TeamInput, TeamMember, TeamMemberInput, TestCookie, TestHelpers, TestUtilsOptions, TimeString, TokenBody, TwoFactorOptions, TwoFactorProvider, TwoFactorTable, USERNAME_ERROR_CODES, UserWithAnonymous, UserWithPhoneNumber, UserWithRole, UserWithTwoFactor, UsernameOptions, YandexOptions, admin, anonymous, auth0, backupCode2fa, bearer, captcha, createAccessControl, createJwk, customSession, defaultRolesSchema, deviceAuthorization, deviceAuthorizationOptionsSchema, emailOTP, encodeBackupCodes, generateBackupCodes, generateExportedKeyPair, generator, genericOAuth, getBackupCodes, getClient, getJwtToken, getMCPProtectedResourceMetadata, getMCPProviderMetadata, getMetadata, getOrgAdapter, gumroad, hasPermission, haveIBeenPwned, hubspot, invitationSchema, invitationStatus, jwt, keycloak, lastLoginMethod, line, magicLink, mcp, memberSchema, microsoftEntraId, ms, multiSession, oAuthDiscoveryMetadata, oAuthProtectedResourceMetadata, oAuthProxy, oauthPopup, oidcProvider, okta, oneTap, oneTimeToken, openAPI, organization, organizationRoleSchema, organizationSchema, otp2fa, parseRoles, patreon, phoneNumber, role, roleSchema, sec, signJWT, siwe, slack, teamMemberSchema, teamSchema, testUtils, toExpJWT, totp2fa, twoFactor, twoFactorClient, username, verifyBackupCode, verifyJWT, withMcpAuth, yandex };
|
|
@@ -3,6 +3,7 @@ import { jwt } from "./index.mjs";
|
|
|
3
3
|
import { BetterAuthClientOptions, ClientFetchOption, ClientStore } from "@better-auth/core";
|
|
4
4
|
import { JSONWebKeySet } from "jose";
|
|
5
5
|
import { BetterFetch } from "@better-fetch/fetch";
|
|
6
|
+
|
|
6
7
|
//#region src/plugins/jwt/client.d.ts
|
|
7
8
|
interface JwtClientOptions {
|
|
8
9
|
jwks?: {
|
|
@@ -37,4 +38,4 @@ declare const jwtClient: (options?: JwtClientOptions) => {
|
|
|
37
38
|
};
|
|
38
39
|
};
|
|
39
40
|
//#endregion
|
|
40
|
-
export {
|
|
41
|
+
export { jwtClient };
|
|
@@ -2,8 +2,11 @@ import { JWKOptions, JWSAlgorithms, Jwk, JwtOptions } from "./types.mjs";
|
|
|
2
2
|
import { getJwtToken, signJWT } from "./sign.mjs";
|
|
3
3
|
import { createJwk, generateExportedKeyPair, toExpJWT } from "./utils.mjs";
|
|
4
4
|
import { verifyJWT } from "./verify.mjs";
|
|
5
|
+
import * as _$_better_auth_core0 from "@better-auth/core";
|
|
6
|
+
import * as _$better_call0 from "better-call";
|
|
5
7
|
import * as z from "zod";
|
|
6
8
|
import { JSONWebKeySet, JWTPayload } from "jose";
|
|
9
|
+
|
|
7
10
|
//#region src/plugins/jwt/index.d.ts
|
|
8
11
|
declare module "@better-auth/core" {
|
|
9
12
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
@@ -17,7 +20,7 @@ declare const jwt: <O extends JwtOptions>(options?: O) => {
|
|
|
17
20
|
version: string;
|
|
18
21
|
options: NoInfer<O>;
|
|
19
22
|
endpoints: {
|
|
20
|
-
getJwks:
|
|
23
|
+
getJwks: _$better_call0.StrictEndpoint<string, {
|
|
21
24
|
method: "GET";
|
|
22
25
|
metadata: {
|
|
23
26
|
openapi: {
|
|
@@ -94,10 +97,10 @@ declare const jwt: <O extends JwtOptions>(options?: O) => {
|
|
|
94
97
|
};
|
|
95
98
|
};
|
|
96
99
|
}, JSONWebKeySet>;
|
|
97
|
-
getToken:
|
|
100
|
+
getToken: _$better_call0.StrictEndpoint<"/token", {
|
|
98
101
|
method: "GET";
|
|
99
102
|
requireHeaders: true;
|
|
100
|
-
use: (
|
|
103
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
101
104
|
session: {
|
|
102
105
|
session: Record<string, any> & {
|
|
103
106
|
id: string;
|
|
@@ -119,7 +122,7 @@ declare const jwt: <O extends JwtOptions>(options?: O) => {
|
|
|
119
122
|
image?: string | null | undefined;
|
|
120
123
|
};
|
|
121
124
|
};
|
|
122
|
-
}
|
|
125
|
+
}>>[];
|
|
123
126
|
metadata: {
|
|
124
127
|
openapi: {
|
|
125
128
|
operationId: string;
|
|
@@ -146,7 +149,7 @@ declare const jwt: <O extends JwtOptions>(options?: O) => {
|
|
|
146
149
|
}, {
|
|
147
150
|
token: string;
|
|
148
151
|
}>;
|
|
149
|
-
signJWT:
|
|
152
|
+
signJWT: _$better_call0.StrictEndpoint<string, {
|
|
150
153
|
method: "POST";
|
|
151
154
|
metadata: {
|
|
152
155
|
$Infer: {
|
|
@@ -163,7 +166,7 @@ declare const jwt: <O extends JwtOptions>(options?: O) => {
|
|
|
163
166
|
}, {
|
|
164
167
|
token: string;
|
|
165
168
|
}>;
|
|
166
|
-
verifyJWT:
|
|
169
|
+
verifyJWT: _$better_call0.StrictEndpoint<string, {
|
|
167
170
|
method: "POST";
|
|
168
171
|
metadata: {
|
|
169
172
|
$Infer: {
|
|
@@ -190,8 +193,8 @@ declare const jwt: <O extends JwtOptions>(options?: O) => {
|
|
|
190
193
|
};
|
|
191
194
|
hooks: {
|
|
192
195
|
after: {
|
|
193
|
-
matcher(context:
|
|
194
|
-
handler: (inputContext:
|
|
196
|
+
matcher(context: _$_better_auth_core0.HookEndpointContext): boolean;
|
|
197
|
+
handler: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<void>>;
|
|
195
198
|
}[];
|
|
196
199
|
};
|
|
197
200
|
schema: {
|
|
@@ -218,4 +221,4 @@ declare const jwt: <O extends JwtOptions>(options?: O) => {
|
|
|
218
221
|
};
|
|
219
222
|
};
|
|
220
223
|
//#endregion
|
|
221
|
-
export {
|
|
224
|
+
export { JWKOptions, JWSAlgorithms, Jwk, JwtOptions, createJwk, generateExportedKeyPair, getJwtToken, jwt, signJWT, toExpJWT, verifyJWT };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { JwtOptions } from "./types.mjs";
|
|
2
2
|
import { GenericEndpointContext } from "@better-auth/core";
|
|
3
|
+
|
|
3
4
|
//#region src/plugins/jwt/sign.d.ts
|
|
4
5
|
type JWTPayloadWithOptional = {
|
|
5
6
|
/**
|
|
@@ -43,8 +44,7 @@ type JWTPayloadWithOptional = {
|
|
|
43
44
|
*
|
|
44
45
|
* @see {@link https://www.rfc-editor.org/rfc/rfc7519#section-4.1.6 RFC7519#section-4.1.6}
|
|
45
46
|
*/
|
|
46
|
-
iat?: number | undefined;
|
|
47
|
-
/** Any other JWT Claim Set member. */
|
|
47
|
+
iat?: number | undefined; /** Any other JWT Claim Set member. */
|
|
48
48
|
[propName: string]: unknown | undefined;
|
|
49
49
|
};
|
|
50
50
|
declare function signJWT(ctx: GenericEndpointContext, config: {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Session, User } from "../../types/models.mjs";
|
|
2
2
|
import { InferOptionSchema } from "../../types/plugins.mjs";
|
|
3
|
-
import "../../types/index.mjs";
|
|
4
3
|
import { schema } from "./schema.mjs";
|
|
5
4
|
import { Awaitable, GenericEndpointContext } from "@better-auth/core";
|
|
6
5
|
import { JWTPayload } from "jose";
|
|
6
|
+
|
|
7
7
|
//#region src/plugins/jwt/types.d.ts
|
|
8
8
|
interface JwtOptions {
|
|
9
9
|
jwks?: {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Jwk, JwtOptions } from "./types.mjs";
|
|
2
2
|
import { GenericEndpointContext } from "@better-auth/core";
|
|
3
|
+
import * as _$jose from "jose";
|
|
4
|
+
|
|
3
5
|
//#region src/plugins/jwt/utils.d.ts
|
|
4
6
|
/**
|
|
5
7
|
* Converts an expirationTime to ISO seconds expiration time (the format of JWT exp)
|
|
@@ -12,8 +14,8 @@ import { GenericEndpointContext } from "@better-auth/core";
|
|
|
12
14
|
*/
|
|
13
15
|
declare function toExpJWT(expirationTime: number | Date | string, iat: number): number;
|
|
14
16
|
declare function generateExportedKeyPair(options?: JwtOptions | undefined): Promise<{
|
|
15
|
-
publicWebKey:
|
|
16
|
-
privateWebKey:
|
|
17
|
+
publicWebKey: _$jose.JWK;
|
|
18
|
+
privateWebKey: _$jose.JWK;
|
|
17
19
|
alg: "EdDSA" | "ES256" | "ES512" | "PS256" | "RS256";
|
|
18
20
|
cfg: {
|
|
19
21
|
crv?: "Ed25519" | undefined;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import * as _$_better_auth_core0 from "@better-auth/core";
|
|
1
2
|
import { GenericEndpointContext } from "@better-auth/core";
|
|
3
|
+
import * as _$better_call0 from "better-call";
|
|
4
|
+
|
|
2
5
|
//#region src/plugins/last-login-method/index.d.ts
|
|
3
6
|
declare module "@better-auth/core" {
|
|
4
7
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
@@ -57,7 +60,7 @@ interface LastLoginMethodOptions {
|
|
|
57
60
|
declare const lastLoginMethod: <O extends LastLoginMethodOptions>(userConfig?: O | undefined) => {
|
|
58
61
|
id: "last-login-method";
|
|
59
62
|
version: string;
|
|
60
|
-
init(ctx:
|
|
63
|
+
init(ctx: _$_better_auth_core0.AuthContext): {
|
|
61
64
|
options: {
|
|
62
65
|
databaseHooks: {
|
|
63
66
|
user: {
|
|
@@ -72,7 +75,7 @@ declare const lastLoginMethod: <O extends LastLoginMethodOptions>(userConfig?: O
|
|
|
72
75
|
image?: string | null | undefined;
|
|
73
76
|
} & Record<string, unknown>, context: GenericEndpointContext | null): Promise<{
|
|
74
77
|
data: {
|
|
75
|
-
lastLoginMethod:
|
|
78
|
+
lastLoginMethod: string;
|
|
76
79
|
id: string;
|
|
77
80
|
createdAt: Date;
|
|
78
81
|
updatedAt: Date;
|
|
@@ -104,7 +107,7 @@ declare const lastLoginMethod: <O extends LastLoginMethodOptions>(userConfig?: O
|
|
|
104
107
|
hooks: {
|
|
105
108
|
after: {
|
|
106
109
|
matcher(): true;
|
|
107
|
-
handler: (inputContext:
|
|
110
|
+
handler: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<void>>;
|
|
108
111
|
}[];
|
|
109
112
|
};
|
|
110
113
|
schema: O["storeInDatabase"] extends true ? {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Awaitable, GenericEndpointContext } from "@better-auth/core";
|
|
2
|
+
import * as _$better_call0 from "better-call";
|
|
2
3
|
import * as z from "zod";
|
|
4
|
+
|
|
3
5
|
//#region src/plugins/magic-link/index.d.ts
|
|
4
6
|
declare module "@better-auth/core" {
|
|
5
7
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
@@ -88,10 +90,10 @@ declare const magicLink: (options: MagicLinkOptions) => {
|
|
|
88
90
|
*
|
|
89
91
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/sign-in#api-method-sign-in-magic-link)
|
|
90
92
|
*/
|
|
91
|
-
signInMagicLink:
|
|
93
|
+
signInMagicLink: _$better_call0.StrictEndpoint<"/sign-in/magic-link", {
|
|
92
94
|
method: "POST";
|
|
93
95
|
requireHeaders: true;
|
|
94
|
-
use: (
|
|
96
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<void>>[];
|
|
95
97
|
body: z.ZodObject<{
|
|
96
98
|
email: z.ZodEmail;
|
|
97
99
|
name: z.ZodOptional<z.ZodString>;
|
|
@@ -141,7 +143,7 @@ declare const magicLink: (options: MagicLinkOptions) => {
|
|
|
141
143
|
*
|
|
142
144
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/magic-link#api-method-magic-link-verify)
|
|
143
145
|
*/
|
|
144
|
-
magicLinkVerify:
|
|
146
|
+
magicLinkVerify: _$better_call0.StrictEndpoint<"/magic-link/verify", {
|
|
145
147
|
method: "GET";
|
|
146
148
|
query: z.ZodObject<{
|
|
147
149
|
token: z.ZodString;
|
|
@@ -149,7 +151,7 @@ declare const magicLink: (options: MagicLinkOptions) => {
|
|
|
149
151
|
errorCallbackURL: z.ZodOptional<z.ZodString>;
|
|
150
152
|
newUserCallbackURL: z.ZodOptional<z.ZodString>;
|
|
151
153
|
}, z.core.$strip>;
|
|
152
|
-
use: (
|
|
154
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<void>>[];
|
|
153
155
|
requireHeaders: true;
|
|
154
156
|
metadata: {
|
|
155
157
|
openapi: {
|
|
@@ -102,8 +102,7 @@ function createMcpAuthClient(options) {
|
|
|
102
102
|
});
|
|
103
103
|
const authHeader = req.headers.get("Authorization");
|
|
104
104
|
if (!authHeader || !authHeader.startsWith("Bearer ")) return make401Response(authURL, options.resource, corsHeaders);
|
|
105
|
-
const
|
|
106
|
-
const session = await verifyToken(token);
|
|
105
|
+
const session = await verifyToken(authHeader.slice(7));
|
|
107
106
|
if (!session) return make401Response(authURL, options.resource, corsHeaders);
|
|
108
107
|
return fn(req, session);
|
|
109
108
|
};
|
|
@@ -155,8 +154,7 @@ function createMcpAuthClient(options) {
|
|
|
155
154
|
send401Node(res, makeWWWAuthenticate(authURL, options.resource), "Unauthorized: Authentication required", corsHeaders);
|
|
156
155
|
return;
|
|
157
156
|
}
|
|
158
|
-
const
|
|
159
|
-
const session = await verifyToken(token);
|
|
157
|
+
const session = await verifyToken(authHeader.slice(7));
|
|
160
158
|
if (!session) {
|
|
161
159
|
send401Node(res, makeWWWAuthenticate(authURL, options.resource), "Invalid or expired token", corsHeaders);
|
|
162
160
|
return;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { OAuthAccessToken, OIDCMetadata, OIDCOptions } from "../oidc-provider/types.mjs";
|
|
2
|
-
import "../oidc-provider/index.mjs";
|
|
3
2
|
import { BetterAuthOptions, GenericEndpointContext } from "@better-auth/core";
|
|
3
|
+
import * as _$better_call0 from "better-call";
|
|
4
4
|
import * as z from "zod";
|
|
5
|
+
|
|
5
6
|
//#region src/plugins/mcp/index.d.ts
|
|
6
7
|
declare module "@better-auth/core" {
|
|
7
8
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
@@ -30,18 +31,18 @@ declare const mcp: (options: MCPOptions) => {
|
|
|
30
31
|
hooks: {
|
|
31
32
|
after: {
|
|
32
33
|
matcher(): true;
|
|
33
|
-
handler: (inputContext:
|
|
34
|
+
handler: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<void>>;
|
|
34
35
|
}[];
|
|
35
36
|
};
|
|
36
37
|
endpoints: {
|
|
37
|
-
oAuthConsent:
|
|
38
|
+
oAuthConsent: _$better_call0.StrictEndpoint<"/oauth2/consent", {
|
|
38
39
|
method: "POST";
|
|
39
40
|
operationId: string;
|
|
40
41
|
body: z.ZodObject<{
|
|
41
42
|
accept: z.ZodBoolean;
|
|
42
43
|
consent_code: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
|
|
43
44
|
}, z.core.$strip>;
|
|
44
|
-
use: (
|
|
45
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
45
46
|
session: {
|
|
46
47
|
session: Record<string, any> & {
|
|
47
48
|
id: string;
|
|
@@ -63,7 +64,7 @@ declare const mcp: (options: MCPOptions) => {
|
|
|
63
64
|
image?: string | null | undefined;
|
|
64
65
|
};
|
|
65
66
|
};
|
|
66
|
-
}
|
|
67
|
+
}>>[];
|
|
67
68
|
metadata: {
|
|
68
69
|
openapi: {
|
|
69
70
|
description: string;
|
|
@@ -113,13 +114,13 @@ declare const mcp: (options: MCPOptions) => {
|
|
|
113
114
|
}, {
|
|
114
115
|
redirectURI: string;
|
|
115
116
|
}>;
|
|
116
|
-
getMcpOAuthConfig:
|
|
117
|
+
getMcpOAuthConfig: _$better_call0.StrictEndpoint<"/.well-known/oauth-authorization-server", {
|
|
117
118
|
method: "GET";
|
|
118
119
|
metadata: {
|
|
119
120
|
readonly scope: "server";
|
|
120
121
|
};
|
|
121
122
|
}, OIDCMetadata | null>;
|
|
122
|
-
getMCPProtectedResource:
|
|
123
|
+
getMCPProtectedResource: _$better_call0.StrictEndpoint<"/.well-known/oauth-protected-resource", {
|
|
123
124
|
method: "GET";
|
|
124
125
|
metadata: {
|
|
125
126
|
readonly scope: "server";
|
|
@@ -132,7 +133,7 @@ declare const mcp: (options: MCPOptions) => {
|
|
|
132
133
|
bearer_methods_supported: string[];
|
|
133
134
|
resource_signing_alg_values_supported: string[];
|
|
134
135
|
}>;
|
|
135
|
-
mcpOAuthAuthorize:
|
|
136
|
+
mcpOAuthAuthorize: _$better_call0.StrictEndpoint<"/mcp/authorize", {
|
|
136
137
|
method: "GET";
|
|
137
138
|
query: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
138
139
|
metadata: {
|
|
@@ -155,7 +156,7 @@ declare const mcp: (options: MCPOptions) => {
|
|
|
155
156
|
};
|
|
156
157
|
};
|
|
157
158
|
}, void>;
|
|
158
|
-
mcpOAuthToken:
|
|
159
|
+
mcpOAuthToken: _$better_call0.StrictEndpoint<"/mcp/token", {
|
|
159
160
|
method: "POST";
|
|
160
161
|
body: z.ZodRecord<z.ZodAny, z.ZodAny>;
|
|
161
162
|
metadata: {
|
|
@@ -176,7 +177,7 @@ declare const mcp: (options: MCPOptions) => {
|
|
|
176
177
|
scope: string;
|
|
177
178
|
id_token: string | undefined;
|
|
178
179
|
}>;
|
|
179
|
-
registerMcpClient:
|
|
180
|
+
registerMcpClient: _$better_call0.StrictEndpoint<"/mcp/register", {
|
|
180
181
|
method: "POST";
|
|
181
182
|
body: z.ZodObject<{
|
|
182
183
|
redirect_uris: z.ZodArray<z.ZodString>;
|
|
@@ -294,7 +295,7 @@ declare const mcp: (options: MCPOptions) => {
|
|
|
294
295
|
};
|
|
295
296
|
};
|
|
296
297
|
}, Response>;
|
|
297
|
-
getMcpSession:
|
|
298
|
+
getMcpSession: _$better_call0.StrictEndpoint<"/mcp/get-session", {
|
|
298
299
|
method: "GET";
|
|
299
300
|
requireHeaders: true;
|
|
300
301
|
}, OAuthAccessToken | null>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { MULTI_SESSION_ERROR_CODES } from "./error-codes.mjs";
|
|
2
2
|
import { MultiSessionConfig, multiSession } from "./index.mjs";
|
|
3
|
+
import * as _$_better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
|
|
4
|
+
|
|
3
5
|
//#region src/plugins/multi-session/client.d.ts
|
|
4
6
|
declare const multiSessionClient: () => {
|
|
5
7
|
id: "multi-session";
|
|
@@ -10,8 +12,8 @@ declare const multiSessionClient: () => {
|
|
|
10
12
|
signal: "$sessionSignal";
|
|
11
13
|
}[];
|
|
12
14
|
$ERROR_CODES: {
|
|
13
|
-
INVALID_SESSION_TOKEN:
|
|
15
|
+
INVALID_SESSION_TOKEN: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_SESSION_TOKEN">;
|
|
14
16
|
};
|
|
15
17
|
};
|
|
16
18
|
//#endregion
|
|
17
|
-
export {
|
|
19
|
+
export { multiSessionClient };
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import * as _$_better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
|
|
2
|
+
|
|
1
3
|
//#region src/plugins/multi-session/error-codes.d.ts
|
|
2
4
|
declare const MULTI_SESSION_ERROR_CODES: {
|
|
3
|
-
INVALID_SESSION_TOKEN:
|
|
5
|
+
INVALID_SESSION_TOKEN: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_SESSION_TOKEN">;
|
|
4
6
|
};
|
|
5
7
|
//#endregion
|
|
6
8
|
export { MULTI_SESSION_ERROR_CODES };
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { MULTI_SESSION_ERROR_CODES } from "./error-codes.mjs";
|
|
2
|
+
import * as _$_better_auth_core0 from "@better-auth/core";
|
|
3
|
+
import * as _$_better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
|
|
4
|
+
import * as _$better_call0 from "better-call";
|
|
2
5
|
import * as z from "zod";
|
|
6
|
+
|
|
3
7
|
//#region src/plugins/multi-session/index.d.ts
|
|
4
8
|
declare module "@better-auth/core" {
|
|
5
9
|
interface BetterAuthPluginRegistry<AuthOptions, Options> {
|
|
@@ -35,7 +39,7 @@ declare const multiSession: (options?: MultiSessionConfig | undefined) => {
|
|
|
35
39
|
*
|
|
36
40
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/multi-session#api-method-multi-session-list-device-sessions)
|
|
37
41
|
*/
|
|
38
|
-
listDeviceSessions:
|
|
42
|
+
listDeviceSessions: _$better_call0.StrictEndpoint<"/multi-session/list-device-sessions", {
|
|
39
43
|
method: "GET";
|
|
40
44
|
requireHeaders: true;
|
|
41
45
|
}, {
|
|
@@ -74,7 +78,7 @@ declare const multiSession: (options?: MultiSessionConfig | undefined) => {
|
|
|
74
78
|
*
|
|
75
79
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/multi-session#api-method-multi-session-set-active)
|
|
76
80
|
*/
|
|
77
|
-
setActiveSession:
|
|
81
|
+
setActiveSession: _$better_call0.StrictEndpoint<"/multi-session/set-active", {
|
|
78
82
|
method: "POST";
|
|
79
83
|
body: z.ZodObject<{
|
|
80
84
|
sessionToken: z.ZodString;
|
|
@@ -138,13 +142,13 @@ declare const multiSession: (options?: MultiSessionConfig | undefined) => {
|
|
|
138
142
|
*
|
|
139
143
|
* @see [Read our docs to learn more.](https://better-auth.com/docs/plugins/multi-session#api-method-multi-session-revoke)
|
|
140
144
|
*/
|
|
141
|
-
revokeDeviceSession:
|
|
145
|
+
revokeDeviceSession: _$better_call0.StrictEndpoint<"/multi-session/revoke", {
|
|
142
146
|
method: "POST";
|
|
143
147
|
body: z.ZodObject<{
|
|
144
148
|
sessionToken: z.ZodString;
|
|
145
149
|
}, z.core.$strip>;
|
|
146
150
|
requireHeaders: true;
|
|
147
|
-
use: (
|
|
151
|
+
use: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<{
|
|
148
152
|
session: {
|
|
149
153
|
session: Record<string, any> & {
|
|
150
154
|
id: string;
|
|
@@ -166,7 +170,7 @@ declare const multiSession: (options?: MultiSessionConfig | undefined) => {
|
|
|
166
170
|
image?: string | null | undefined;
|
|
167
171
|
};
|
|
168
172
|
};
|
|
169
|
-
}
|
|
173
|
+
}>>[];
|
|
170
174
|
metadata: {
|
|
171
175
|
openapi: {
|
|
172
176
|
description: string;
|
|
@@ -195,13 +199,13 @@ declare const multiSession: (options?: MultiSessionConfig | undefined) => {
|
|
|
195
199
|
};
|
|
196
200
|
hooks: {
|
|
197
201
|
after: {
|
|
198
|
-
matcher: (context:
|
|
199
|
-
handler: (inputContext:
|
|
202
|
+
matcher: (context: _$_better_auth_core0.HookEndpointContext) => boolean;
|
|
203
|
+
handler: _$better_call0.Middleware<_$better_call0.MiddlewareOptions, (inputContext: _$better_call0.MiddlewareInputContext<_$better_call0.MiddlewareOptions>) => Promise<void>>;
|
|
200
204
|
}[];
|
|
201
205
|
};
|
|
202
206
|
options: MultiSessionConfig | undefined;
|
|
203
207
|
$ERROR_CODES: {
|
|
204
|
-
INVALID_SESSION_TOKEN:
|
|
208
|
+
INVALID_SESSION_TOKEN: _$_better_auth_core_utils_error_codes0.RawError<"INVALID_SESSION_TOKEN">;
|
|
205
209
|
};
|
|
206
210
|
};
|
|
207
211
|
//#endregion
|
|
@@ -2,7 +2,9 @@ import { POPUP_TOKEN_STORAGE_KEY } from "./constants.mjs";
|
|
|
2
2
|
import { OAUTH_POPUP_ERROR_CODES } from "./error-codes.mjs";
|
|
3
3
|
import { oauthPopup } from "./index.mjs";
|
|
4
4
|
import { BetterAuthClientOptions, ClientStore } from "@better-auth/core";
|
|
5
|
+
import * as _$_better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
|
|
5
6
|
import { BetterFetch, BetterFetchPlugin } from "@better-fetch/fetch";
|
|
7
|
+
|
|
6
8
|
//#region src/plugins/oauth-popup/client.d.ts
|
|
7
9
|
/** Inputs for `authClient.signIn.popup`; mirror the redirect sign-in. */
|
|
8
10
|
interface SignInPopupOptions {
|
|
@@ -50,7 +52,11 @@ interface SignInPopupDeps {
|
|
|
50
52
|
* page to post the session token back, stores it for the bearer fetch plugin,
|
|
51
53
|
* and refreshes the reactive session.
|
|
52
54
|
*/
|
|
53
|
-
declare function createSignInPopup({
|
|
55
|
+
declare function createSignInPopup({
|
|
56
|
+
$fetch,
|
|
57
|
+
options,
|
|
58
|
+
notifySessionSignal
|
|
59
|
+
}: SignInPopupDeps): (opts: SignInPopupOptions) => Promise<SignInPopupResult>;
|
|
54
60
|
/**
|
|
55
61
|
* Client plugin for popup OAuth sign-in. Adds `authClient.signIn.popup`. Pair
|
|
56
62
|
* with the server `oauthPopup` and `bearer` plugins.
|
|
@@ -60,10 +66,10 @@ declare const oauthPopupClient: () => {
|
|
|
60
66
|
version: string;
|
|
61
67
|
$InferServerPlugin: ReturnType<typeof oauthPopup>;
|
|
62
68
|
$ERROR_CODES: {
|
|
63
|
-
POPUP_SIGN_IN_FAILED:
|
|
64
|
-
POPUP_BLOCKED:
|
|
65
|
-
POPUP_CLOSED:
|
|
66
|
-
POPUP_TIMEOUT:
|
|
69
|
+
POPUP_SIGN_IN_FAILED: _$_better_auth_core_utils_error_codes0.RawError<"POPUP_SIGN_IN_FAILED">;
|
|
70
|
+
POPUP_BLOCKED: _$_better_auth_core_utils_error_codes0.RawError<"POPUP_BLOCKED">;
|
|
71
|
+
POPUP_CLOSED: _$_better_auth_core_utils_error_codes0.RawError<"POPUP_CLOSED">;
|
|
72
|
+
POPUP_TIMEOUT: _$_better_auth_core_utils_error_codes0.RawError<"POPUP_TIMEOUT">;
|
|
67
73
|
};
|
|
68
74
|
fetchPlugins: BetterFetchPlugin[];
|
|
69
75
|
getActions: ($fetch: BetterFetch, $store: ClientStore, options: BetterAuthClientOptions | undefined) => {
|
|
@@ -73,4 +79,4 @@ declare const oauthPopupClient: () => {
|
|
|
73
79
|
};
|
|
74
80
|
};
|
|
75
81
|
//#endregion
|
|
76
|
-
export {
|
|
82
|
+
export { SignInPopupOptions, SignInPopupResult, createSignInPopup, getStoredPopupToken, oauthPopupClient, popupBearerFetchPlugin };
|
|
@@ -74,12 +74,10 @@ function popupError(code, status) {
|
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
76
|
function centeredFeatures() {
|
|
77
|
-
|
|
78
|
-
const top = window.screenY + (window.outerHeight - POPUP_HEIGHT) / 2;
|
|
79
|
-
return `width=${POPUP_WIDTH},height=${POPUP_HEIGHT},left=${left},top=${top},menubar=no,toolbar=no`;
|
|
77
|
+
return `width=${POPUP_WIDTH},height=${POPUP_HEIGHT},left=${window.screenX + (window.outerWidth - POPUP_WIDTH) / 2},top=${window.screenY + (window.outerHeight - POPUP_HEIGHT) / 2},menubar=no,toolbar=no`;
|
|
80
78
|
}
|
|
81
79
|
function randomNonce() {
|
|
82
|
-
const bytes =
|
|
80
|
+
const bytes = new Uint8Array(16);
|
|
83
81
|
crypto.getRandomValues(bytes);
|
|
84
82
|
return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
85
83
|
}
|
|
@@ -202,4 +200,4 @@ const oauthPopupClient = () => {
|
|
|
202
200
|
};
|
|
203
201
|
};
|
|
204
202
|
//#endregion
|
|
205
|
-
export {
|
|
203
|
+
export { createSignInPopup, getStoredPopupToken, oauthPopupClient, popupBearerFetchPlugin };
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import * as _$_better_auth_core_utils_error_codes0 from "@better-auth/core/utils/error-codes";
|
|
2
|
+
|
|
1
3
|
//#region src/plugins/oauth-popup/error-codes.d.ts
|
|
2
4
|
declare const OAUTH_POPUP_ERROR_CODES: {
|
|
3
|
-
POPUP_SIGN_IN_FAILED:
|
|
4
|
-
POPUP_BLOCKED:
|
|
5
|
-
POPUP_CLOSED:
|
|
6
|
-
POPUP_TIMEOUT:
|
|
5
|
+
POPUP_SIGN_IN_FAILED: _$_better_auth_core_utils_error_codes0.RawError<"POPUP_SIGN_IN_FAILED">;
|
|
6
|
+
POPUP_BLOCKED: _$_better_auth_core_utils_error_codes0.RawError<"POPUP_BLOCKED">;
|
|
7
|
+
POPUP_CLOSED: _$_better_auth_core_utils_error_codes0.RawError<"POPUP_CLOSED">;
|
|
8
|
+
POPUP_TIMEOUT: _$_better_auth_core_utils_error_codes0.RawError<"POPUP_TIMEOUT">;
|
|
7
9
|
};
|
|
8
10
|
//#endregion
|
|
9
11
|
export { OAUTH_POPUP_ERROR_CODES };
|