import React from "react"; import { IAMService, NativeAdapter, AdminAPI } from '@tidecloak/js'; type AuthSuccessCallback = () => void | Promise; type AuthErrorCallback = (error: Error) => void; type LogoutCallback = () => void; type ReauthCallback = () => void; export type ActionNotificationType = 'success' | 'error' | 'info' | 'warning'; export interface ActionNotification { type: ActionNotificationType; title: string; message?: string; action?: string; } type ActionNotificationCallback = (notification: ActionNotification) => void; export interface TideCloakContextValue { isInitializing: boolean; initError: Error | null; authenticated: boolean; sessionExpired: boolean; isRefreshing: boolean; isLoading: boolean; isOffline: boolean; wasOffline: boolean; needsReauth: boolean; token: string | null; idToken: string | null; tokenExp: number | null; baseURL: string; IAMService: typeof IAMService; AdminAPI: typeof AdminAPI; getConfig: () => Record; reload: () => void; login: () => Promise; logout: () => Promise; getToken: () => Promise; refreshToken: () => Promise; forceRefreshToken: () => Promise; hasRealmRole: (role: string) => boolean; hasClientRole: (role: string, resource?: string) => boolean; getValueFromToken: (key: string) => any; getValueFromIdToken: (key: string) => any; triggerReauth: () => void; clearReauth: () => void; resetWasOffline: () => void; doEncrypt: (data: any) => Promise; doDecrypt: (data: any) => Promise; secureFetch: (url: string | URL | RequestInfo, init?: RequestInit) => Promise; initializeTideRequest: Uint8Array; }>(request: T) => Promise; getVendorId: () => string; getResource: () => string; approveTideRequests: (requests: { id: string; request: Uint8Array; }[]) => Promise<{ id: string; approved?: { request: Uint8Array; }; denied?: boolean; pending?: boolean; }[]>; } export interface TideCloakContextProviderProps { children: React.ReactNode; /** * Full TideCloak configuration. If not provided, will be fetched from configUrl. */ config?: Record; /** * URL to fetch adapter.json from. Defaults to '/adapter.json'. * Only used if config prop is not provided. */ configUrl?: string; /** * Authentication mode. Must be explicitly specified. * - 'native': For Electron/Tauri/React Native apps (requires adapter prop) * - 'hybrid': Server-side token exchange (tokens held server-side) * - undefined: Standard frontchannel mode (browser-based) */ authMode?: 'native' | 'hybrid'; /** * Native adapter for Electron/Tauri/React Native apps. * Required when authMode is 'native'. * * @example * ```tsx * * * * ``` */ adapter?: NativeAdapter; onAuthSuccess?: AuthSuccessCallback; onAuthError?: AuthErrorCallback; onLogout?: LogoutCallback; onReauthRequired?: ReauthCallback; /** * Callback for action notifications (approvals, encryption, etc.) * Use this to integrate with your own notification system (toast, snackbar, etc.) * * @example * ```tsx * { * toast[type](message || title); * }} * > * ``` */ onActionNotification?: ActionNotificationCallback; } export declare function TideCloakContextProvider({ config: configProp, configUrl, authMode, adapter, children, onAuthSuccess, onAuthError, onLogout, onReauthRequired, onActionNotification }: TideCloakContextProviderProps): React.JSX.Element; export declare function useTideCloakContext(): TideCloakContextValue; export {}; //# sourceMappingURL=TideCloakContextProvider.d.ts.map