import type { RequestEvent } from 'nuxt/server'; import * as jose from 'jose'; import type { OAuthProvider, OnError } from '#auth-utils'; export declare const isDevelopment: boolean; export declare function isOAuthCookieSecure(): boolean; export declare function getOAuthRedirectURL(event: RequestEvent): string; /** * Request an access token body. * * @see https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.3 */ export interface RequestAccessTokenBody { grant_type: 'authorization_code'; code: string; redirect_uri: string; client_id: string; client_secret?: string; [key: string]: string | undefined; } export interface RequestAccessTokenOptions { body?: RequestAccessTokenBody; params?: Record; headers?: Record; } /** * Request an access token from the OAuth provider. * * When an error occurs, only the error data is returned. * * @see https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.3 */ export declare function requestAccessToken(url: string, options: RequestAccessTokenOptions): Promise; /** * Handle OAuth access token error response * * @see https://datatracker.ietf.org/doc/html/rfc6749#section-5.2 */ export declare function handleAccessTokenErrorResponse(event: RequestEvent, oauthProvider: OAuthProvider, oauthError: any, onError?: OnError): any; export declare function handleMissingConfiguration(event: RequestEvent, provider: OAuthProvider, missingKeys: string[], onError?: OnError): any; export declare function handleInvalidState(event: RequestEvent, provider: OAuthProvider, onError?: OnError): any; /** * JWT signing using jose * * @see https://github.com/panva/jose */ interface JWTSignOptions { privateKey: string; keyId: string; teamId?: string; clientId?: string; algorithm?: 'ES256' | 'RS256'; expiresIn?: string; } export declare function signJwt>(payload: T, options: JWTSignOptions): Promise; /** * Verify a JWT token using jose - will throw error if invalid * * @see https://github.com/panva/jose */ interface JWTVerifyOptions { publicJwkUrl: string; audience: string; issuer: string; } export declare function verifyJwt(token: string, options: JWTVerifyOptions): Promise; export declare function handlePkceVerifier(event: RequestEvent): Promise<{ code_verifier: string; code_challenge: string; code_challenge_method: string; } | { code_verifier: string | undefined; code_challenge?: undefined; code_challenge_method?: undefined; }>; interface HandleStateOptions { isCallback?: boolean; sameSite?: 'lax' | 'none' | 'strict'; } export declare function handleState(event: RequestEvent, options?: HandleStateOptions): Promise; export declare function parseJwt(token: string): jose.JWTPayload; export declare function handleNonce(event: RequestEvent): string | undefined; export {};