[INJI-624] - remove iriscan facesdk and provide support to integrate any facesdk for face verification

Signed-off-by: Swati Goel <meet2swati@gmail.com>
This commit is contained in:
Swati Goel
2023-12-15 13:18:02 +05:30
parent ef32fef13c
commit bd37dc6285
6 changed files with 3 additions and 71 deletions

View File

@@ -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);

View File

@@ -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:(?<mime>[\w/\-.]+);(?<encoding>\w+),(?<data>.*)/;
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;
},
},

19
package-lock.json generated
View File

@@ -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",

View File

@@ -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",

View File

@@ -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,
},
},
};
};

View File

@@ -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;