UNPKG

wombo-dream-api

Version:
88 lines (87 loc) 2.47 kB
import { AuthorisationCache, CredentialsBody } from './types'; export declare class GoogleAuthentifier { secret_key: string; credentials?: CredentialsBody | undefined; signUpUserUrlTemplate: string; signInUserUrlTemplate: string; tokenRefreshUrlTemplate: string; authorisationDataCache: AuthorisationCache; constructor(secret_key: string, credentials?: CredentialsBody | undefined); buildSignUpUserUrl(): string; buildTokenRefreshUrl(): string; buildSignInUserUrl(): string; /** * Sign up a new user * * @example Sign up as anonymous * ```ts * authentifierInstance.signUp().then(console.log) * ``` * @example Sign up as new user * ```ts * authentifierInstance.signUp({ * email: "my@mail.com", * password: "myPassword" * }).then(console.log) * ``` */ signUp(signUpBody?: CredentialsBody): Promise<AuthorisationCache>; /** * Sign in * * @example Sign in with instance credentials *```ts * authentifierInstance.signIn().then(console.log) * ``` * * @example Sign in with new credentials * ```ts * authentifierInstance.signIn({ * email: "my@mail.com", * password: "myPassword" * }).then(console.log) * ``` */ signIn(signInBody?: CredentialsBody): Promise<AuthorisationCache>; /** * Map the fetched data to the AuthorisationCache */ private setAuthorisationDataCacheFromFetchedData; /** * Always obtain a valid authorisation token * * @example * ```ts * authentifierInstance.obtainAuthorisationToken().then(console.log) * ``` */ obtainAuthorisationToken(): Promise<string>; /** * Refresh the current authorisation token * * @example * ```ts * authentifierInstance.refreshAuthorisationToken().then(console.log) * ``` */ refreshAuthorisationToken(): Promise<AuthorisationCache>; /** * Makes sure that the authorisation cache is valid * * @example * ```ts * authentifierInstance.ensureCacheValidity().then(console.log) * ``` */ ensureCacheValidity(): Promise<AuthorisationCache>; /** * Test if the authorisation cache is valid * * @example * ```ts * authentifierInstance.isCacheValid().then(console.log) * ``` */ isCacheValid(): boolean; } export default GoogleAuthentifier;