import type { RandomService } from "./random.ts"; import type { Store } from "./store.ts"; import type { TokenService } from "./tokens.ts"; /** * @ignore * * An in-progress authentication, being stored while the client completes their challenge */ export interface AuthnRequest { userId: number; redirect: string; code: number; } /** * @ignore * * Intermediary parameters to present to the user to complete their authentication */ export interface AuthnCheck { token: string; code: number; } /** * @ignore * * Completed credentials after completing an authentication, * including cookie+redirected headers and the redirect itself */ export interface AuthnResult { token: string; headers: Headers; redirect: string; } /** * @ignore */ export interface AbstractAuthenticationService { check(token: string | undefined | null, code: string | number | undefined | null): Promise; start(userId: number, redirectUrl: string | URL): Promise; finish(request: AuthnRequest): Promise; } /** * @ignore */ export declare function formatAuthenticationCode(code: number): string; /** * @ignore */ export interface AuthenticationServiceOptions { allowedHosts: () => URL[] | Promise; cookieName: string; /** milliseconds */ loginDuration: number; /** milliseconds */ sessionDuration: number; } /** @ignore */ export declare class AuthenticationService implements AbstractAuthenticationService { options: AuthenticationServiceOptions; store: Store; random: RandomService; tokens: TokenService; constructor(options: AuthenticationServiceOptions, store: Store, random: RandomService, tokens: TokenService); _canRedirect(input: string | URL, hosts: URL[]): boolean; check(token: string | undefined | null, code: string | number | undefined | null): Promise; start(userId: number, redirectUrl: string | URL): Promise; finish(request: AuthnRequest): Promise; } //# sourceMappingURL=authentication.d.ts.map