Choosing a field library
A field worker’s phone or handheld runs one of five shapes of app. FlowCatalyst ships a library for each, and they all speak the same field protocol to the platform. This page helps you pick one. For how the identity model works (PINs, device keys, sessions) read Field-worker identity first.
Every library does the same job: it makes and guards the device key, enrols the device if asked,
signs the worker in with a PIN or badge, keeps the session alive by refreshing, and signs your
application’s HTTP requests with a proof (Authorization: DPoP <token> plus a DPoP header). Your
application never handles a PIN.
The five shapes
Section titled “The five shapes”| Your app is | Use | Key and storage | Version |
|---|---|---|---|
| A web page in a browser, or a PWA | @flowcatalyst/field-js |
Non-extractable WebCrypto key and IndexedDB, in the browser | 0.6.0 |
A web page inside a React Native WebView |
@flowcatalyst/field-js in the page, @flowcatalyst/field-react-native as the host |
The page asks the host for the key and storage over the bridge (protocol v1) | 0.6.0 |
| A React Native app with native screens | @flowcatalyst/field-react-native (FieldClient) |
The native session owner: Android Keystore, or iOS Secure Enclave and Keychain | 0.7.0 |
| A native Android app, or a foreground service | io.flowcatalyst:field-android (FieldSession) |
Android Keystore (StrongBox first, then the TEE) | 0.7.0 |
| A native iOS app | field-ios (Swift package; FieldSession) |
Secure Enclave key and Keychain | 0.5.0 |
flowchart TD
start{"What renders the screens?"} -->|"A browser tab or PWA"| js["field-js"]
start -->|"HTML inside a React Native WebView"| both["field-js in the page<br/>+ field-react-native bridge host"]
start -->|"React Native components"| rn["field-react-native FieldClient<br/>(over field-android)"]
start -->|"Kotlin or Java"| and["field-android FieldSession"]
field-js: browsers and WebViews
Section titled “field-js: browsers and WebViews”TypeScript, ESM, no runtime dependencies beyond the Web platform (crypto.subtle, fetch,
indexedDB, customElements). It runs in a browser, in a React Native WebView and in Node 22 or
later for tests. It gives you FieldAuth (enrol, login, refresh, change PIN, logout, act as, an
authenticated fetch), the <fc-pin-pad> element for gloved hands, and PushStream for
live updates.
The key is a software key held by the browser. Its attestation level is SOFTWARE, so a client that
requires hardware attestation (requireAttestation in the field policy) cannot use it on its own.
In a WebView the bridge replaces it with the host’s hardware-backed key.
field-react-native: the bridge and the native session
Section titled “field-react-native: the bridge and the native session”A bare React Native module (New Architecture only, React Native 0.76 or later; no Expo dependency, though an Expo config plugin is included). It has two jobs:
- WebView bridge host.
useFieldBridge({ allowedOrigins })returns props to spread on areact-native-webview<WebView>. The page’s field-js then uses the native key and secure store instead of WebCrypto. The host answers only pages whose origin is on the allow-list. - Native session for React Native screens.
FieldClientis a thin bridge to the Kotlin session owner on Android and to the Swift session owner (field-ios, below) on iOS, with the same method names andSessionshape as field-js.
On iOS the package carries a copy of the field-ios sources and compiles them with the bridge, so a
native iOS module in the same app (background location, for example) can reach the same session by
importing FlowcatalystFieldReactNative. The iOS side has run on the simulator only; a physical iPhone
(real Secure Enclave key, Face ID and Touch ID, background behaviour) has not been tried. See
field-react-native for the differences from Android.
field-android: the one session owner on Android
Section titled “field-android: the one session owner on Android”A Kotlin AAR (minSdk 26, compileSdk 35; OkHttp 4, coroutines, androidx.biometric). No UI, no React
Native dependency, never needs the main thread. FieldSession.get(context, config) is the
process-wide owner of the keys, tokens, refresh and nonce cache. It exists so that a tracking
service and the screens share one session: refresh tokens rotate, so two owners in one process
would fight, and a reused rotated token revokes the whole login family.
That gives the rule for mixed apps: on Android there is one owner per process. A React Native
app’s JavaScript screens and its Kotlin foreground service both go through FieldSession; the
service must run in the app’s process (no android:process).
field-ios: the Swift session owner for iOS
Section titled “field-ios: the Swift session owner for iOS”clients/field-ios in the platform repository is a Swift package (iOS 15+, macOS 12+) with two library targets,
FlowCatalystFieldCore (the session state machine, DPoP proofs, token refresh, nonces and request retry, written against
protocols) and FlowCatalystField (the Secure Enclave key, the Keychain store, the Face ID, Touch ID and passcode unlock,
and a URLSession transport). It has no UI and is the iOS counterpart of field-android: the same requests, DPoP
proofs, state machine, timers and error codes. Its FieldSession is an actor.
Each release is published to its own repository, github.com/flowcatalyst/field-ios (Swift Package Manager reads
Package.swift at a repository root), and an app depends on a version:
.package(url: "https://github.com/flowcatalyst/field-ios.git", from: "0.5.0"),// target dependency:.product(name: "FlowCatalystField", package: "field-ios")Status. Released as 0.5.0. It is tested in CI (on Linux and macOS, and built for iOS) and has run on the iOS simulator (its tests, and through the React Native package). It has not been run on a physical device: the Secure Enclave key, the Keychain store and the Face ID unlock are unverified on real hardware.
Choosing
Section titled “Choosing”- The worker’s screens are web pages you already host. Use field-js. If the app is wrapped in React Native for hardware access, add the bridge host so the key is hardware-backed.
- React Native screens, with background uploads or a tracking service. Use field-react-native
and write the service in Kotlin against
FieldSession(Android) or in Swift throughimport FlowcatalystFieldReactNative(iOS). - A fully native Android app. Use field-android directly.
- A fully native iOS app. Use field-ios, knowing that it has not been run on a physical device yet (see above). A WebView with field-js and the bridge host works on iOS for sign-in.
What differs between them
Section titled “What differs between them”| field-js (browser) | field-js via bridge | field-react-native / field-android | |
|---|---|---|---|
| Device key | WebCrypto, non-extractable, SOFTWARE |
Keystore or Secure Enclave | Keystore, StrongBox first, else TEE |
| Refresh token storage | IndexedDB | Native store | Keystore AES-GCM, no user authentication |
| Biometric | Gates the stored refresh token (unlock()) |
Same, via the native store | An app unlock, not a token gate |
| Unlock keys (platform-verified biometric sign-in) | Not supported | Not supported | Yes, on enrolled personal phones (Android 11 or later, iOS) |
| Background refresh | Only while the page is alive | Only while the page is alive | Yes (keepAlive), also after a reboot |
| Foreground service sharing | n/a | n/a | Yes, one owner per process |
On iOS the process is suspended in the background, so keepAlive and the expiry-warning timers run only while the
app runs (or under a background mode the app declares, such as location); a refresh is also done on first use.
The biometric difference is deliberate. On the native path the refresh token has to be usable by a
background service with no prompt, so the biometric guards the app’s screens after a cold start or
time in the background (UnlockPolicy / requireUnlock) rather than the token. The token is already
useless off the device because it is bound to a non-exportable key. In every library, biometric
unlock applies only to enrolled PERSONAL devices and never to an impersonated session; on a
SHARED device the worker signs in with the PIN every time.
Unlock keys are a different thing: they sign a worker in again after a session has ended, with a
fingerprint or face, and the platform verifies a signature from a key held in the phone’s secure
hardware (the session’s amr is ["hwk","uv"]). They need a native library, so field-js, which runs
in a browser, does not offer them; a field-js page inside a React Native WebView does not get them
either (the React Native app can offer them through FieldClient). See
Unlock keys.
Rules every library follows
Section titled “Rules every library follows”- The library is the only code that touches a PIN or a device key. The PIN is passed through to
/field/*, never stored, never logged, never put in an error message. - There is no offline sign-in. A worker who is signed out cannot sign in until there is signal. A
session that is still signed in stays signed in while the platform cannot be reached: the library
never ends a session by the device’s clock, only when the platform refuses a refresh
(
SESSION_EXPIRED,INVALID_GRANT,DEVICE_REVOKED, and so on), when aninvalid_tokensurvives a refresh, or on logout. A call that cannot reach the platform fails withNETWORKand changes nothing. When signal returns the first request refreshes, and if the session’s idle or absolute limit passed meanwhile the platform ends it and the worker signs in again. The same holds on Android, iOS and in the browser. Keep your offline queue across that sign-in. - Store offline requests unsigned and sign them when you send. A stored proof fails anyway: platform nonces are single use, application nonces last about 5 to 10 minutes, and access tokens live 10 minutes.
- Only the refresh endpoints on the platform URL ever receive the refresh token.
Installing
Section titled “Installing”The field libraries are not on a package registry. Install them from their git tags:
field-jsandfield-react-native:"@flowcatalyst/field-js": "github:flowcatalyst/field-js#v0.6.0"and"@flowcatalyst/field-react-native": "github:flowcatalyst/field-react-native#v0.7.0". The published repositories hold the built packages. field-js is at v0.6.0 and field-react-native at v0.7.0; use the tag of the release you want (each package’sVERSIONfile shows the current number).field-android:io.flowcatalyst:field-android:0.7.0from GitHub Packages (https://maven.pkg.github.com/flowcatalyst/flowcatalyst; reads need a token withread:packages). See field-android for the Gradle setup.field-ios: the Swift packagehttps://github.com/flowcatalyst/field-ios.git, version 0.5.0 (Swift Package Manager). A React Native app does not add it:field-react-nativecarries a copy.