UNPKG

905 BTypeScriptView Raw
1import { Callback, HttpError, RemoteUser } from '../commons';
2import { Config } from '../configuration';
3export interface AuthPluginPackage {
4 packageName: string;
5 packageVersion?: string;
6 tag?: string;
7}
8export declare type AuthError = HttpError & {
9 code: number;
10};
11export declare type AuthAccessCallback = (error: AuthError | null, access: boolean) => void;
12export declare type AuthCallback = (error: AuthError | null, groups: string[] | false) => void;
13export interface IBasicAuth<T> {
14 config: T & Config;
15 aesEncrypt(username: string, password: string): string;
16 authenticate(user: string, password: string, cb: Callback): void;
17 changePassword(user: string, password: string, newPassword: string, cb: Callback): void;
18 allow_access(pkg: AuthPluginPackage, user: RemoteUser, callback: Callback): void;
19 add_user(user: string, password: string, cb: Callback): any;
20}