UNPKG

802 BTypeScriptView Raw
1import type { GuardFactory } from './types.js';
2/**
3 * Authenticator client is used to create guard instances for testing.
4 * It passes a fake HTTPContext to the guards, so make sure to not
5 * call server side APIs that might be relying on a real
6 * HTTPContext instance.
7 */
8export declare class AuthenticatorClient<KnownGuards extends Record<string, GuardFactory>> {
9 #private;
10 /**
11 * Name of the default guard
12 */
13 get defaultGuard(): keyof KnownGuards;
14 constructor(config: {
15 default: keyof KnownGuards;
16 guards: KnownGuards;
17 });
18 /**
19 * Returns an instance of a known guard. Guards instances are
20 * cached during the lifecycle of an HTTP request.
21 */
22 use<Guard extends keyof KnownGuards>(guard?: Guard): ReturnType<KnownGuards[Guard]>;
23}