@blusalt-sdk/react-native-full-identity-library
v2.0.1
Published
Document Verification and Liveness SDK
Downloads
448
Readme
react-native-full-identity-library
Document Verification and Liveness SDK
Installation
npm install @blusalt-sdk/react-native-full-identity-libraryUsage
The SDK exposes three builder classes. Chain the configuration methods you need and call .start() to launch.
import {
CustomSelectorBuilder,
IdNumberBuilder,
DocumentType,
LivenessFacialComparisonType,
ThresholdPriorityType,
} from '@blusalt-sdk/react-native-full-identity-library';CustomSelectorBuilder — Specific document types
Limits the SDK to the document types you specify.
new CustomSelectorBuilder()
.clientId('your-client-id') // required
.appName('YourAppName') // required
.apiKey('your-api-key') // required
.isDev(false)
.documentTypeList([DocumentType.bvn, DocumentType.nin, DocumentType.passport]) // required
.reference('')
.webhookUrl('')
.showLivenessResult(true)
.livenessFacialComparisonType(LivenessFacialComparisonType.action)
.thresholdConfig({
localThreshold: 80,
priority: ThresholdPriorityType.serverWithLocalFallback,
})
.timeoutDurationInSec(120)
.enableEncryption(false)
.callback({
responseJson: (data) => {
console.log(data);
},
})
.start();IdNumberBuilder — Pre-filled document type and ID number
Starts the SDK with a known document type and ID number already populated.
new IdNumberBuilder()
.clientId('your-client-id') // required
.appName('YourAppName') // required
.apiKey('your-api-key') // required
.isDev(false)
.documentType(DocumentType.bvn) // required
.documentNumber('12345678901') // required
.reference('')
.webhookUrl('')
.startProcessOnGettingToFirstScreen(false)
.showLivenessResult(true)
.livenessFacialComparisonType(LivenessFacialComparisonType.dynamic)
.thresholdConfig({
localThreshold: 80,
priority: ThresholdPriorityType.serverWithLocalFallback,
})
.timeoutDurationInSec(120)
.enableEncryption(false)
.callback({
responseJson: (data) => {
console.log(data);
},
})
.start();API Reference
DocumentType
| Value | Description |
|-------|-------------|
| DocumentType.bvn | Bank Verification Number |
| DocumentType.nin | National Identification Number |
| DocumentType.passport | International Passport |
| DocumentType.driverLicense | Driver's License |
| DocumentType.pvc | Permanent Voter's Card |
LivenessFacialComparisonType
| Value | Description |
|-------|-------------|
| LivenessFacialComparisonType.dynamic | Dynamic liveness (default) |
| LivenessFacialComparisonType.action | Action-based liveness |
| LivenessFacialComparisonType.varifocal | Varifocal liveness |
| LivenessFacialComparisonType.flash | Flash liveness |
ThresholdPriorityType
| Value | Description |
|-------|-------------|
| ThresholdPriorityType.serverWithLocalFallback | Server threshold with local fallback (default) |
| ThresholdPriorityType.localOnly | Local threshold only |
| ThresholdPriorityType.serverOnly | Server threshold only |
ThresholdConfig
| Field | Type | Description |
|-------|------|-------------|
| localThreshold | number (optional) | Match threshold 0–100 |
| priority | string (optional) | One of ThresholdPriorityType values |
Builder methods (all builders)
| Method | Type | Required | Default |
|--------|------|----------|---------|
| .clientId(value) | string | ✓ | — |
| .appName(value) | string | ✓ | — |
| .apiKey(value) | string | ✓ | — |
| .isDev(value) | boolean | | false |
| .reference(value) | string | | '' |
| .webhookUrl(value) | string | | '' |
| .livenessFacialComparisonType(value) | string | | 'dynamic' |
| .thresholdConfig(value) | ThresholdConfig | | server default |
| .timeoutDurationInSec(value) | number | | 120 |
| .enableEncryption(value) | boolean | | false — see note below |
| .callback(value) | OnFinish | | — |
enableEncryptionnote: This flag must match the encryption setting on your API key. If your API key was created with encryption enabled, set.enableEncryption(true). If encryption is disabled on your API key, set.enableEncryption(false). Using the wrong value will cause the SDK to fail. Contact your Blusalt account manager if you are unsure which setting your API key uses.
Additional methods — CustomSelectorBuilder
| Method | Type | Required | Default |
|--------|------|----------|---------|
| .documentTypeList(value) | string[] | ✓ | — |
| .showLivenessResult(value) | boolean | | true |
Additional methods — IdNumberBuilder
| Method | Type | Required | Default |
|--------|------|----------|---------|
| .documentType(value) | string | ✓ | — |
| .documentNumber(value) | string | ✓ | — |
| .startProcessOnGettingToFirstScreen(value) | boolean | | false |
| .showLivenessResult(value) | boolean | | true |
Android Setup
Step 1
Create a github.properties file in the root of the android folder:
myReactApp/android/github.properties
USERNAME_GITHUB=YourGithubUsername
TOKEN_GITHUB=YourGithubClassicTokenStep 2
Add the following to your project-level android/build.gradle:
buildscript {
ext.kotlin_version = '1.9.+'
dependencies {
classpath 'com.android.tools.build:gradle:7.3.+'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
allprojects {
def githubPropertiesFile = rootProject.file("github.properties")
def githubProperties = new Properties()
githubProperties.load(new FileInputStream(githubPropertiesFile))
repositories {
maven {
name "GitHubPackages"
url 'https://maven.pkg.github.com/Blusalt-FS/Full-Identity-SDK-Android'
credentials {
username githubProperties['USERNAME_GITHUB']
password githubProperties['TOKEN_GITHUB']
}
}
maven {
name "GitHubPackages"
url 'https://maven.pkg.github.com/Blusalt-FS/Liveness-Only-Android-Package'
credentials {
username githubProperties['USERNAME_GITHUB']
password githubProperties['TOKEN_GITHUB']
}
}
maven {
name "GitHubPackages"
url 'https://maven.pkg.github.com/Blusalt-FS/Blusalt_Document_Verification-Android-Package'
credentials {
username githubProperties['USERNAME_GITHUB']
password githubProperties['TOKEN_GITHUB']
}
}
}
}Step 3
Set the minimum Android SDK version to 24 in android/app/build.gradle:
android {
defaultConfig {
minSdkVersion 24
}
}Step 4 (Optional — ProGuard)
If you have minification enabled, add to android/app/proguard-rules.pro:
-keep class net.blusalt.liveness_native.** { *; }
-keep class net.blusalt.identityverify.Core.** { *; }
-keep class net.blusalt.fullidentity.** { *; }
-keep public class com.megvii.**{*;}Enable ProGuard in android/app/build.gradle:
android {
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}iOS Setup
Add camera permission to ios/<AppName>/Info.plist:
<key>NSCameraUsageDescription</key>
<string>Required for identity verification liveness check</string>Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT
Made with create-react-native-library
