Skip to content

Commit

Permalink
Inji - 368 integrate iris scan android ios (#936)
Browse files Browse the repository at this point in the history
* feat(INJI-368): Integrate irisScan for android and ios

Signed-off-by: adityankannan-tw <[email protected]>

* feat(INJI-368): Add path to the model file

Signed-off-by: adityankannan-tw <[email protected]>

* feat(INJI-368): Integrate irisScan for android and ios

Signed-off-by: adityankannan-tw <[email protected]>

* feat(INJI-368): Update package lock json

Signed-off-by: adityankannan-tw <[email protected]>

---------

Signed-off-by: adityankannan-tw <[email protected]>
Signed-off-by: adityankannan-tw <[email protected]>
Signed-off-by: Swati Goel <[email protected]>
Co-authored-by: Swati Goel <[email protected]>
  • Loading branch information
adityankannan-tw and swatigoel authored Oct 23, 2023
1 parent eb33ec2 commit 47b5580
Show file tree
Hide file tree
Showing 11 changed files with 145 additions and 143 deletions.
17 changes: 8 additions & 9 deletions .talismanrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
fileignoreconfig:
- filename: package.json
checksum: e0b34f1a1efbdf07b40a3e9e9ecd8884dd7d6835f45c57850e30988d2c6371a2
- filename: package-lock.json
checksum: a4c1fe2521067e1a279610f079446c600e8b7d5cf1553934dc419c3c476b4844
checksum: fc26d97edecbacd0b7507032c6fc1acfcea9f01f5dbe66a2a0341506e2f0daca
- filename: components/PasscodeVerify.tsx
checksum: 14654c0f038979fcd0d260170a45894a072f81e0767ca9a0e66935d33b5cc703
- filename: i18n.ts
Expand All @@ -24,11 +26,11 @@ fileignoreconfig:
- filename: screens/WelcomeScreenController.ts
checksum: 71917c8c543a4a5b7ab61df259b785d233a80718123b0c8edf6ec81e1b3a81e0
- filename: shared/telemetry/TelemetryUtils.js
checksum: ffe9aac2dcc590b98b0d588885c088eff189504ade653a77f74b67312bfd27ad
- filename: shared/fileStorage.ts
checksum: 07cb337dc1d5b0f0eef56270ac4f4f589260ee5e490183c024cf98a2aeafb139
- filename: shared/storage.ts
checksum: c8d874aa373bdf526bf59192139822f56915e702ef673bac4e0d7549b0fea3d0
checksum: 9a61cd59a3718adf1f14faf3024fec66a3295ef373878a878a28e5cb1287afaa
- filename: ios/Podfile.lock
checksum: cc123c3e1f04d41b394ceb16843b15c08bac3ba619ae853ff322717739761a85
- filename: ios/Podfile.lock
checksum: cc123c3e1f04d41b394ceb16843b15c08bac3ba619ae853ff322717739761a85
- filename: screens/Home/IntroSlidersScreen.tsx
checksum: 72ef913857448ef05763e52e32356faa2d1f3de8130a1c638d1897f44823031f
- filename: shared/commonUtil.ts
Expand All @@ -47,8 +49,6 @@ fileignoreconfig:
checksum: f1f504bd8c14496ee71f8eb7f40d54411cc05be03347d644dcc2cca187a20678
- filename: machines/VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine.ts
checksum: 237a2640b7db70770d65da67c79f2929581e32f1162517e50b8d37e409f3387d
- filename: machines/store.ts
checksum: 0695d833df9ec1e1f6ae2bd81631630bb1039dec387718acb153bcb843c952cd
- filename: shared/cryptoutil/cryptoUtil.ts
checksum: b785ff3f01ab9530119072c4d38195048bfeee6155c54ea7dd031559acb722f3
- filename: package.json
Expand All @@ -57,4 +57,3 @@ fileignoreconfig:
checksum: 6d22bc5c77398316b943c512c208ce0846a9fff674c1ccac79e07f21962acd5f
- filename: machines/VCItemMachine/ExistingMosipVCItem/ExistingMosipVCItemMachine.typegen.ts
checksum: 10889302ca05646a283386be1bbe7a5fb510c02bb62a308ee45f3c2a872ae64e
version: ""
1 change: 1 addition & 0 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ dependencies {
if (isGifEnabled || isWebpEnabled) {
implementation 'com.facebook.fresco:fresco:2.0.0'
implementation 'com.facebook.fresco:imagepipeline-okhttp3:2.0.0'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:4.4.1'
}

if (isGifEnabled) {
Expand Down
6 changes: 0 additions & 6 deletions components/FaceScanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,6 @@ export const FaceScanner: React.FC<FaceScannerProps> = props => {
</Centered>
</Row>
)}
{/* TODO: remove warning when iOS SDK is ready */}
{isIOS() && (
<Text size="smaller" color={Theme.Colors.textLabel} align="center">
(face-matching in iOS is mocked)
</Text>
)}
</Centered>
</View>
);
Expand Down
26 changes: 21 additions & 5 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ PODS:
- AppAuth/ExternalUserAgent (1.6.2):
- AppAuth/Core
- ASN1Decoder (1.8.0)
- BiometricSdk (0.5.4):
- TensorFlowLiteObjC (= 2.12.0)
- boost (1.76.0)
- BVLinearGradient (2.8.2):
- React-Core
Expand Down Expand Up @@ -78,7 +80,8 @@ PODS:
- MMKV (1.2.13):
- MMKVCore (~> 1.2.13)
- MMKVCore (1.2.16)
- mosip-inji-face-sdk (0.1.12):
- mosip-mobileid-sdk (0.1.0):
- BiometricSdk (= 0.5.4)
- React-Core
- Permission-BluetoothPeripheral (3.8.4):
- RNPermissions
Expand Down Expand Up @@ -481,6 +484,13 @@ PODS:
- React
- RNSVG (13.4.0):
- React-Core
- TensorFlowLiteC (2.12.0):
- TensorFlowLiteC/Core (= 2.12.0)
- TensorFlowLiteC/Core (2.12.0)
- TensorFlowLiteObjC (2.12.0):
- TensorFlowLiteObjC/Core (= 2.12.0)
- TensorFlowLiteObjC/Core (2.12.0):
- TensorFlowLiteC (= 2.12.0)
- Yoga (1.14.0)
- ZXingObjC/Core (3.6.5)
- ZXingObjC/OneD (3.6.5):
Expand Down Expand Up @@ -516,7 +526,7 @@ 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-inji-face-sdk (from `../node_modules/mosip-inji-face-sdk`)
- 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 @@ -579,13 +589,16 @@ SPEC REPOS:
trunk:
- AppAuth
- ASN1Decoder
- BiometricSdk
- CatCrypto
- CrcSwift
- fmt
- GzipSwift
- libevent
- MMKV
- MMKVCore
- TensorFlowLiteC
- TensorFlowLiteObjC
- ZXingObjC

EXTERNAL SOURCES:
Expand Down Expand Up @@ -641,8 +654,8 @@ 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-inji-face-sdk:
:path: "../node_modules/mosip-inji-face-sdk"
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 @@ -759,6 +772,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
AppAuth: 3bb1d1cd9340bd09f5ed189fb00b1cc28e1e8570
ASN1Decoder: 6110fdeacfdb41559b1481457a1645be716610aa
BiometricSdk: 1d16c395413164d92a280b78006abba4307063e6
boost: 57d2868c099736d80fcd648bf211b4431e51a558
BVLinearGradient: 916632041121a658c704df89d99f04acb038de0f
CatCrypto: a477899b6be4954e75be4897e732da098cc0a5a8
Expand Down Expand Up @@ -792,7 +806,7 @@ SPEC CHECKSUMS:
libevent: 4049cae6c81cdb3654a443be001fb9bdceff7913
MMKV: aac95d817a100479445633f2b3ed8961b4ac5043
MMKVCore: 9cfef4c48c6c46f66226fc2e4634d78490206a48
mosip-inji-face-sdk: d5bc0fb66721c25450f92d3297efcb2cf0117271
mosip-mobileid-sdk: 6b8182276896194fdcacdde148b02d5d2d16b02a
Permission-BluetoothPeripheral: 2b88a131074edafd8a46a5cda4ba610ec986d2fb
Permission-Camera: 7ec9ee99704766ff9b90198183387a7f5d82b0c1
Permission-LocationAccuracy: a38ddb5c5d0b8e656f3c86e4a500f9bb88bc099d
Expand Down Expand Up @@ -848,6 +862,8 @@ SPEC CHECKSUMS:
RNScreens: 218801c16a2782546d30bd2026bb625c0302d70f
RNSecureRandom: 07efbdf2cd99efe13497433668e54acd7df49fef
RNSVG: 07dbd870b0dcdecc99b3a202fa37c8ca163caec2
TensorFlowLiteC: 20785a69299185a379ba9852b6625f00afd7984a
TensorFlowLiteObjC: 9a46a29a76661c513172cfffd3bf712b11ef25c3
Yoga: 065f0b74dba4832d6e328238de46eb72c5de9556
ZXingObjC: fdbb269f25dd2032da343e06f10224d62f537bdb

Expand Down
4 changes: 0 additions & 4 deletions lib/mosip-inji-face-sdk/faceAuth.ios.ts

This file was deleted.

3 changes: 0 additions & 3 deletions lib/mosip-inji-face-sdk/faceAuth.ts

This file was deleted.

1 change: 0 additions & 1 deletion machines/auth.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {init} from 'mosip-inji-face-sdk';
import {assign, ContextFrom, EventFrom, send, StateFrom} from 'xstate';
import {createModel} from 'xstate/lib/model';
import getAllConfigurations, {
Expand Down
32 changes: 16 additions & 16 deletions machines/faceScanner.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Camera, CameraCapturedPicture, PermissionResponse } from 'expo-camera';
import { CameraType, Face, ImageType } from 'expo-camera/build/Camera.types';
import { Linking } from 'react-native';
import { assign, EventFrom, StateFrom } from 'xstate';
import { createModel } from 'xstate/lib/model';
import {Camera, CameraCapturedPicture, PermissionResponse} from 'expo-camera';
import {CameraType, Face, ImageType} from 'expo-camera/build/Camera.types';
import {Linking} from 'react-native';
import {assign, EventFrom, StateFrom} from 'xstate';
import {createModel} from 'xstate/lib/model';

import mosipFaceAuth from '../lib/mosip-inji-face-sdk/faceAuth';
import {faceAuth} from 'mosip-mobileid-sdk';

const model = createModel(
{
Expand All @@ -19,15 +19,15 @@ const model = createModel(
},
{
events: {
READY: (cameraRef: Camera) => ({ cameraRef }),
READY: (cameraRef: Camera) => ({cameraRef}),
FLIP_CAMERA: () => ({}),
CAPTURE: () => ({}),
DENIED: (response: PermissionResponse) => ({ response }),
DENIED: (response: PermissionResponse) => ({response}),
GRANTED: () => ({}),
OPEN_SETTINGS: () => ({}),
APP_FOCUSED: () => ({}),
},
}
},
);

export const FaceScannerEvents = model.events;
Expand Down Expand Up @@ -176,7 +176,7 @@ export const createFaceScannerMachine = (vcImage: string) =>
}),

flipWhichCamera: model.assign({
whichCamera: (context) =>
whichCamera: context =>
context.whichCamera === Camera.Constants.Type.front
? Camera.Constants.Type.back
: Camera.Constants.Type.front,
Expand All @@ -190,7 +190,7 @@ export const createFaceScannerMachine = (vcImage: string) =>
},

services: {
checkPermission: () => async (callback) => {
checkPermission: () => async callback => {
const result = await Camera.getCameraPermissionsAsync();
if (result.granted) {
callback(FaceScannerEvents.GRANTED());
Expand All @@ -199,7 +199,7 @@ export const createFaceScannerMachine = (vcImage: string) =>
}
},

requestPermission: () => async (callback) => {
requestPermission: () => async callback => {
const result = await Camera.requestCameraPermissionsAsync();
if (result.granted) {
callback(FaceScannerEvents.GRANTED());
Expand All @@ -208,19 +208,19 @@ export const createFaceScannerMachine = (vcImage: string) =>
}
},

captureImage: (context) => {
captureImage: context => {
return context.cameraRef.takePictureAsync({
base64: true,
imageType: ImageType.jpg,
});
},

verifyImage: (context) => {
verifyImage: context => {
context.cameraRef.pausePreview();
const rxDataURI =
/data:(?<mime>[\w/\-.]+);(?<encoding>\w+),(?<data>.*)/;
const matches = rxDataURI.exec(vcImage).groups;
return mosipFaceAuth(context.capturedImage.base64, matches.data);
return faceAuth(context.capturedImage.base64, matches.data);
},
},

Expand All @@ -231,7 +231,7 @@ export const createFaceScannerMachine = (vcImage: string) =>

doesFaceMatch: (_context, event) => event.data,
},
}
},
);

type State = StateFrom<ReturnType<typeof createFaceScannerMachine>>;
Expand Down
Loading

0 comments on commit 47b5580

Please sign in to comment.