From bd37dc6285be6770ee38bbf4b62472675084fb78 Mon Sep 17 00:00:00 2001 From: Swati Goel Date: Fri, 15 Dec 2023 13:18:02 +0530 Subject: [PATCH] [INJI-624] - remove iriscan facesdk and provide support to integrate any facesdk for face verification Signed-off-by: Swati Goel --- machines/auth.ts | 5 +---- machines/faceScanner.ts | 5 ++--- package-lock.json | 19 ------------------- package.json | 1 - shared/commonUtil.ts | 20 -------------------- shared/commonprops/commonProps.ts | 24 ------------------------ 6 files changed, 3 insertions(+), 71 deletions(-) diff --git a/machines/auth.ts b/machines/auth.ts index 3cee14ff2..53fc58e50 100644 --- a/machines/auth.ts +++ b/machines/auth.ts @@ -1,8 +1,5 @@ import {assign, ContextFrom, EventFrom, send, StateFrom} from 'xstate'; import {createModel} from 'xstate/lib/model'; -import getAllConfigurations, { - downloadModel, -} from '../shared/commonprops/commonProps'; import {AppServices} from '../shared/GlobalContext'; import {StoreEvents, StoreResponseEvent} from './store'; import {generateSecureRandom} from 'react-native-securerandom'; @@ -169,7 +166,7 @@ export const authMachine = model.createMachine( services: { downloadFaceSdkModel: () => () => { - downloadModel(); + // ToDo - support to download model for face match }, generatePasscodeSalt: () => async context => { const randomBytes = await generateSecureRandom(16); diff --git a/machines/faceScanner.ts b/machines/faceScanner.ts index d1b50dc05..c276975f2 100644 --- a/machines/faceScanner.ts +++ b/machines/faceScanner.ts @@ -4,8 +4,6 @@ import {Linking} from 'react-native'; import {assign, EventFrom, StateFrom} from 'xstate'; import {createModel} from 'xstate/lib/model'; -import {faceCompare} from '@iriscan/biometric-sdk-react-native'; - const model = createModel( { cameraRef: {} as Camera, @@ -220,7 +218,8 @@ export const createFaceScannerMachine = (vcImage: string) => const rxDataURI = /data:(?[\w/\-.]+);(?\w+),(?.*)/; const matches = rxDataURI.exec(vcImage).groups; - return faceCompare(context.capturedImage.base64, matches.data); + // ToDo - compare faces to do face match and return the match response + return true; }, }, diff --git a/package-lock.json b/package-lock.json index a395ac2ae..16a6ef654 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,6 @@ "@expo-google-fonts/inter": "^0.2.3", "@expo-google-fonts/poppins": "^0.2.0", "@expo/metro-config": "~0.10.0", - "@iriscan/biometric-sdk-react-native": "^0.2.6", "@react-native-clipboard/clipboard": "^1.10.0", "@react-native-community/netinfo": "9.3.7", "@react-native-picker/picker": "2.4.8", @@ -4906,18 +4905,6 @@ "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "dev": true }, - "node_modules/@iriscan/biometric-sdk-react-native": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/@iriscan/biometric-sdk-react-native/-/biometric-sdk-react-native-0.2.6.tgz", - "integrity": "sha512-aA9gQWJ/Nt0KGDlf1vC8oxld3Daw23LlWdBidXyVfxWywm4VApq0nrOP+l2y9TVEWuAQjqdAbKSZ89ZEhetPjQ==", - "engines": { - "node": ">= 16.0.0" - }, - "peerDependencies": { - "react": "*", - "react-native": "*" - } - }, "node_modules/@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", @@ -34723,12 +34710,6 @@ "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", "dev": true }, - "@iriscan/biometric-sdk-react-native": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/@iriscan/biometric-sdk-react-native/-/biometric-sdk-react-native-0.2.6.tgz", - "integrity": "sha512-aA9gQWJ/Nt0KGDlf1vC8oxld3Daw23LlWdBidXyVfxWywm4VApq0nrOP+l2y9TVEWuAQjqdAbKSZ89ZEhetPjQ==", - "requires": {} - }, "@istanbuljs/load-nyc-config": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", diff --git a/package.json b/package.json index 6037453c5..69253131a 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,6 @@ "@react-navigation/native": "^6.0.8", "@react-navigation/native-stack": "^6.1.0", "@xstate/react": "^3.0.1", - "@iriscan/biometric-sdk-react-native": "^0.2.6", "base64url-universal": "^1.1.0", "buffer": "^6.0.3", "crypto-js": "^3.3.0", diff --git a/shared/commonUtil.ts b/shared/commonUtil.ts index dec1953d7..568c4f2b7 100644 --- a/shared/commonUtil.ts +++ b/shared/commonUtil.ts @@ -55,23 +55,3 @@ export function logState(state: AnyState) { export const getMaskedText = (id: string): string => { return '*'.repeat(id.length - 4) + id.slice(-4); }; - -export const faceMatchConfig = (resp: string) => { - return { - withFace: { - encoder: { - tfModel: { - path: resp + '/model.tflite', - inputWidth: 160, - inputHeight: 160, - outputLength: 512, - modelChecksum: - '797b4d99794965749635352d55da38d4748c28c659ee1502338badee4614ed06', - }, - }, - matcher: { - threshold: 0.8, - }, - }, - }; -}; diff --git a/shared/commonprops/commonProps.ts b/shared/commonprops/commonProps.ts index 32b45335a..d81712c9f 100644 --- a/shared/commonprops/commonProps.ts +++ b/shared/commonprops/commonProps.ts @@ -1,7 +1,5 @@ -import {configure} from '@iriscan/biometric-sdk-react-native'; import {changeCrendetialRegistry} from '../constants'; import {CACHED_API} from '../api'; -import {faceMatchConfig} from '../commonUtil'; export const COMMON_PROPS_KEY: string = 'CommonPropsKey-' + '6964d04a-9268-11ed-a1eb-0242ac120002'; @@ -11,28 +9,6 @@ export default async function getAllConfigurations(host = undefined) { return await CACHED_API.getAllProperties(); } -export async function downloadModel() { - try { - var injiProp = await getAllConfigurations(); - const maxRetryStr = injiProp.modelDownloadMaxRetry; - const maxRetry = parseInt(maxRetryStr); - const resp: string = injiProp != null ? injiProp.faceSdkModelUrl : null; - - if (resp != null) { - for (let counter = 0; counter < maxRetry; counter++) { - let config = faceMatchConfig(resp); - var result = await configure(config); - console.log('model download result is = ' + result); - if (result) { - break; - } - } - } - } catch (error) { - console.log(error); - } -} - export interface DownloadProps { maxDownloadLimit: number; downloadInterval: number;