Skip to content

Commit

Permalink
feat(INJI-528): use npm module for iris scan sdk
Browse files Browse the repository at this point in the history
Signed-off-by: adityankannan-tw <[email protected]>
  • Loading branch information
Adityankannan committed Dec 12, 2023
1 parent 9c62c5e commit 1074551
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 32 deletions.
20 changes: 10 additions & 10 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ PODS:
- AppAuth/ExternalUserAgent (1.6.2):
- AppAuth/Core
- ASN1Decoder (1.8.0)
- BiometricSdk (0.5.4):
- biometric-sdk-react-native (0.2.4):
- BiometricSdk (= 0.5.9)
- React-Core
- BiometricSdk (0.5.9):
- TensorFlowLiteObjC (= 2.12.0)
- boost (1.76.0)
- BVLinearGradient (2.8.2):
Expand Down Expand Up @@ -80,9 +83,6 @@ PODS:
- MMKV (1.2.13):
- MMKVCore (~> 1.2.13)
- MMKVCore (1.2.16)
- mosip-mobileid-sdk (0.1.0):
- BiometricSdk (= 0.5.4)
- React-Core
- Permission-BluetoothPeripheral (3.8.4):
- RNPermissions
- Permission-Camera (3.8.4):
Expand Down Expand Up @@ -499,6 +499,7 @@ PODS:
- ZXingObjC/Core

DEPENDENCIES:
- "biometric-sdk-react-native (from `../node_modules/@iriscan/biometric-sdk-react-native`)"
- boost (from `../node_modules/react-native/third-party-podspecs/boost.podspec`)
- BVLinearGradient (from `../node_modules/react-native-linear-gradient`)
- DoubleConversion (from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`)
Expand Down Expand Up @@ -526,7 +527,6 @@ DEPENDENCIES:
- glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
- hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)
- libevent (~> 2.1.12)
- mosip-mobileid-sdk (from `../node_modules/mosip-mobileid-sdk`)
- Permission-BluetoothPeripheral (from `../node_modules/react-native-permissions/ios/BluetoothPeripheral`)
- Permission-Camera (from `../node_modules/react-native-permissions/ios/Camera`)
- Permission-LocationAccuracy (from `../node_modules/react-native-permissions/ios/LocationAccuracy`)
Expand Down Expand Up @@ -602,6 +602,8 @@ SPEC REPOS:
- ZXingObjC

EXTERNAL SOURCES:
biometric-sdk-react-native:
:path: "../node_modules/@iriscan/biometric-sdk-react-native"
boost:
:podspec: "../node_modules/react-native/third-party-podspecs/boost.podspec"
BVLinearGradient:
Expand Down Expand Up @@ -654,8 +656,6 @@ EXTERNAL SOURCES:
:podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec"
hermes-engine:
:podspec: "../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec"
mosip-mobileid-sdk:
:path: "../node_modules/mosip-mobileid-sdk"
Permission-BluetoothPeripheral:
:path: "../node_modules/react-native-permissions/ios/BluetoothPeripheral"
Permission-Camera:
Expand Down Expand Up @@ -772,7 +772,8 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
AppAuth: 3bb1d1cd9340bd09f5ed189fb00b1cc28e1e8570
ASN1Decoder: 6110fdeacfdb41559b1481457a1645be716610aa
BiometricSdk: 1d16c395413164d92a280b78006abba4307063e6
biometric-sdk-react-native: 5d1207e0d9ee34788cb4ccb59cfc205022d7e3f1
BiometricSdk: 303e7329404ea4d922dc14108449d10d21574f77
boost: 57d2868c099736d80fcd648bf211b4431e51a558
BVLinearGradient: 916632041121a658c704df89d99f04acb038de0f
CatCrypto: a477899b6be4954e75be4897e732da098cc0a5a8
Expand Down Expand Up @@ -806,7 +807,6 @@ SPEC CHECKSUMS:
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
MMKV: aac95d817a100479445633f2b3ed8961b4ac5043
MMKVCore: 9cfef4c48c6c46f66226fc2e4634d78490206a48
mosip-mobileid-sdk: 6b8182276896194fdcacdde148b02d5d2d16b02a
Permission-BluetoothPeripheral: 2b88a131074edafd8a46a5cda4ba610ec986d2fb
Permission-Camera: 7ec9ee99704766ff9b90198183387a7f5d82b0c1
Permission-LocationAccuracy: a38ddb5c5d0b8e656f3c86e4a500f9bb88bc099d
Expand Down Expand Up @@ -869,4 +869,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 01f58b130fa221dabb14b2d82d981ef24dcaba53

COCOAPODS: 1.12.1
COCOAPODS: 1.13.0
4 changes: 2 additions & 2 deletions machines/faceScanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {Linking} from 'react-native';
import {assign, EventFrom, StateFrom} from 'xstate';
import {createModel} from 'xstate/lib/model';

import {faceAuth} from 'mosip-mobileid-sdk';
import {faceCompare} from '@iriscan/biometric-sdk-react-native';

const model = createModel(
{
Expand Down Expand Up @@ -220,7 +220,7 @@ export const createFaceScannerMachine = (vcImage: string) =>
const rxDataURI =
/data:(?<mime>[\w/\-.]+);(?<encoding>\w+),(?<data>.*)/;
const matches = rxDataURI.exec(vcImage).groups;
return faceAuth(context.capturedImage.base64, matches.data);
return faceCompare(context.capturedImage.base64, matches.data);
},
},

Expand Down
35 changes: 18 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@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.4",
"@react-native-clipboard/clipboard": "^1.10.0",
"@react-native-community/netinfo": "9.3.7",
"@react-native-picker/picker": "2.4.8",
Expand All @@ -44,7 +45,6 @@
"i18next": "^21.6.16",
"iso-639-3": "^3.0.1",
"jwt-decode": "^3.1.2",
"mosip-mobileid-sdk": "git://github.com/mosip/mosip-mobileid-sdk.git#IrisScan",
"node-forge": "^1.3.1",
"node-jose": "^2.2.0",
"patch-package": "^6.5.1",
Expand Down
23 changes: 21 additions & 2 deletions shared/commonprops/commonProps.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {init} from 'mosip-mobileid-sdk';
import {configure} from '@iriscan/biometric-sdk-react-native';
import {changeCrendetialRegistry} from '../constants';
import {CACHED_API} from '../api';

Expand All @@ -16,9 +16,28 @@ export async function downloadModel() {
const maxRetryStr = injiProp.modelDownloadMaxRetry;
const maxRetry = parseInt(maxRetryStr);
const resp: string = injiProp != null ? injiProp.faceSdkModelUrl : null;

const config = {
withFace: {
encoder: {
tfModel: {
path: resp + '/model.tflite',
inputWidth: 160,
inputHeight: 160,
outputLength: 512,
modelChecksum:
'797b4d99794965749635352d55da38d4748c28c659ee1502338badee4614ed06',
},
},
matcher: {
threshold: 0.8,
},
},
};

if (resp != null) {
for (let counter = 0; counter < maxRetry; counter++) {
var result = await init(resp + '/model.tflite', false);
var result = await configure(config);
console.log('model download result is = ' + result);
if (result) {
break;
Expand Down

0 comments on commit 1074551

Please sign in to comment.