import { type IdentityPlugin } from "@nifrajs/core/server"; import { type MaybePromise } from "./_utils.js"; export type BasicAuthPlugin
= IdentityPlugin & { principal(request: Request): P | null; requirePrincipal(request: Request): P; }; export interface BasicAuthStaticOptions
{ readonly username: string; readonly password: string; readonly principal?: P; readonly realm?: string; readonly optional?: boolean; } export interface BasicAuthVerifyOptions
{ readonly verify: (username: string, password: string) => MaybePromise
;
readonly realm?: string;
readonly optional?: boolean;
}
/**
* HTTP Basic authentication. Prefer short-lived Basic Auth for internal tools and staging gates, not
* public user login. Static credentials are compared in constant time after SHA-256 hashing; the
* callback form is available for external stores.
*/
export declare function basicAuth(options: BasicAuthStaticOptions): BasicAuthPlugin (options: BasicAuthStaticOptions ): BasicAuthPlugin ;
export declare function basicAuth (options: BasicAuthVerifyOptions ): BasicAuthPlugin ;
//# sourceMappingURL=basic-auth.d.ts.map