facezk-core
Version:
ZKP-AI Proof of Humanity: Live Selfie Check with Biometric Template Extraction and Fuzzy Hashing
54 lines • 1.96 kB
TypeScript
/**
* React Hook for FaceZK Integration
* Provides a complete React integration with state management
*/
import { FaceZK } from '../index';
import type { FaceZKConfig, SessionState, HumanityResult } from '../index';
import type { VerificationOptions } from '../core/facezk-core';
import { FaceZKError } from '../errors';
export interface UseFaceZKState {
/** FaceZK instance */
facezk: FaceZK | null;
/** Current session */
session: SessionState | null;
/** Current state */
state: 'idle' | 'initializing' | 'completed' | 'detecting' | 'challenging' | 'verifying' | 'failed';
/** Latest verification result */
result: HumanityResult | null;
/** Current error */
error: FaceZKError | null;
/** Loading state */
loading: boolean;
/** Progress (0-1) */
progress: number;
}
export interface UseFaceZKConfig {
/** FaceZK configuration */
config?: FaceZKConfig;
/** Auto-initialize on mount */
autoInitialize?: boolean;
/** Callback when verification completes */
onVerificationComplete?: (result: HumanityResult) => void;
/** Callback when error occurs */
onError?: (error: FaceZKError) => void;
/** Callback when session state changes */
onSessionChange?: (session: SessionState | null) => void;
}
export interface UseFaceZKActions {
/** Initialize FaceZK */
initialize: (config?: FaceZKConfig) => Promise<void>;
/** Start a new session */
startSession: () => void;
/** Process a frame */
processFrame: (input: any, options?: Partial<VerificationOptions>) => Promise<HumanityResult | null>;
/** Reset current session */
resetSession: () => void;
/** Dispose FaceZK */
dispose: () => Promise<void>;
}
export type UseFaceZKReturn = UseFaceZKState & UseFaceZKActions;
/**
* React hook for FaceZK integration
*/
export declare function useFaceZK(config?: UseFaceZKConfig): UseFaceZKReturn;
//# sourceMappingURL=useFaceZK.d.ts.map