UNPKG

@authava/react-client

Version:

React client library for seamless integration with Authava's white-label authentication service

40 lines 1.79 kB
import React from 'react'; import { AuthavaClient, AuthavaConfig, SessionState, AuthavaSession } from '@authava/client'; interface AuthavaContextType { isLoading: boolean; session: AuthavaSession | null; sessionState: SessionState; logout: () => void; login: AuthavaClient['login']; register: AuthavaClient['register']; forgotPassword: AuthavaClient['forgotPassword']; resetPassword: AuthavaClient['resetPassword']; verifyMfa: AuthavaClient['verifyMfa']; sendMfaEmail: AuthavaClient['sendMfaEmail']; getProfile: AuthavaClient['getProfile']; changeEmail: AuthavaClient['changeEmail']; changePassword: AuthavaClient['changePassword']; updateNotificationPreferences: AuthavaClient['updateNotificationPreferences']; removeMfaMethod: AuthavaClient['removeMfaMethod']; setupEmailMfa: AuthavaClient['setupEmailMfa']; verifyEmailMfa: AuthavaClient['verifyEmailMfa']; setupTotp: AuthavaClient['setupTotp']; verifyTotp: AuthavaClient['verifyTotp']; hasRole: (r: string | string[]) => boolean; hasPermission: (p: string | string[]) => boolean; } export interface AuthavaProviderProps { config: AuthavaConfig; children: React.ReactNode; /** * Controls how session state is maintained. * - "protected" (default): Automatically refreshes session and calls logout when session is invalid. * - "public": Updates session state but does not trigger automatic logout or refetch events. */ sessionMode?: 'protected' | 'public'; useMock?: boolean; } export declare function AuthavaProvider({ config, children, sessionMode, useMock, }: AuthavaProviderProps): React.JSX.Element; export declare function useAuthava(): AuthavaContextType; export {}; //# sourceMappingURL=AuthavaContext.d.ts.map