@vyltr/react-native
v1.0.0
Published
Vyltr anti-bot SDK for React Native — behavioral bot detection for iOS and Android
Maintainers
Readme
@vyltr/react-native
Behavioral bot detection for React Native — iOS & Android
No CAPTCHA. No friction. RGPD compliant. 2-minute setup.
Installation
npm install @vyltr/react-native
# or
yarn add @vyltr/react-nativeNo native module. No linking required. Works with Expo.
Quick Start
1. Initialize in App.js
import { useEffect } from 'react';
import { initVyltr, destroyVyltr } from '@vyltr/react-native';
export default function App() {
useEffect(() => {
initVyltr('YOUR_SITE_ID'); // Get your Site ID from vyltr.ai/dashboard
return () => destroyVyltr();
}, []);
return <YourApp />;
}2. Track touch interactions (root View)
import { useVyltrTracking } from '@vyltr/react-native';
import { View } from 'react-native';
export default function RootLayout({ children }) {
const { panHandlers } = useVyltrTracking();
return <View style={{ flex: 1 }} {...panHandlers}>{children}</View>;
}3. Track form inputs
import { useVyltrInput } from '@vyltr/react-native';
import { TextInput } from 'react-native';
export default function LoginForm() {
const emailTracking = useVyltrInput();
const passwordTracking = useVyltrInput();
return (
<>
<TextInput placeholder="Email" {...emailTracking} />
<TextInput placeholder="Password" secureTextEntry {...passwordTracking} />
</>
);
}4. Verify before sensitive actions (login, register, checkout)
import { useVyltrVerify } from '@vyltr/react-native';
export default function LoginButton() {
const { flushAndGetId } = useVyltrVerify();
const handleLogin = async () => {
const sessionId = await flushAndGetId();
const response = await fetch('https://your-backend.com/api/login', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ email, password, vyltr_session_id: sessionId }),
});
// ...
};
return <Button onPress={handleLogin} title="Se connecter" />;
}5. Server-side verification (Node.js / Python / PHP)
// Node.js
const { VyltrClient } = require('@vyltr/sdk');
const vyltr = new VyltrClient({ apiKey: process.env.VYLTR_API_KEY });
app.post('/login', async (req, res) => {
const { vyltr_session_id } = req.body;
const result = await vyltr.verify({ sessionId: vyltr_session_id });
if (result.is_bot) {
return res.status(403).json({ error: 'Accès refusé' });
}
// continue login logic
});Signals collected
| Signal | Description |
|--------|-------------|
| touch_events | Total touch interactions |
| touch_trajectory | Last 20 touch positions (x, y, timestamp) |
| tap_count | Number of taps |
| scroll_count | Number of scroll events |
| keystroke_count | Keystrokes detected |
| form_fill_speed_cps | Typing speed (chars/second) |
| time_to_first_interaction_ms | Delay before first touch |
| session_duration_ms | Total session duration |
| platform | ios or android |
| is_emulator | Emulator/simulator detection |
| screen_width / screen_height | Device screen dimensions |
All data is anonymized, stored in France, and RGPD compliant.
No PII collected. No third-party sharing.
API Reference
initVyltr(siteId, options?)
Initialize the SDK. Call once at app startup.
| Parameter | Type | Description |
|-----------|------|-------------|
| siteId | string | Your Site ID from the Vyltr dashboard |
| options.flushIntervalMs | number | Signal flush interval in ms (default: 8000) |
useVyltrTracking()
Hook — returns panHandlers to spread on a root View for automatic touch tracking.
useVyltrInput()
Hook — returns onFocus and onChangeText to spread on TextInput for keystroke tracking.
useVyltrVerify()
Hook — returns flushAndGetId() async function to call before sensitive actions.
destroyVyltr()
Stop the SDK and flush remaining signals. Call in App cleanup.
Expo compatibility
Compatible with Expo SDK 47+. No native modules, no ejection required.
Support
- Documentation: vyltr.ai/docs
- Email: [email protected]
- Issues: github.com/hagen-entreprise-digiit/cybersec-ai-platform
