Installation
Requirements
- React Native 0.73+
- iOS 14.0+ / Android SDK 24+
- Node.js 18+
1. Configure npm Access
The SDK is a private npm package. Add your access token to .npmrc in your project root:
.npmrc
//registry.npmjs.org/:_authToken=<YOUR_NPM_TOKEN>
Replace <YOUR_NPM_TOKEN> with the token provided by Surt. This token is only used to install the package - it is separate from the Surt API key your backend uses to mint JWTs.
warning
Add .npmrc to your .gitignore to avoid committing tokens.
2. Install the Package
npm install @surtai/guardian-rn
iOS Setup
Install CocoaPods dependencies:
cd ios && pod install && cd ..
Android Setup
Android links automatically. No extra steps needed.
3. Platform Permissions
Android: android/app/src/main/AndroidManifest.xml
If you enable location collection:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
If you enable SIM card info collection:
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
iOS: ios/<YourApp>/Info.plist
If you enable location collection:
<key>NSLocationWhenInUseUsageDescription</key>
<string>Your location helps verify your identity and protect your account.</string>
The WiFi, SIM and camera options have no effect on iOS, so they need no Info.plist key.
tip
The SDK shows the location permission prompt during verify() or collect() when location collection is enabled. You only need to declare the permissions.
Troubleshooting
| Error | Cause | Fix |
|---|---|---|
npm 404 Not Found | Missing or invalid npm token | Check .npmrc has a valid _authToken |
| Pod install fails | CocoaPods cache issue | Run cd ios && pod install --repo-update |
| iOS build: "module not found" | Pods out of sync | Run cd ios && pod install after npm install |