> ## Documentation Index
> Fetch the complete documentation index at: https://docs.prem.io/llms.txt
> Use this file to discover all available pages before exploring further.

# React Native (BareKit)

> Run the Prem TypeScript SDK inside a react-native-bare-kit worklet.

Building a mobile app? You get the same confidentiality and security as on the server. The `@premai/api-sdk` TypeScript client runs inside a [react-native-bare-kit](https://github.com/holepunchto/react-native-bare-kit) worklet. It encrypts each request on the device, before the request leaves the phone. The Prem API Gateway sees only ciphertext. The enclave opens the request inside a Trusted Execution Environment (TEE).

The encryption path is identical to the [standard client](/quickstart). The worklet runs the same WASM cryptography, so the [security model](/security-model) and [attestation](/attestation) guarantees also apply on mobile. This is the same method that powers [Sotto](https://sotto.prem.io), Prem's confidential dictation app.

<Tip>
  Want a working starting point? The [`reticle-expo`](https://github.com/prem-research/reticle-expo) example app runs the worklet on iOS and Android. It verifies enclave attestation from the device, with no server-side proxy. Clone it and use it as a scaffold for your own app.
</Tip>

## Pass an assets directory

Pass an `assets` directory to `new Worklet(...)`. bare-kit extracts the bundled assets to that directory at startup. It then rewrites the paths to real `file://` URLs. The WASM module loads from disk on the fast path.

```js theme={"system"}
import { Worklet } from "react-native-bare-kit";
import * as FileSystem from "expo-file-system";

const cacheDir = new FileSystem.Directory(FileSystem.Paths.cache, "reticle-assets");
if (!cacheDir.exists) cacheDir.create();

const worklet = new Worklet({
  assets: cacheDir.uri.replace(/^file:\/\//, ""),
});
await worklet.start("/worklet.bundle", source);
```

<Note>
  If you omit `assets`, the SDK falls back to an inline base64 copy of the WASM bytes. The disk path is faster, so pass `assets` when you can.
</Note>

## Related

<CardGroup cols={2}>
  <Card title="reticle-expo example" icon="github" href="https://github.com/prem-research/reticle-expo" arrow="true">
    Clone the example Expo app and use it as a scaffold.
  </Card>

  <Card title="Attestation" icon="shield-check" href="/attestation" arrow="true">
    See how the device verifies real confidential hardware.
  </Card>

  <Card title="Confidential Proxy" icon="server" href="/confidential-proxy" arrow="true">
    Learn the proxy modes, routes, keys, and daemon controls.
  </Card>

  <Card title="Quickstart" icon="rocket" href="/quickstart" arrow="true">
    Send your first encrypted request with the TypeScript client.
  </Card>
</CardGroup>
