A react-native
wrapper for the onfido-ios-sdk
and onfido-android-sdk
identity verification SDKs.
npm install onfido-rn-sdk
import Onfido, {
OnfidoFaceVariant,
OnfidoDocument,
OnfidoOptions,
OnfidoDocumentCountryCode,
} from 'onfido-rn-sdk';
const token = 'YOUR_TOKEN_HERE'; // get your SDK token from Onfido
const options: OnfidoOptions = {
iosTheme: {
primaryColor: '#000000',
primaryTitleColor: '#00c56b',
primaryBackgroundPressedColor: '#c50000',
secondaryBackgroundPressedColor: '#ffffff',
supportDarkMode: true,
},
withWelcomeStep: true,
withDocumentStep: true,
withFaceStep: true,
faceVariant: OnfidoFaceVariant.PHOTO,
documentType: OnfidoDocument.DRIVING_LICENCE,
documentCountryCode: OnfidoDocumentCountryCode.GBR,
};
const successHandler = message => console.log(message);
const errorHandler = message => console.log(message);
Onfido.startSDK(token, options, successHandler, errorHandler);
ios
-
Your project must have some swift code and a bridging header in order to correctly compile the SDK. If it does not, open
Xcode
and add a blank.swift
file and let it generate a bridging header for you. (TODO: see here) -
The Onfido SDK makes use of the device Camera. You will be required to have the
NSCameraUsageDescription
andNSMicrophoneUsageDescription
keys in your application'sInfo.plist
file:
<key>NSCameraUsageDescription</key>
<string>Required for document and facial capture</string>
<key>NSMicrophoneUsageDescription</key>
<string>Required for video capture</string>
Note: Both keys will be required for app submission.
- Ensure your
Podfile
references as a minimum iOS platform version of10.0
.
platform :ios, '10.0'
Android
- Until the Onfido package is available in
jcenter
you will need to modify therepositories
directive in your application'sbuild.gradle
:
repositories {
maven {
url "https://dl.bintray.com/onfido/maven"
}
}
- Enable multidex by modifying the
defaultConfig
in your applicationsandroid/app/build.gradle
:
defaultConfig {
multiDexEnabled true
}
MIT