React Native Sample
A small Expo app that generates proofs and lets you inspect the verdict: it starts the SDK, asks sdk.loc.isWithin(...), and shows what comes back. It lives in the sample/ folder of the octet-sdk-react-native repository.
Unlike the iOS and Android samples, it has no Verify tab, because the wrapper doesn't include Octet.verify. Check its proofs on your backend with octet-verify.
What it does
| Button | What you should see |
|---|---|
start() |
started, the license state, and the native SDK version |
isWithin(country("US")) |
YES in the US and NO elsewhere, each with a proof |
| nonce 0 bytes | INDETERMINATE, reason INVALID_SESSION_NONCE |
| nonce 513 bytes | INDETERMINATE, reason INVALID_SESSION_NONCE |
The last two buttons show that a session nonce out of range comes back as a verdict, not as an error. They pass if they return a verdict at all. If one throws, the screen shows THREW (unexpected).
INDETERMINATE is not a NO. It means the SDK can't answer right now. See Verdicts.
The proof panel shows the length of proof_bytes_b64, never the proof itself. See Proofs.
Setup
cd sample
npm install
The sample takes the wrapper from npm. There is no license key to paste: the SDK activates by attesting the app on a real device, so register the sample's app id under your Octet account first, as described in Prerequisites.
Build and run
npx expo prebuild --clean
npx expo run:android # or: npx expo run:ios
expo prebuild creates ios/ and android/ and applies the wrapper's config plugin, which sets the permission strings, the iOS deployment target, Octet's Maven repository and minSdkVersion.
The sample also adopts the UIScene life cycle, which iOS 27 requires, through plugins/withSceneLifecycle.js. Without it, the app stops at launch.
Run on a real device
The sample needs a physical device. The iOS Simulator can't attest the app, and the Android SDK ships arm64-v8a only, so the standard emulator can't run it.
What's off
No proof leaves the device: proof upload stays off unless you set proofUploadUrl. Background location is off too. To try it, add { "backgroundLocation": true } to the plugin options in app.json.
See also
- React Native: install, permissions and the API.
- Verifier Quick Start: check the sample's proofs.