fsl-js-sdk
Version:
sdk for web
78 lines (77 loc) • 2.69 kB
TypeScript
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 */
/** 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;
discoveryDoc?: string;
scopes?: string;
}
interface ILoginOptions {
appleOptions: AppleOptions;
googleOptions: GoogleOptions;
cloudOptions: ICloudOptions;
googleCloudOptions: GoogleCloudOptions;
platform?: string;
}
declare class LoginBase {
private _googleApp;
auth: import("firebase/auth").Auth;
private refresh;
private googleProvider;
private googleOptions;
private googleCloudOptions;
private tokenClient;
private client;
private platform;
private cloudOptions;
private appleOptions;
constructor(options: ILoginOptions & {
refresh: boolean;
});
static init(options: ILoginOptions): LoginBase;
checkHasLogin(): Promise<any>;
initAppleEnvironment(): Promise<void>;
initAppleCloudEnvironment(): Promise<any>;
initGoogleCloudEnvironment(): Promise<unknown> | undefined;
loginGoogleCloud(): Promise<unknown>;
handleLogin({ type, data }: HandleLoginParams): Promise<import("axios").AxiosResponse<any, any> | undefined>;
sendSms(email: string): Promise<import("axios").AxiosResponse<any, any>>;
getBindQrCode(): Promise<import("axios").AxiosResponse<any, any>>;
doCodeCheck(data: string[]): Promise<import("axios").AxiosResponse<any, any>>;
getFilePwdMsg(data: string[]): Promise<import("axios").AxiosResponse<any, any>>;
}
export { LoginBase as default };