UNPKG

fsl-js-sdk

Version:
94 lines (73 loc) 2.57 kB
import { IUserInfo } from '../api'; declare namespace loginBase { type HandleLoginParams = { type: 'FSL' | 'GOOGLE' | 'APPLE' | '2FA'; data?: Record<'email' | 'code', string>; }; /** fireBase sdk configuration for the web project in the project */ interface GoogleOptions { apiKey: string; authDomain: string; projectId: string; storageBucket: string; messagingSenderId: string; appId: string; measurementId?: string; } interface AppleOptions { /** Application ID or service ID */ clientId: string; /** A secret JSON Web token generated by the developer */ /** Refer to https://developer.okta.com/blog/2019/06/04/what-the-heck-is-sign-in-with-apple */ // clientSecret: string; /** Use the target URI provided in the authorization request when your application authorizes users */ redirectURI: string; /** Login to obtain user information */ scope?: string; /** Log in to call a random value of the whole process */ state?: string; /** only the pop-up box can be opened */ usePopup: boolean; } interface ICloudOptions { /** And generate a web token through CloudKit Dashboard. */ apiToken: string; /** Change this to a container identifier you own. */ container: string; environment?: string; databaseName?: string; } interface GoogleCloudOptions { clientId: string; apiKey: string; // Discovery doc URL for APIs used by the quickstart discoveryDoc?: string; // Authorization scopes required by the API; multiple scopes can be // included, separated by spaces. scopes?: string; } interface ILoginOptions { appleOptions: AppleOptions; googleOptions: GoogleOptions; cloudOptions: ICloudOptions; googleCloudOptions: GoogleCloudOptions; platform?: string; } interface LoginBase { cloudOptions: ICloudOptions; init(options: ILoginOptions): LoginBase; checkHasLogin(): Promise<Record<string, any> | null>; initAppleEnvironment(): Promise<void>; initAppleCloudEnvironment(): Promise<Record<string, any>>; initGoogleCloudEnvironment(): Promise<void>; loginGoogleCloud(): Promise<string>; handleLogin(params: HandleLoginParams): Promise<IUserInfo>; sendSms(email: string): Promise<any>; getBindQrCode(): Promise<any>; doCodeCheck(data: string[]): Promise<any>; getFilePwdMsg(data: string[]): Promise<any>; initGoogleCloudToken(): Promise<boolean>; } } declare const LoginBase: loginBase.LoginBase; export = LoginBase;