UNPKG

sprintcheckrn

Version:

SprintcheckRN: React Native SDK for identity verification (BVN, NIN, Facial) with Expo support

70 lines (62 loc) 1.85 kB
import { NativeModules, Platform } from 'react-native'; // Get the native module exported from Android const LINKING_ERROR = `The package 'SprintCheck' doesn't seem to be linked.\n` + 'Make sure:\n' + '- You have run a clean build after adding the native code (cd android && ./gradlew clean && cd ..)\n' + '- You have rebuilt the app (npx react-native run-android)\n' + '- You have registered SprintCheckPackage in MainApplication.kt (Android)'; const SprintCheck = NativeModules.SprintCheck ? NativeModules.SprintCheck : new Proxy({}, { get() { throw new Error(LINKING_ERROR); }, }); export default { /** * Initialize the SprintCheck SDK * @param apiKey string * @param encryptionKey string * @returns Promise<void> */ initialize(apiKey: string, encryptionKey: string): Promise<void> { console.log(apiKey, encryptionKey); var result = SprintCheck.initialize(apiKey, encryptionKey); console.log(result); return result; }, /** * Start BVN verification * @param email string * @returns Promise<any> */ startBvnVerification(email: string): Promise<any> { console.log(email); var result = SprintCheck.startBvnVerification(email); console.log(result); return result; }, /** * Start NIN verification * @param email string * @returns Promise<any> */ startNinVerification(email: string): Promise<any> { console.log(email); var result = SprintCheck.startNinVerification(email); console.log(result); return result; }, /** * Start Facial verification * @param email string * @returns Promise<any> */ startFacialVerification(email: string): Promise<any> { console.log(email); var result = SprintCheck.startFacialVerification(email); console.log(result); return result; }, };