@zally-sdk/sdk-react-native
v1.6.0
Published
React Native SDK for zally – one npm package that wraps the native iOS and Android zally SDKs
Readme
@zally-sdk/sdk-react-native
React Native SDK for zally — wraps the native iOS and Android SDKs behind a single JavaScript API.
Requirements
- React Native >= 0.72
- iOS 17.0+
- Android: minSdk 23, compileSdk 36, Java 17, AndroidX
Installation
npm install @zally-sdk/sdk-react-native
# or
yarn add @zally-sdk/sdk-react-nativeiOS
Expo managed projects — add the plugin in app.json:
{
"expo": {
"plugins": ["@zally-sdk/sdk-react-native"]
}
}Then run npx expo prebuild or npx expo run:ios.
Bare React Native — set your deployment target to iOS 17.0, add the zally pod to your Podfile:
pod 'zally-sdk', :podspec => 'https://raw.githubusercontent.com/zally-ltd/zally-ios-sdk-package/main/zally-sdk.podspec'Then cd ios && pod install && cd ...
Android
No extra setup — the native dependency is resolved automatically.
Usage
import zally from '@zally-sdk/sdk-react-native';
// 1. Initialize (call once after user login)
await zally.initialize({
appUUID: 'your-app-uuid',
getClientToken: async () => {
// Fetch a JWT from your backend
return await yourBackend.getZallyToken();
},
});
// 2. Start
await zally.start();
// 3. Check state
const state = await zally.getUserState();
console.log(state?.trainingState, state?.zIdStatus, state?.isUser);
// 4. Stop (e.g. on logout)
await zally.stop();API
| Method | Returns | Description |
|--------|---------|-------------|
| initialize({ appUUID, getClientToken }) | Promise<void> | Initialize and authorize the SDK. getClientToken is an async function returning a JWT string from your backend. Call once after user login. |
| start() | Promise<void> | Start sensor data collection and streaming. Call after initialize(). |
| stop() | Promise<void> | Stop the SDK (e.g. on user logout). |
| isInitialized() | Promise<boolean> | Whether initialization and authorization completed successfully. |
| isRunning() | Promise<boolean> | Whether the SDK is actively collecting data. |
| getUserState() | Promise<UserState \| null> | Current user state (training progress, identity verification). Maps to Android userState / iOS BiometricState. |
UserState
{
trainingState: string; // "UNTRAINED" | "TRAINING" | "TRAINED"
zIdStatus: string; // "UNKNOWN" | "USER" | "IMPOSTER" | "INACTIVE"
isUser: boolean; // true if verified as the legitimate user
isImposter: boolean; // true if potential imposter detected (Android: zIdStatus.IMPOSTER; iOS: derived from server response)
}License
Apache-2.0
