better-auth
Version:
The most comprehensive authentication library for TypeScript.
105 lines (98 loc) • 4.02 kB
TypeScript
import { P as ProviderOptions, O as OAuth2Tokens } from '../shared/better-auth.ClXlabtY.js';
export { a as OAuthProvider } from '../shared/better-auth.ClXlabtY.js';
import * as jose from 'jose';
import { p as AuthContext, G as GenericEndpointContext, U as User, L as Account } from '../shared/better-auth.CUMpWXN6.js';
export { g as generateState, p as parseState } from '../shared/better-auth.B5AIJRmu.js';
import '../shared/better-auth.ZSfSbnQT.js';
import 'zod/v4';
import 'kysely';
import 'better-call';
import 'zod/v4/core';
import 'zod';
import 'better-sqlite3';
import 'bun:sqlite';
declare function createAuthorizationURL({ id, options, authorizationEndpoint, state, codeVerifier, scopes, claims, redirectURI, duration, prompt, accessType, responseType, display, loginHint, hd, responseMode, additionalParams, scopeJoiner, }: {
id: string;
options: ProviderOptions;
redirectURI: string;
authorizationEndpoint: string;
state: string;
codeVerifier?: string;
scopes: string[];
claims?: string[];
duration?: string;
prompt?: string;
accessType?: string;
responseType?: string;
display?: string;
loginHint?: string;
hd?: string;
responseMode?: string;
additionalParams?: Record<string, string>;
scopeJoiner?: string;
}): Promise<URL>;
declare function validateAuthorizationCode({ code, codeVerifier, redirectURI, options, tokenEndpoint, authentication, deviceId, headers, additionalParams, }: {
code: string;
redirectURI: string;
options: ProviderOptions;
codeVerifier?: string;
deviceId?: string;
tokenEndpoint: string;
authentication?: "basic" | "post";
headers?: Record<string, string>;
additionalParams?: Record<string, string>;
}): Promise<OAuth2Tokens>;
declare function validateToken(token: string, jwksEndpoint: string): Promise<jose.JWTVerifyResult<jose.JWTPayload>>;
declare function refreshAccessToken({ refreshToken, options, tokenEndpoint, authentication, extraParams, grantType, }: {
refreshToken: string;
options: ProviderOptions;
tokenEndpoint: string;
authentication?: "basic" | "post";
extraParams?: Record<string, string>;
grantType?: string;
}): Promise<OAuth2Tokens>;
declare function generateCodeChallenge(codeVerifier: string): Promise<string>;
declare function getOAuth2Tokens(data: Record<string, any>): OAuth2Tokens;
declare const encodeOAuthParameter: (value: string) => string;
declare function decryptOAuthToken(token: string, ctx: AuthContext): string | Promise<string>;
declare function setTokenUtil(token: string | null | undefined, ctx: AuthContext): string | Promise<string> | null | undefined;
declare function handleOAuthUserInfo(c: GenericEndpointContext, { userInfo, account, callbackURL, disableSignUp, overrideUserInfo, }: {
userInfo: Omit<User, "createdAt" | "updatedAt">;
account: Omit<Account, "id" | "userId" | "createdAt" | "updatedAt">;
callbackURL?: string;
disableSignUp?: boolean;
overrideUserInfo?: boolean;
}): Promise<{
error: string;
data: null;
isRegister?: undefined;
} | {
error: string;
data: null;
isRegister: boolean;
} | {
data: {
session: {
id: string;
userId: string;
expiresAt: Date;
createdAt: Date;
updatedAt: Date;
token: string;
ipAddress?: string | null | undefined;
userAgent?: string | null | undefined;
};
user: {
id: string;
email: string;
emailVerified: boolean;
name: string;
createdAt: Date;
updatedAt: Date;
image?: string | null | undefined;
};
};
error: null;
isRegister: boolean;
}>;
export { OAuth2Tokens, ProviderOptions, createAuthorizationURL, decryptOAuthToken, encodeOAuthParameter, generateCodeChallenge, getOAuth2Tokens, handleOAuthUserInfo, refreshAccessToken, setTokenUtil, validateAuthorizationCode, validateToken };