@keverdjs/react
v1.7.1
Published
React SDK for Keverd fraud detection and device fingerprinting
Downloads
377
Maintainers
Readme
@keverdjs/react
React integration for the Keverd fraud detection and device fingerprinting SDK.
Installation
npm install @keverdjs/reactUsage
For optimal performance in React ecosystems, initialize the SDK on mount and explicitly request the fingerprint token right before performing an essential protected action.
import { useEffect } from 'react';
import { Keverd } from '@keverdjs/react';
export default function LoginPage() {
useEffect(() => {
// Initialize once globally
Keverd.init('YOUR_PUBLIC_API_KEY');
// Optional: cleanup
return () => Keverd.destroy();
}, []);
const handleLogin = async (e) => {
e.preventDefault();
// Request the heavily deterministic device context right before action
const deviceId = await Keverd.get();
// Attach to backend logic
await fetch('/api/login', {
method: 'POST',
body: JSON.stringify({
...payload,
keverd_device_id: deviceId
})
});
};
return (
<form onSubmit={handleLogin}>
{/* Your form fields */}
<button type="submit">Login</button>
</form>
)
}