> ## 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](https://docs.prem.io/quickstart.md). The worklet runs the same WASM cryptography, so the [security model](https://docs.prem.io/security-model.md) and [attestation](https://docs.prem.io/attestation.md) 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.

## 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.

## Related

> [card] [reticle-expo example](https://github.com/prem-research/reticle-expo)
>
> Clone the example Expo app and use it as a scaffold.

> [card] [Attestation](https://docs.prem.io/attestation.md)
>
> See how the device verifies real confidential hardware.

> [card] [Confidential Proxy](https://docs.prem.io/confidential-proxy.md)
>
> Learn the proxy modes, routes, keys, and daemon controls.

> [card] [Quickstart](https://docs.prem.io/quickstart.md)
>
> Send your first encrypted request with the TypeScript client.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.