Confidential Compute attestation from mobile —
@premai/reticleWASM running inside a QuickJS worklet via bare-wasm3, not JavaScriptCore.
Verifies that a Prem Confidential API gateway is backed by real confidential hardware directly from an iOS or Android device — interpreter-based, zero external dependencies, no server-side proxy.
Tap Attest. The app returns:
{
"cpuType": "SEV",
"hasGpu": true
}cpuType — whether the remote enclave is running on AMD SEV-SNP or Intel TDX.
hasGpu — whether a trusted GPU is attached to that enclave.
Mobile WebAssembly is a dead end. JavaScriptCore (the JS engine embedded in React Native on iOS/Android) does not expose a WebAssembly API to user code, and even platforms that do can't execute wasm-bindgen FFI modules without JIT. This app routes around the problem entirely:
- A BareKit worklet spawns a QuickJS isolate in a background thread inside the RN process — a second JS engine the app fully controls.
@premai/bare-wasm3monkey-patchesglobalThis.WebAssemblyinside that worklet, a pure-interpreter WASM runtime that needs no JIT and runs on any CPU.- The
@premai/reticleWASM module (compiled withwasm-bindgen) loads and executes insidebare-wasm3exactly as it would in a browser.
The result: a complete TEE attestation flow from a phone, with the only JS engine that matters being the one you own.
React Native (Hermes) BareKit Worklet (QuickJS)
┌──────────────────────┐ ┌────────────────────────────────┐
│ app/index.tsx │ IPC │ worklets/attestation-worklet │
│ useAttestation() │ ◄──────────► │ .js │
│ ReticleWorkletBridge│ JSON lines │ │
│ │ │ require('bare-wasm3/global') │
│ Worklet.start() │ │ → wasm3 patches WebAssembly │
│ worklet.IPC.write() │ │ │
│ │ │ import('@premai/api-sdk') │
│ │ │ → ClientBuilder │
│ │ │ → request_modules() │
└──────────────────────┘ └────────────────────────────────┘
Two JS engines, one process. Hermes owns the UI; QuickJS owns WASM execution. Communication is newline-delimited JSON over a Duplex IPC pipe.
- macOS with Xcode installed
- Bun
- PREM Confidential API: docs.prem.io
# Install — runs patch-package, links iOS prebuilds, bundles the worklet
bun install
# iOS simulator or device
bun run ios