Hooks
In-depth hooks reference: data fetching and mutations, cache behavior, auth/session hooks, and common usage patterns for the Humanity React SDK.
TypeScript Types
// Auth
type AuthStatus = 'loading' | 'authenticated' | 'unauthenticated';
type Environment = 'production' | 'sandbox';
type StorageStrategy = 'memory' | 'localStorage' | 'sessionStorage';
type OAuthMode = 'popup' | 'redirect';
// User profile (returned after login)
interface UserProfile {
sub: string; // Unique user ID
email?: string;
name?: string;
humanity_score?: number;
// Additional fields depending on granted scopes
}
// Auth operation result
interface AuthResult {
user: UserProfile;
accessToken: string;
}
// Verification result
interface VerificationResult {
preset: string;
verified: boolean;
status: 'valid' | 'expired' | 'pending' | 'unavailable';
expiresAt?: string;
}
type PresetStatus = 'valid' | 'expired' | 'pending' | 'unavailable';useHumanity()
useHumanity()Field
Type
Description
useAuth()
useAuth()Field
Type
Description
useVerification()
useVerification()Field
Type
Description
usePresets()
usePresets()Field
Type
Description
useCredentialUpdates()
useCredentialUpdates()Option
Type
Default
Description
Field
Type
Description
Last updated