import React, { ReactNode } from 'react';
import { PersSDK, PersConfig, DefaultAuthProvider } from '@explorins/pers-sdk/core';
import { UserDTO, AdminDTO } from '@explorins/pers-shared';
export type { PersConfig } from '@explorins/pers-sdk/core';
/**
* Context interface for PERS SDK React Native integration
*
* ## Session Restoration Behavior
*
* Session restoration is **asynchronous**. When the app starts:
* 1. `isInitialized` becomes `true` when SDK is ready
* 2. Session restoration happens automatically
* 3. `isAuthenticated` and `user` update when restoration completes
*
* **Always check `isInitialized` AND `isAuthenticated` before using `user`:**
*
* ```tsx
* const { user, isInitialized, isAuthenticated } = usePersSDK();
*
* if (!isInitialized) return ;
* if (!isAuthenticated || !user) return ;
* return ;
* ```
*
* **Why `user` might be null on app restart:**
* - Access tokens expire after 1 hour (auto-refreshed if app is active)
* - Refresh tokens expire after 30 days (user must re-login)
* - Session restoration is in progress
*
* Listen for auth events to debug:
* ```typescript
* sdk.events.subscribe((event) => {
* console.log('[Auth Event]', event.type, event.details);
* }, { domains: ['authentication'], replay: true });
* ```
*
* | Event | Meaning |
* |-------|---------|
* | `session_restored` | Tokens valid, user logged in |
* | `session_restoration_failed` | Tokens expired, needs re-login |
*
* @property sdk - Main SDK instance (null until initialized)
* @property authProvider - Platform-specific auth provider
* @property isInitialized - Whether SDK has been initialized (not whether user is authenticated!)
* @property isAuthenticated - Whether user is currently authenticated
* @property user - Current user data (null if not authenticated OR restoration in progress)
*/
export interface PersSDKContext {
sdk: PersSDK | null;
authProvider: DefaultAuthProvider | null;
isInitialized: boolean;
isAuthenticated: boolean;
user: UserDTO | AdminDTO | null;
initialize: (config: PersConfig) => Promise;
setAuthenticationState: (user: UserDTO | AdminDTO | null, isAuthenticated: boolean) => void;
refreshUserData: () => Promise;
restoreSession: () => Promise;
}
/**
* PERS SDK Provider for React Native
*
* Wraps your app to provide SDK context to all child components.
* Handles platform-specific initialization (DPoP, storage, etc.).
*
* @param config - SDK configuration (see PersConfig)
* @param config.apiProjectKey - Your PERS project key (required)
* @param config.environment - 'staging' | 'production' (default: 'staging')
* @param config.captureWalletEvents - Enable real-time blockchain events (default: true)
* @param config.dpop - DPoP configuration for enhanced security
*
* @example Basic usage
* ```tsx
*
*
*
* ```
*
* @example Disable wallet events
* ```tsx
*
*
*
* ```
*/
export declare const PersSDKProvider: React.FC<{
children: ReactNode;
config?: PersConfig;
}>;
export declare const usePersSDK: () => PersSDKContext;
//# sourceMappingURL=PersSDKProvider.d.ts.map