# 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/`](https://github.com/octetproof/octet-sdk-react-native/tree/main/sample) folder of the `octet-sdk-react-native` repository.

Unlike the [iOS](/docs/mobile/samples/ios-toy-app/) and [Android](/docs/mobile/samples/android-toy-app/) samples, it has no Verify tab, because the wrapper doesn't include `Octet.verify`. Check its proofs on your backend with [`octet-verify`](/docs/mobile/getting-started/verifier-quickstart/).

## 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](/docs/mobile/concepts/verdicts/).

The proof panel shows the length of `proof_bytes_b64`, never the proof itself. See [Proofs](/docs/mobile/getting-started/react-native/#proofs).

## Setup

```bash
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](/docs/mobile/getting-started/prerequisites/).

## Build and run

```bash
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](/docs/mobile/getting-started/react-native/): install, permissions and the API.
- [Verifier Quick Start](/docs/mobile/getting-started/verifier-quickstart/): check the sample's proofs.
