import { MiscTypes } from '@oneblink/types'; import { getIdToken, getFormsKeyId, setFormsKeyToken } from './services/forms-key'; import { registerAuthListener, isLoggedIn, loginHostedUI, loginUsernamePassword, changePassword, forgotPassword, handleAuthentication, logoutHostedUI, getUserProfile, getUserFriendlyName, LoginAttemptResponse, checkIsMfaEnabled, disableMfa, setupMfa, generateMfaQrCodeUrl } from './services/cognito'; import { getUserToken, setUserToken } from './services/user-token'; export { registerAuthListener, loginHostedUI, loginUsernamePassword, handleAuthentication, logoutHostedUI, changePassword, forgotPassword, isLoggedIn, getIdToken, getUserProfile, getFormsKeyId, setFormsKeyToken, getUserToken, setUserToken, getUserFriendlyName, LoginAttemptResponse, checkIsMfaEnabled, disableMfa, setupMfa, generateMfaQrCodeUrl, }; /** * Log the current user out and remove an data stored locally by the user e.g. * drafts. * * #### Example * * ```js * await authService.logout() * ``` */ export declare function logout(): Promise; /** * Initialize the service with required configuration. **This must be done * before using before some of the function in this service.** * * #### Example * * ```js * authService.init({ * oAuthClientId: 'YOUR_OAUTH_CLIENT_ID', * }) * ``` * * @param options */ export declare function init({ oAuthClientId }: { oAuthClientId: string; }): void; /** * Determine if the current user is a OneBlink App User for a OneBlink Forms * App. Returns `false` if the current user is not logged in. * * #### Example * * ```js * const formsAppId = 1 * const isAuthorised = await authService.isAuthorised(formsAppId) * if (!isAuthorised) { * // handle unauthorised user * } * ``` * * @param formsAppId * @param abortSignal * @returns */ export declare function isAuthorised(formsAppId: number, abortSignal?: AbortSignal): Promise; /** * Get the current user's App User details for a OneBlink Forms App. Returns * `undefined` if the current user is not logged in. * * #### Example * * ```js * const formsAppId = 1 * const formsAppUserDetails = * await authService.getCurrentFormsAppUser(formsAppId) * if (!formsAppUserDetails) { * // handle unauthorised user * } * ``` * * @param formsAppId * @returns */ export declare function getCurrentFormsAppUser(formsAppId: number, abortSignal?: AbortSignal): Promise<{ userProfile?: MiscTypes.UserProfile; formsAppId: number; groups: string[]; } | undefined>; /** * If the current user is not a Forms App User, this function will send a * request on behalf of the current user to the OneBlink Forms App * administrators to request access. * * #### Example * * ```js * const formsAppId = 1 * await authService.requestAccess(formsAppId) * // Display a message to user indicating a request has been sent to the application administrators * ``` * * @param formsAppId */ export declare function requestAccess(formsAppId: number): Promise; /** * Allow a user to sign up to a forms app. * * #### Example * * ```js * await authService.signUp({ * formsAppId: 1, * email: 'test@oneblink.io', * firstName: 'first', * lastName: 'last', * }) * ``` * * @param {formsAppId, email, generatePassword, firstName, lastName} * @returns */ export declare function signUp({ formsAppId, email, firstName, lastName, }: { formsAppId: number; email: string; firstName?: string; lastName?: string; }): Promise;