@astro-auth/core
Version:
The core package of the Astro Auth library
32 lines (26 loc) • 1.13 kB
TypeScript
import { OAuthConfig, CredentialConfig, MetamaskConfig } from '@astro-auth/types';
export { OAuthConfig, OAuthUserOptions } from '@astro-auth/types';
import { AstroGlobal } from 'astro';
import jwt from 'jsonwebtoken';
interface AstroAuthParams {
authProviders?: (OAuthConfig | CredentialConfig | MetamaskConfig)[];
hooks?: {
jwt?: (user: any) => Promise<any>;
signIn?: (user: any) => Promise<boolean | string>;
redirectError?: (error: Error) => Promise<string>;
account?: (user: any) => Promise<any>;
};
}
declare const AstroAuth: (astroAuthParams: AstroAuthParams) => ({ params: { astroauth }, request, }: {
params: {
astroauth: string;
};
request: Request;
}) => Promise<Response>;
declare const getUser: ({ client, server, }: {
client?: AstroGlobal | undefined;
server?: Request | undefined;
}) => string | jwt.JwtPayload | null | undefined;
declare const redirectUser: (loginPage: string) => Response;
declare const getError: (astro: AstroGlobal) => string | null;
export { AstroAuth as default, getError, getUser, redirectUser };