A React Native module for integrating the OpenOrigins camera SDK with your mobile applications. This module provides seamless access to advanced camera capabilities including photo capture, video recording, depth sensing, and device attestation.
⚠️ Before you start: You must contact OpenOrigins at support@openorigins.com to obtain an API key and a Google Cloud project number — the SDK cannot be used without them. See Installation and Play Integrity Setup for details.
Platform Support: This library supports both iOS and Android. Depth/3D camera capture is currently iOS only.
- Features
- Installation
- Example App
- Quick Start
- API Reference
- Configuration Examples
- Device Attestation
- Security Features
- Platform Support
- Architecture
- Troubleshooting
- License
- Contributing
- 📷 Multi-format Capture: Support for photo and video capture, plus depth mode capture (iOS only)
- ⚙️ 35+ Configuration Options: Extensive control over camera behavior, sensor data, video settings, and UI
- 🔐 Device Attestation: Built-in device integrity verification using iOS App Attest and Android Play Integrity
- 📱 Cross-Platform: Optimized for iOS 13+ and Android
- 🛡️ Security-first: Secure token storage and RSA encryption
- 📊 Media Management: Queue and manage captured media
- 🎯 Production Ready: Built with TurboModule for optimal performance
- 💡 Complete Example App: Comprehensive demo showcasing all features
- 📝 Full TypeScript Support: Complete type definitions included
Note: You will need an API key to initialize the module at runtime (see initialise()). Contact OpenOrigins to request an API key for your app. The SDK binaries bundled with this package are proprietary and distributed under separate terms — see NOTICE.
Using npm:
npm install github:OpenOrigins/react-native-source-cameraUsing yarn:
yarn add github:OpenOrigins/react-native-source-cameraUsing a specific version/tag:
npm install github:OpenOrigins/react-native-source-camera#v1.0.0You can also add the dependency directly to your package.json:
{
"dependencies": {
"react-native-source-camera": "github:OpenOrigins/react-native-source-camera"
}
}Or with a specific version/tag:
{
"dependencies": {
"react-native-source-camera": "github:OpenOrigins/react-native-source-camera#v1.0.0"
}
}Install dependencies using CocoaPods:
cd ios && pod install && cd ..Note: This library is currently iOS-only. Ensure you are developing for iOS 13 or later.
The camera module requires several iOS permissions to function properly. You must configure these in your app's Info.plist file.
For Expo projects, add the following to your app.json:
{
"expo": {
"ios": {
"infoPlist": {
"NSCameraUsageDescription": "$(PRODUCT_NAME) needs access to your Camera.",
"NSMicrophoneUsageDescription": "$(PRODUCT_NAME) needs access to your Microphone.",
"NSMotionUsageDescription": "$(PRODUCT_NAME) needs access to your motion device to ensure authenticity of media.",
"NSPhotoLibraryUsageDescription": "$(PRODUCT_NAME) needs access to your Photo Library to save photos and videos to your library.",
"NSLocationWhenInUseUsageDescription": "$(PRODUCT_NAME) needs access to your location to ensure authenticity of media.",
"NSLocationAlwaysAndWhenInUseUsageDescription": "$(PRODUCT_NAME) needs access to your location to ensure authenticity of media.",
}
}
}
}For bare React Native projects, add the following keys to your ios/YourApp/Info.plist:
<key>NSCameraUsageDescription</key>
<string>This app needs access to your Camera.</string>
<key>NSMicrophoneUsageDescription</key>
<string>This app needs access to your Microphone.</string>
<key>NSMotionUsageDescription</key>
<string>This app needs access to your motion device to ensure authenticity of media.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>This app needs access to your Photo Library to save photos and videos to your library.</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>This app needs access to your location to ensure authenticity of media.</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>This app needs access to your location to ensure authenticity of media.</string>Required Permissions Explained:
| Permission | Purpose |
|---|---|
NSCameraUsageDescription |
Required for photo and video capture |
NSMicrophoneUsageDescription |
Required for video recording with audio |
NSMotionUsageDescription |
Required to collect motion sensor data for media authenticity |
NSPhotoLibraryUsageDescription |
Required if using saveToCameraRoll option |
NSLocationWhenInUseUsageDescription |
Required to collect location data for media authenticity |
NSLocationAlwaysAndWhenInUseUsageDescription |
Required for location data collection |
Important: Customize the usage descriptions to match your app's specific use case. The descriptions shown above are examples and should be tailored to your application.
The Android module is linked automatically via autolinking — no extra native setup is required beyond a standard React Native/Expo build. minSdkVersion is 21, with compileSdkVersion/targetSdkVersion of 31 or higher.
Note: Depth/3D camera capture (
enableDepthMode) is currently iOS only and is not available on Android.
Android device attestation uses the Google Play Integrity API. To enable Play Integrity on Android, you must send OpenOrigins the email address of the account associated with your app. Attestation will not work on Android until OpenOrigins has configured this for you.
See Play Integrity Setup for step-by-step setup instructions.
A comprehensive demo application is included in the example/demo-app directory, showcasing all features and configuration options. The example app includes:
- Interactive Configuration UI: Test all 35+ camera configuration options in real-time
- Session Preview: View and explore captured media with metadata inspection
- Media Queue Gallery: Browse all queued media items
- Full TypeScript Support: Complete type definitions and examples
- Production-Ready Architecture: React context, navigation, and state management patterns
To run the example app:
cd example/demo-app
npm install
npx expo startSee the example app README for detailed setup instructions.
import RNOOCamera from 'react-native-source-camera';
// Initialize with your API key
await RNOOCamera.initialise({
apiKey: 'your-api-key',
useProduction: true,
user: 'user-id',
token: 'optional-token'
});const capturedMedia = await RNOOCamera.openCamera({
closeAfterCapture: true,
enablePhotoMode: true,
enableVideoMode: true,
enableDepthMode: false,
showLastCapture: true
});// Get list of captured media
const mediaList = await RNOOCamera.mediaList();
// Get a specific media item by ID
const mediaItem = await RNOOCamera.getMediaById('media-id');
// Delete a specific media item
RNOOCamera.deleteMedia('media-id');
// View depth data
RNOOCamera.openDepthView('/path/to/depth/file');
// Example media object structure
const media = mediaList[0];
console.log(media.id); // UUID
console.log(media.path); // File system path
console.log(media.response.transaction_hash); // Blockchain verification
console.log(media.response.metadata); // EXIF and sensor dataInitializes the OpenOrigins camera module.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
apiKey |
string | No | Your OpenOrigins API key |
useProduction |
boolean | Yes | Whether to use production or sandbox environment |
token |
string | No | Authentication token |
user |
string | No | User identifier |
Returns: Promise<void>
Opens the camera with custom configuration options.
Parameters:
The config object supports the following options:
| Parameter | Type | Default | Description |
|---|---|---|---|
closeAfterCapture |
boolean | true |
Automatically close camera after capture |
saveToCameraRoll |
boolean | false |
Save captured media to device camera roll |
cameraCompatibilityMode |
boolean | false |
Enable compatibility mode for older devices |
addToQueue |
boolean | true |
Add captured media to processing queue for anchoring |
showLastCapture |
boolean | true |
Display preview of the last captured media |
| Parameter | Type | Default | Description |
|---|---|---|---|
enablePhotoMode |
boolean | true |
Enable photo capture mode |
enableVideoMode |
boolean | true |
Enable video recording mode |
enableDepthMode |
boolean | true |
Enable depth map capture |
| Parameter | Type | Default | Description |
|---|---|---|---|
restrictLocationAccuracy |
boolean | false |
Limit the precision of location data collected |
collectLocationData |
boolean | true |
Collect GPS location data with captured media |
collectGyroData |
boolean | true |
Collect gyroscope sensor data during capture |
collectAccelerometerData |
boolean | true |
Collect accelerometer sensor data during capture |
collectAltimeterData |
boolean | true |
Collect altitude data during capture |
collectMagnetometerData |
boolean | true |
Collect magnetometer (compass) data during capture |
| Parameter | Type | Default | Options | Description |
|---|---|---|---|---|
aspectRatio |
string | '4:3' |
'4:3', '16:9', '1:1' |
Camera preview aspect ratio |
videoQuality |
string | 'FHD' |
'SD', 'HD', 'FHD', 'UHD' |
Quality setting for video recording |
flash |
boolean | true |
- | Enable camera flash |
orientationLock |
string | 'None' |
'None', 'Portrait', 'Landscape' |
Lock camera to specific orientation |
cameraSwitchingEnabled |
boolean | true |
- | Allow users to switch between front/back cameras |
facing |
string | 'Back' |
'Front', 'Back' |
Initial camera facing direction |
autoFocusEnabled |
boolean | true |
- | Enable automatic focus adjustment |
videoStabilizationEnabled |
boolean | true |
- | Enable video stabilization during recording |
videoCodec |
string | 'H.264' |
'H.264', 'HEVC' |
Codec used for video compression |
videoBitrate |
number | - | - | Target bitrate for video captures (Mbps, auto if empty) |
preferredLens |
string | 'Auto' |
'UltraWide', 'Wide', 'Telephoto', 'DualCamera', 'TripleCamera' |
Preferred camera lens to use |
gridLines |
boolean | true |
- | Display grid lines overlay on camera preview |
| Parameter | Type | Default | Description |
|---|---|---|---|
maxVideoDuration |
number | 300 |
Maximum video recording duration (in seconds) |
minVideoDuration |
number | 0 |
Minimum video recording duration (in seconds) |
| Parameter | Type | Default | Description |
|---|---|---|---|
customMetadata |
string | '' |
Custom metadata to attach to captured media |
message |
string | '' |
Message to display in a dismissable dialog on camera open |
banner |
string | '' |
Banner text to display at the top of camera view |
| Parameter | Type | Default | Description |
|---|---|---|---|
minimumDiskSpaceThresholdMB |
number | 50 |
Minimum disk space required before capture (in MB) |
Returns: Promise<Array> - Array of captured media objects
Example:
// Basic usage
const media = await RNOOCamera.openCamera();
// Advanced configuration
const media = await RNOOCamera.openCamera({
// Behavior
closeAfterCapture: true,
saveToCameraRoll: false,
addToQueue: true,
showLastCapture: true,
// Capture modes
enablePhotoMode: true,
enableVideoMode: true,
enableDepthMode: false,
// Camera settings
aspectRatio: '16:9',
videoQuality: 'FHD',
flash: true,
facing: 'Back',
orientationLock: 'Portrait',
autoFocusEnabled: true,
videoStabilizationEnabled: true,
preferredLens: 'Wide',
gridLines: true,
// Video settings
videoCodec: 'H.264',
maxVideoDuration: 120,
minVideoDuration: 1,
// Sensor data
collectLocationData: true,
collectGyroData: true,
collectAccelerometerData: true,
collectDepthData: false,
// UI customization
message: 'Capture your document',
banner: 'ID Verification',
// Storage
minimumDiskSpaceThresholdMB: 100
});Return Object Structure:
[
{
id: string;
// Unique identifier (UUID) for the media
path: string;
// File system path to the captured media
hash: string;
// File hash for integrity verification
metadata: any;
// File metadata that is instantly avaialble (will not include anchor information)
}
]Retrieves a list of all captured media items that were added to the queue using the AddToQueue config.
Returns: Promise<Array> - Array of media objects
Return Object Structure:
[
{
id: string; // Unique identifier (UUID) for the media
path: string; // File system path to the captured media
hash: string; // File hash for integrity verification
response: { // Verification and metadata response
id: string; // Media ID in blockchain system
block_hash: string; // Blockchain block hash
transaction_hash: string; // Blockchain transaction hash
created_on: string; // Creation timestamp
metadata: any; // EXIF and sensor metadata
};
}
]Retrieves a specific media item by its ID.
Parameters:
| Parameter | Type | Description |
|---|---|---|
id |
string | The media ID to retrieve |
Returns: Promise<Object> - Media object with the specified ID
Return Object Structure:
{
id: string; // Unique identifier (UUID) for the media
path: string; // File system path to the captured media
hash: string; // File hash for integrity verification
metadata: any; // EXIF and sensor metadata
anchored: boolean; // Has the item been anchored
complete: boolean; // Has item completed anchoring
failed: boolean; // Has item failed anchoring
uploading: boolean; // Is item currently uploading
mediaType: number; // 1 = Photo, 2 = Video
name: string; // Item filename
packageId: string; // OpenOrigins uploaded package identifier
size: number; // File size in bytes
status: string; // Status of the item in the anchoring queue
systemDate: string; // Timestamp of media upload
response: { // Verification and metadata response
algorithms: array[string] // Algorithms used to hash file
anchored_hash: string; // The anchored item hash
asset_data_capsule_uri: string; // URI of the asset capsule
asset_file_path: string; // Local file path of anchored file
asset_size: number; // File size of asset in bytes
asset_source: string // Reference for the source of the asset
block_hash: string; // Blockchain block hash
block_number: number // Blockchain block number
block_time: string // Blockchain block time
created_by: string // User identifier
created_on: string; // Creation timestamp
file_type: string; // File type
has_blockchain_anchor:boolean; // Has item been anchored to the blockchain
has_fingerprint: boolean; // Has the item been hashed
has_watermark: boolean; // Has media been watermarked
id: string; // Blockchain identifier
organisation_id: string; // Organisation identifier
organisation_name: string; // Organisation name
process_policy_id: string; // Process policy identifier
segment_count:number; // Segment count
transaction_hash: string; // Blockchain transaction hash
uploaded_filename: string; // Uploaded file name
};
}Deletes a specific media item from storage and the queue.
Parameters:
| Parameter | Type | Description |
|---|---|---|
id |
string | The media ID to delete |
Returns: void
Opens a viewer for depth map data.
Parameters:
| Parameter | Type | Description |
|---|---|---|
path |
string | Path to the depth map file |
Returns: void
Initiates processing of queued media items for anchoring. This is automatically called when images are taken via openCamera() but this gives you an option to start the queue manually.
Returns: void
await RNOOCamera.openCamera({
enablePhotoMode: true,
enableVideoMode: false,
enableDepthMode: false,
orientationLock: 'Portrait',
aspectRatio: '4:3',
facing: 'Back',
closeAfterCapture: true
});await RNOOCamera.openCamera({
enablePhotoMode: false,
enableVideoMode: true,
videoQuality: 'UHD',
videoCodec: 'HEVC',
videoBitrate: 50, // 50 Mbps
maxVideoDuration: 300,
videoStabilizationEnabled: true,
preferredLens: 'Wide'
});await RNOOCamera.openCamera({
enableDepthMode: true,
collectDepthData: true,
aspectRatio: '4:3',
showLastCapture: true,
closeAfterCapture: false
});await RNOOCamera.openCamera({
collectLocationData: false,
collectGyroData: false,
collectAccelerometerData: false,
collectAltimeterData: false,
collectMagnetometerData: false,
restrictLocationAccuracy: true
});await RNOOCamera.openCamera({
enablePhotoMode: true,
enableVideoMode: false,
aspectRatio: '4:3',
gridLines: true,
message: 'Align document within the frame',
banner: 'Document Verification',
autoFocusEnabled: true,
flash: false
});The module includes integrated device attestation that automatically verifies device integrity when you first use the camera. This ensures that media captured comes from a genuine, uncompromised device.
- First Use: When the camera is opened for the first time, the module automatically performs device attestation
- Internet Required: Initial attestation requires an active internet connection
- Cached Result: The attestation result is securely saved on the device
- Offline Support: After initial attestation, the camera can be used offline
Device attestation is built into the camera module - no additional code or providers are required. Simply initialize the module and open the camera:
// Initialize the module
await RNOOCamera.initialise({
apiKey: 'your-api-key',
useProduction: true
});
// Open the camera - attestation happens automatically on first use
const media = await RNOOCamera.openCamera();Important Notes:
- Ensure the device has internet connectivity when using the camera for the first time
- Attestation data is stored securely and persists across app sessions
- After initial attestation, the camera works fully offline
- Attestation uses iOS App Attest on iOS and Google Play Integrity on Android
- No code-level configuration required, but Android requires OpenOrigins to enable Play Integrity for your app's account email first (see Play Integrity Setup)
- Integrated Device Attestation: Automatic device integrity verification on first use with offline support
- iOS App Attest: Apple's App Attest framework for iOS device verification
- Google Play Integrity: Android device verification via the Play Integrity API (requires OpenOrigins to enable Play Integrity for your app's account email)
- Secure Token Storage: Uses
expo-secure-storefor storing sensitive data - RSA Encryption: Implements
react-native-rsa-nativefor secure communication - Cached Attestation: Securely stored attestation results enable offline operation
- React Native 0.61+
| Platform | Support |
|---|---|
| iOS | ✅ iOS 13+ |
| Android | ✅ Android (minSdk 21+) |
Note: Depth/3D camera capture (
enableDepthMode) is currently iOS only.
This module uses the TurboModule system (Codegen) for optimized native bridge communication, providing better performance compared to the legacy bridge architecture.
- Package Not Found: Verify you're using the correct repository reference:
github:OpenOrigins/react-native-source-camera - Initialization Fails: Confirm you've obtained an API key from OpenOrigins and passed it to
initialise()— the SDK will not function without one - After installation, run
cd ios && pod install && cd ..to install iOS dependencies
- Ensure you've called
initialise()before opening the camera - Verify your API key is valid and has production access if needed
- Check that camera permissions are granted on the device
- Verify all required permissions are configured in your Info.plist (see Required Permissions)
- Check iOS Settings → Privacy to ensure your app has been granted Camera, Microphone, Location, and Motion permissions
- Ensure
startMediaQueue()has been called to process the media - Check device storage has sufficient space
- Ensure the device has an active internet connection for initial attestation
- Check that the device is running iOS 13 or later
- Ensure you are testing on a physical iOS device (not simulator)
- Verify camera permissions are granted
- Ensure all required Info.plist permissions are properly configured (see Required Permissions)
- Verify all required permissions are added to your
app.json(Expo) orInfo.plist(bare React Native) - Check that permission usage descriptions are user-friendly and comply with App Store guidelines
- Test that permissions are being requested at runtime by checking iOS Settings → Privacy
- For location or motion data errors, ensure
NSMotionUsageDescriptionand location permissions are configured
- Initial camera use requires internet connectivity
- iOS: Ensure the device supports App Attest (iOS 14+); the iOS Simulator does not support App Attest — test on a physical device
- Android: Play Integrity must be enabled for your app by OpenOrigins before attestation will work — see Play Integrity Setup
- Check device logs for specific attestation error messages
The wrapper code in this repository is licensed under MIT. The bundled native SDK binaries (Android .aar files and the iOS OOSDKLib.framework) are proprietary and distributed under separate terms — see NOTICE.
Contributions are welcome! Please visit the GitHub repository to:
- Report issues: Issue Tracker
- Submit pull requests
- View the source code
For more information, visit openorigins.com.