
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
@behindmycodes/react-native-caps
Advanced tools
React Native integration for Cap widget and invisible solver via WebView
A small React Native helper library that integrates Cap in native apps via a WebView.
It wraps the browser-based @cap.js/widget (web component + WASM) so you can plug it into React Native with minimal configuration. Includes both a visible widget and an invisible solver.
<cap-widget> rendered inside a WebViewnew Cap({ apiEndpoint }).solve()solve, error, reset, progressfetch and customizable WASM URL>= 0.74>= 18react-native-webview installed in the appapiEndpointInstall from npm:
npm i @behindmycodes/react-native-caps react-native-webview
# or
yarn add @behindmycodes/react-native-caps react-native-webview
Import the components and provide your Cap API endpoint. The device must be able to reach this URL.
import { CapsWidget, CapsInvisible } from '@behindmycodes/react-native-caps';
// Visible widget
<CapsWidget
apiEndpoint="http://192.168.1.10:3000/api/cap"
onSolve={(token) => console.log('CAP token', token)}
onError={(msg) => console.log('CAP error', msg)}
onWebViewLoadStart={() => console.log('WebView loading started')}
onWebViewLoadProgress={(p) => console.log('WebView loading progress', p)}
onWebViewLoadEnd={() => console.log('WebView loading ended')}
onWebViewError={(msg) => console.log('WebView load error', msg)}
hideAttribution
i18n={{ verifyingLabel: 'Verifying...', initialState: "I'm a human" }}
cssVars={{ 'cap-widget-width': '260px', 'cap-widget-height': '60px' }}
workerCount={8}
/>
// Invisible mode
<CapsInvisible
apiEndpoint="http://192.168.1.10:3000/api/cap"
onSolved={(token) => console.log('CAP token', token)}
onError={(msg) => console.log('CAP error', msg)}
onWebViewLoadStart={() => console.log('WebView loading started')}
onWebViewLoadProgress={(p) => console.log('WebView loading progress', p)}
onWebViewLoadEnd={() => console.log('WebView loading ended')}
onWebViewError={(msg) => console.log('WebView load error', msg)}
/>
CapsWidgetRenders the Cap widget inside a WebView and bridges its events back to React Native.
Props:
apiEndpoint: string — your Cap API base URLonSolve?: (token: string) => void — called when a token is generatedonError?: (message: string) => void — called on widget erroronReset?: () => void — called when the widget resetsonProgress?: (detail: unknown) => void — progress updates during verificationonWebViewLoadStart?: () => void — WebView started loadingonWebViewLoadEnd?: () => void — WebView finished loadingonWebViewLoadProgress?: (progress: number) => void — WebView load progress 0..1onWebViewError?: (message: string) => void — WebView load error messagehideAttribution?: boolean — hides the widget attribution using ::part(attribution)i18n?: Partial<{ verifyingLabel; initialState; solvedLabel; errorLabel; wasmDisabled; verifyAriaLabel; verifyingAriaLabel; verifiedAriaLabel; errorAriaLabel }> — maps to data-cap-i18n-* and ARIA attrscssVars?: Record<string, string> — sets CSS variables on the cap-widget element (keys should be the tail of --cap-*, e.g. { 'cap-background': '#fff' })workerCount?: number — sets data-cap-worker-countwasmUrl?: string — custom WASM JS loader URLoriginWhitelist?: string[] — forwarded to WebView originWhitelistcustomFetch?: boolean — if true, sets window.CAP_CUSTOM_FETCH = (url, opts) => fetch(url, opts) inside the WebViewCapsInvisibleLoads the Cap widget script as an ES module and triggers solve() immediately. No UI.
Props:
apiEndpoint: stringonSolved: (token: string) => voidonError?: (message: string) => voidonWebViewLoadStart?: () => voidonWebViewLoadEnd?: () => voidonWebViewLoadProgress?: (progress: number) => voidonWebViewError?: (message: string) => voidwasmUrl?: stringoriginWhitelist?: string[]customFetch?: booleanSet any of the supported attributes on the widget via the i18n prop (they map to data-cap-i18n-* and ARIA attributes):
<CapsWidget
apiEndpoint="/api/cap"
i18n={{
verifyingLabel: 'Verifying...',
initialState: "I'm a human",
solvedLabel: "I'm a human",
errorLabel: 'Error',
wasmDisabled: 'Enable WASM for significantly faster solving',
}}
/>
You can restyle the widget by providing cssVars. Example keys (correspond to --cap-*):
cap-backgroundcap-border-colorcap-border-radiuscap-widget-heightcap-widget-widthcap-widget-paddingcap-fontcap-spinner-color<CapsWidget
apiEndpoint="/api/cap"
cssVars={{
'cap-background': '#fdfdfd',
'cap-widget-height': '60px',
'cap-widget-width': '260px',
'cap-font': 'system, -apple-system, Roboto, Segoe UI, sans-serif',
}}
/>
Override the widget’s network calls by enabling customFetch. This sets window.CAP_CUSTOM_FETCH inside the WebView:
<CapsWidget apiEndpoint="/api/cap" customFetch />
If you need more control, modify the implementation to inject your own function that adds headers or handles auth.
You can override the default WASM loader URL via wasmUrl. By default, it uses:
https://cdn.jsdelivr.net/npm/@cap.js/wasm@0.0.4/browser/cap_wasm.min.js
Host your own file if needed and pass its URL.
Your server must implement the Cap API and be reachable from the device. If you rely on cookies or auth, ensure the WebView has appropriate session state and headers.
@cap.js/widget is a web component that relies on DOM and WebAssembly.@behindmycodes org.packages/react-native-caps/package.json following semver.cd packages/react-native-caps
npm publish --access public
If your npm account has 2FA for publishing, use --otp <code> or set an NPM_TOKEN in a local .npmrc:
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
Repository: https://github.com/chief-fanatic/react-native-caps
import/no-unresolved for react-native-webview: install it in the app; it’s a peer dependency.apiEndpoint is correct and reachable from the device (use an absolute IP on LAN).CapsWidget: packages/react-native-caps/src/widget/CapsWidget.tsx:1CapsInvisible: packages/react-native-caps/src/widget/CapsInvisible.tsx:1packages/react-native-caps/src/widget/types.ts:1MIT
FAQs
React Native integration for Cap widget and invisible solver via WebView
We found that @behindmycodes/react-native-caps demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.