mirror of
https://github.com/wassname/talk.git
synced 2026-07-15 11:26:58 +08:00
* feat: replaced custom auth extraction logic with permit * fix: fixed tests
31 lines
884 B
TypeScript
31 lines
884 B
TypeScript
// TODO: (wyattjoh) following https://github.com/DefinitelyTyped/DefinitelyTyped/pull/29061 to merge then replace this with @types/permit.
|
|
declare module "permit" {
|
|
import { IncomingMessage, ServerResponse } from "http";
|
|
|
|
export interface PermitOptions {
|
|
scheme?: string;
|
|
proxy?: string;
|
|
realm?: string;
|
|
}
|
|
|
|
export interface BearerOptions extends PermitOptions {
|
|
basic?: string;
|
|
header?: string;
|
|
query?: string;
|
|
}
|
|
|
|
export class Permit {
|
|
constructor(options: PermitOptions);
|
|
check(req: IncomingMessage): void;
|
|
fail(res: ServerResponse): void;
|
|
}
|
|
|
|
export class Bearer extends Permit {
|
|
constructor(options: BearerOptions);
|
|
check(req: IncomingMessage): string;
|
|
}
|
|
|
|
export class Basic extends Permit {
|
|
check(req: IncomingMessage): [string, string];
|
|
}
|
|
} |