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.
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>
If you enable camera info collection:
<key>NSCameraUsageDescription</key>
<string>Camera access helps verify device authenticity.</string>
tip
The SDK handles runtime permission prompts automatically during verify(). You only need to declare the permissions. No additional permission code is needed.
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 |