@botshield-dev/react-native
v0.1.2
Published
BotShield React Native SDK - WebView bridge for mobile bot protection
Maintainers
Readme
@botshield-dev/react-native
React Native wrapper for BotShield mobile WebView flow.
Status
Experimental (Phase 1): uses hosted /mobile/widget inside react-native-webview.
Install
npm i @botshield-dev/react-native react-native-webviewBasic usage
import { BotShieldModal, useBotShield } from '@botshield-dev/react-native'
const BASE_URL = 'https://captcha.example.com'
const PUBLIC_KEY = 'sc_live_xxx'
export function SignupScreen() {
const botshield = useBotShield()
async function onSolved(payload: {
captcha_challenge: string
captcha_nonce: number
captcha_signature: string
}) {
const res = await fetch(`${BASE_URL}/api/v1/verify`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ key: PUBLIC_KEY, ...payload }),
})
const { success } = await res.json()
if (!success) return
// Continue signup/login flow
}
return (
<>
<Button title="Continue" onPress={botshield.open} />
<BotShieldModal
baseUrl={BASE_URL}
publicKey={PUBLIC_KEY}
visible={botshield.visible}
onSolved={onSolved}
onCancel={botshield.close}
/>
</>
)
}Notes
- Your project must have Mobile Apps enabled in dashboard settings.
- This package is a wrapper; captcha UI/solver runs in hosted widget page.
