UNPKG

@httpc/kit

Version:

httpc toolbox for building function-based API with minimal code and end-to-end type safety

24 lines (23 loc) 1.41 kB
import type { ILogger } from "../logging"; import { JwtPayload, JwtService } from "./JwtService"; import { IAuthenticationService } from "./types"; export type BearerAuthenticationServiceOptions = { jwtSecret: string; onDecodePayload?: (payload: JwtPayload) => Promise<IUser>; }; declare const BearerAuthenticationService_base: { new (logger: ILogger, ...args: any[]): import("../services")._BaseService<"not_found" | "invalid_param" | "unauthorized" | "forbidden" | "not_allowed" | "invalid_state" | "misconfiguration" | "not_supported" | "processing_error" | "expired">; }; export declare class BearerAuthenticationService extends BearerAuthenticationService_base implements IAuthenticationService<string> { protected readonly jwt: JwtService; protected readonly options: BearerAuthenticationServiceOptions; constructor(logger: ILogger, jwt: JwtService, options: BearerAuthenticationServiceOptions); authenticate(token: string): Promise<IUser>; protected onDecode(payload: JwtPayload): Promise<IUser>; } export declare class DefaultBearerAuthenticationServiceOptions implements BearerAuthenticationServiceOptions { readonly jwtSecret: string; readonly onDecodePayload?: ((payload: JwtPayload) => Promise<IUser>) | undefined; constructor(jwtSecret: string, onDecodePayload?: ((payload: JwtPayload) => Promise<IUser>) | undefined); } export {};