UNPKG

smc-hub

Version:

CoCalc: Backend webserver component

74 lines (73 loc) 2.47 kB
import { Router } from "express"; import { PostgreSQL } from "./postgres/types"; import { PassportStrategy } from "smc-webapp/account/passport-types"; declare type login_info_keys = "id" | "first_name" | "last_name" | "full_name" | "emails"; export interface PassportStrategyDB extends PassportStrategy { clientID?: string; clientSecret?: string; authorizationURL?: string; tokenURL?: string; userinfoURL?: string; login_info?: { [key in login_info_keys]?: string; }; public?: boolean; disabled?: boolean; exclusive_domains?: string[]; } export declare function remember_me_cookie_name(): string; export declare function generate_hash(algorithm: any, salt: any, iterations: any, password: any): string; export declare function password_hash(password: any): string; interface InitPassport { router: Router; database: PostgreSQL; host: string; cb: (err?: any) => void; } export declare function get_passport_manager(): PassportManager | null; export declare function init_passport(opts: InitPassport): Promise<void>; interface PassportManagerOpts { router: Router; database: PostgreSQL; host: string; } export declare class PassportManager { readonly router: Router; readonly database: PostgreSQL; readonly host: string; private strategies; private auth_url; constructor(opts: PassportManagerOpts); private init_passport_settings; private handle_get_api_key; private strategies_v1; get_strategies_v2(): PassportStrategy[]; private strategies_v2; init(): Promise<void>; private extra_strategy_constructor; private init_extra_strategies; private init_strategy; private passport_login; private check_remember_me_cookie; private check_passport_exists; private check_existing_emails; private set_email_verified; private create_account; private maybe_create_account; private maybe_record_sign_in; private maybe_provision_api_key; private handle_new_sign_in; private is_user_banned; } interface IsPasswordCorrect { database: PostgreSQL; password: string; password_hash?: string; account_id?: string; email_address?: string; allow_empty_password?: boolean; cb: (err?: any, correct?: boolean) => void; } export declare function is_password_correct(opts: IsPasswordCorrect): Promise<void>; export declare function verify_email_send_token(opts: any): Promise<void>; export {};