@victoria-id/victoria_id_check_id_sdk_react_native
v1.14.0
Published
Victoria-ID - ID check - SDK - React-Native
Readme
Victoria-ID - ID check - SDK - Documentation - React Native
Table of contents
Introduction
This SDK contains the ID check from Victoria-ID. It can be embedded in your application, which we will refer to as the "host application". The SDK is designed to launch an activity that walks the user through multiple steps of the ID check. After completion, the SDK will return metadata to the host application, indicating the success or failure of the operation.
Adding the SDK to your project
Installing dependency
npm install @victoria-id/victoria_id_check_id_sdk_react_nativeiOS
- Add an NSCameraUsageDescription entry to app's Info.plist
- Add required NFC capabilities
- In your React Native app
iosdirectory, run:
pod installAndroid
Add required maven repositories:
allprojects { repositories { maven { url "https://raw.githubusercontent.com/victoria-id/victoria_id_check_id_sdk_android/master/maven/" } maven { url "https://raw.githubusercontent.com/iProov/android/master/maven/" } } }Set
minSdkVersion:android { defaultConfig { minSdkVersion 28 } }Exclude 'META-INF/versions/9/OSGI-INF/MANIFEST.MF' resource:
android { packaging { resources.excludes.add("META-INF/versions/9/OSGI-INF/MANIFEST.MF") } }
Usage
Importing the SDK
import Victoria_ID_Check_ID_SDK from '@victoria-id/victoria_id_check_id_sdk_react_native';
Starting the SDK
Victoria_ID_Check_ID_SDK.launch(
{
// Set the initial theme colors of the UI.
// These colors should match the colors as they are set in the Portal settings of the screening portal.
// When the SDK reaches step 3 of the user flow, it has made contact with the portal and fetched updated colors.
color_primary: '#f108a7', // The primary color used for call-to-action elements.
color_secondary: '#dfbdfe', // Reserved.
color_tertiary: '#13f3cb', // Reserved.
font_color: '#0b0c5d', // Reserved.
background_color: '#eedad6', // Reserved.
/*
Provide the API URL (with token).
Your API is expected to call `GET screenee/:screenee_id/check/identity/travel_document/text_chip_certificate/token/`
as described in the Victoria Connect API documentation at https://doc.api.victoria-id.com/#1f481ddb-3547-4c17-8ec4-e47dfd47fb71
to get the temporary token required for the API to start the process.
*/
api_uri: 'https://api.victoria-id.com/screenee/:screenee_id/check/identity/travel_document/text_chip_certificate/?domain=example.victoria-id.com&token=<token>'
});
Listening to SDK events
useEffect(() =>
{
const neeEvent_Emitter = new NativeEventEmitter(Victoria_ID_Check_ID_SDK.native_module);
let elEvent_Listener = neeEvent_Emitter.addListener('victoria_id_check_id_sdk_result', eEvent =>
{
switch (eEvent.code)
{
case 'feature_not_found_camera':
{
console.warn('ID check', 'The device does not have a camera needed to scan a QR code and/or ID document.');
break;
}
case 'feature_not_found_nfc':
{
console.warn('ID check', 'The device does not have NFC capability.');
break;
}
case 'exception_api_url':
{
console.warn('ID check', 'The Victoria Connect API did not accept the API URL to be able to start the process.');
break;
}
case 'exception_api_data':
{
console.warn('ID check', 'The Victoria Connect API did not accept the data payload to finish the process.');
break;
}
case 'exception_generic':
{
console.warn('ID check', 'Generic exception.');
break;
}
case 'cancel':
{
console.warn('ID check', 'User canceled ID check flow.');
break;
}
case 'data_share_decline':
{
console.warn('ID check', 'User declined to share data.');
break;
}
case 'success':
{
console.log('ID check', 'ID check was completed successfully.');
/*
Your API is expected to fetch the information directly from the Victoria Connect API using:
`GET group/:group_id/screening/:screening_id/screenee/:screenee_id/`.
*/
break;
}
default:
{
console.warn('ID check', 'Unknown result code:', eEvent.code);
}
}
});
return () =>
{
elEvent_Listener.remove();
};
}, []);
