omnipay-reactnative-sdk 1.2.2-beta.0 → 1.2.2-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -136
- package/android/build.gradle +13 -0
- package/android/src/main/AndroidManifest.xml +5 -0
- package/android/src/main/java/com/omniretail/omnipay/LivenessCameraViewManager.java +116 -0
- package/android/src/main/java/com/omniretail/omnipay/LivenessDetectionModule.java +588 -0
- package/android/src/main/java/com/omniretail/omnipay/OmnipayActivityPackage.java +4 -1
- package/ios/LivenessCameraView.h +22 -0
- package/ios/LivenessCameraView.m +135 -0
- package/ios/LivenessCameraViewManager.h +12 -0
- package/ios/LivenessCameraViewManager.m +24 -0
- package/ios/LivenessDetectionModule.h +46 -0
- package/ios/LivenessDetectionModule.m +603 -0
- package/lib/commonjs/components/OmnipayProvider.js +6 -56
- package/lib/commonjs/components/OmnipayProvider.js.map +1 -1
- package/lib/commonjs/components/biometrics/FaceVerification.js +439 -0
- package/lib/commonjs/components/biometrics/FaceVerification.js.map +1 -0
- package/lib/commonjs/components/biometrics/LivenessCameraView.js +43 -0
- package/lib/commonjs/components/biometrics/LivenessCameraView.js.map +1 -0
- package/lib/commonjs/components/biometrics/LivenessDetection.js +252 -0
- package/lib/commonjs/components/biometrics/LivenessDetection.js.map +1 -0
- package/lib/commonjs/index.js +28 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/components/OmnipayProvider.js +6 -56
- package/lib/module/components/OmnipayProvider.js.map +1 -1
- package/lib/module/components/biometrics/FaceVerification.js +429 -0
- package/lib/module/components/biometrics/FaceVerification.js.map +1 -0
- package/lib/module/components/biometrics/LivenessCameraView.js +38 -0
- package/lib/module/components/biometrics/LivenessCameraView.js.map +1 -0
- package/lib/module/components/biometrics/LivenessDetection.js +244 -0
- package/lib/module/components/biometrics/LivenessDetection.js.map +1 -0
- package/lib/module/index.js +5 -0
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/components/OmnipayProvider.d.ts.map +1 -1
- package/lib/typescript/components/biometrics/FaceVerification.d.ts +12 -0
- package/lib/typescript/components/biometrics/FaceVerification.d.ts.map +1 -0
- package/lib/typescript/components/biometrics/LivenessCameraView.d.ts +22 -0
- package/lib/typescript/components/biometrics/LivenessCameraView.d.ts.map +1 -0
- package/lib/typescript/components/biometrics/LivenessDetection.d.ts +73 -0
- package/lib/typescript/components/biometrics/LivenessDetection.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +3 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/omnipay-reactnative-sdk.podspec +47 -0
- package/package.json +6 -11
- package/src/components/OmnipayProvider.tsx +8 -65
- package/src/components/biometrics/FaceVerification.tsx +484 -0
- package/src/components/biometrics/LivenessCameraView.tsx +61 -0
- package/src/components/biometrics/LivenessDetection.ts +305 -0
- package/src/index.tsx +18 -0
- package/lib/commonjs/components/FaceVerification.js +0 -755
- package/lib/commonjs/components/FaceVerification.js.map +0 -1
- package/lib/commonjs/types/faceVerification.js +0 -2
- package/lib/commonjs/types/faceVerification.js.map +0 -1
- package/lib/commonjs/types/index.js +0 -17
- package/lib/commonjs/types/index.js.map +0 -1
- package/lib/module/components/FaceVerification.js +0 -746
- package/lib/module/components/FaceVerification.js.map +0 -1
- package/lib/module/types/faceVerification.js +0 -2
- package/lib/module/types/faceVerification.js.map +0 -1
- package/lib/module/types/index.js +0 -2
- package/lib/module/types/index.js.map +0 -1
- package/lib/typescript/components/FaceVerification.d.ts +0 -10
- package/lib/typescript/components/FaceVerification.d.ts.map +0 -1
- package/lib/typescript/types/faceVerification.d.ts +0 -18
- package/lib/typescript/types/faceVerification.d.ts.map +0 -1
- package/lib/typescript/types/index.d.ts +0 -2
- package/lib/typescript/types/index.d.ts.map +0 -1
- package/src/components/FaceVerification.tsx +0 -884
- package/src/types/faceVerification.ts +0 -27
- package/src/types/index.ts +0 -1
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
|
+
import { NativeModules, NativeEventEmitter } from 'react-native';
|
|
3
|
+
const {
|
|
4
|
+
LivenessDetection: LivenessDetectionNative
|
|
5
|
+
} = NativeModules;
|
|
6
|
+
|
|
7
|
+
// TypeScript interfaces matching PRD specifications
|
|
8
|
+
|
|
9
|
+
// Main LivenessDetection class
|
|
10
|
+
class LivenessDetectionManager {
|
|
11
|
+
constructor() {
|
|
12
|
+
_defineProperty(this, "eventEmitter", null);
|
|
13
|
+
_defineProperty(this, "listeners", []);
|
|
14
|
+
_defineProperty(this, "callbacks", {});
|
|
15
|
+
_defineProperty(this, "isActive", false);
|
|
16
|
+
_defineProperty(this, "challengeResults", []);
|
|
17
|
+
_defineProperty(this, "startTime", 0);
|
|
18
|
+
if (LivenessDetectionNative) {
|
|
19
|
+
this.eventEmitter = new NativeEventEmitter(LivenessDetectionNative);
|
|
20
|
+
this.setupEventListeners();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
setupEventListeners() {
|
|
24
|
+
if (!this.eventEmitter) return;
|
|
25
|
+
|
|
26
|
+
// Challenge start event
|
|
27
|
+
this.listeners.push(this.eventEmitter.addListener('onChallengeStart', event => {
|
|
28
|
+
console.log('Liveness: Challenge started -', event.challenge);
|
|
29
|
+
if (this.callbacks.onChallengeStart) {
|
|
30
|
+
this.callbacks.onChallengeStart(event.challenge);
|
|
31
|
+
}
|
|
32
|
+
}));
|
|
33
|
+
|
|
34
|
+
// Challenge success event
|
|
35
|
+
this.listeners.push(this.eventEmitter.addListener('onChallengeSuccess', event => {
|
|
36
|
+
console.log('Liveness: Challenge completed -', event.challenge);
|
|
37
|
+
|
|
38
|
+
// Record challenge result
|
|
39
|
+
const result = {
|
|
40
|
+
challenge: event.challenge,
|
|
41
|
+
success: true,
|
|
42
|
+
timestamp: Date.now(),
|
|
43
|
+
duration: Date.now() - this.startTime
|
|
44
|
+
};
|
|
45
|
+
this.challengeResults.push(result);
|
|
46
|
+
if (this.callbacks.onChallengeSuccess) {
|
|
47
|
+
this.callbacks.onChallengeSuccess(event.challenge);
|
|
48
|
+
}
|
|
49
|
+
}));
|
|
50
|
+
|
|
51
|
+
// Challenge failure event
|
|
52
|
+
this.listeners.push(this.eventEmitter.addListener('onChallengeFailure', event => {
|
|
53
|
+
console.log('Liveness: Challenge failed -', event.challenge, event.reason);
|
|
54
|
+
|
|
55
|
+
// Record failed challenge result
|
|
56
|
+
const result = {
|
|
57
|
+
challenge: event.challenge,
|
|
58
|
+
success: false,
|
|
59
|
+
timestamp: Date.now(),
|
|
60
|
+
duration: Date.now() - this.startTime
|
|
61
|
+
};
|
|
62
|
+
this.challengeResults.push(result);
|
|
63
|
+
if (this.callbacks.onChallengeFailure) {
|
|
64
|
+
this.callbacks.onChallengeFailure(event.challenge, event.reason);
|
|
65
|
+
}
|
|
66
|
+
}));
|
|
67
|
+
|
|
68
|
+
// All challenges complete event
|
|
69
|
+
this.listeners.push(this.eventEmitter.addListener('onAllChallengesComplete', event => {
|
|
70
|
+
console.log('Liveness: All challenges completed', event);
|
|
71
|
+
const result = {
|
|
72
|
+
success: event.success,
|
|
73
|
+
screenshot: event.screenshot,
|
|
74
|
+
challengeResults: this.challengeResults
|
|
75
|
+
};
|
|
76
|
+
this.isActive = false;
|
|
77
|
+
if (this.callbacks.onAllChallengesComplete) {
|
|
78
|
+
this.callbacks.onAllChallengesComplete(result);
|
|
79
|
+
}
|
|
80
|
+
}));
|
|
81
|
+
|
|
82
|
+
// Screenshot captured event
|
|
83
|
+
this.listeners.push(this.eventEmitter.addListener('onScreenshotCaptured', event => {
|
|
84
|
+
console.log('Liveness: Screenshot captured');
|
|
85
|
+
if (this.callbacks.onScreenshotCaptured) {
|
|
86
|
+
this.callbacks.onScreenshotCaptured(event.screenshot);
|
|
87
|
+
}
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Start liveness detection with specified challenges
|
|
93
|
+
* @param config - Configuration including challenges array
|
|
94
|
+
* @param callbacks - Event callbacks
|
|
95
|
+
* @returns Promise resolving to LivenessResult
|
|
96
|
+
*/
|
|
97
|
+
async startLivenessDetection(config, callbacks) {
|
|
98
|
+
if (this.isActive) {
|
|
99
|
+
throw new Error('Liveness detection is already active');
|
|
100
|
+
}
|
|
101
|
+
if (!LivenessDetectionNative) {
|
|
102
|
+
throw new Error('Liveness detection is not available on this platform');
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Validate challenges
|
|
106
|
+
if (!config.challenges || config.challenges.length === 0) {
|
|
107
|
+
throw new Error('At least one challenge must be specified');
|
|
108
|
+
}
|
|
109
|
+
const validChallenges = ['smile', 'blink', 'turn_left', 'turn_right'];
|
|
110
|
+
for (const challenge of config.challenges) {
|
|
111
|
+
if (!validChallenges.includes(challenge)) {
|
|
112
|
+
throw new Error(`Invalid challenge: ${challenge}`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
try {
|
|
116
|
+
// Check camera permission first
|
|
117
|
+
const hasPermission = await this.checkCameraPermission();
|
|
118
|
+
if (!hasPermission) {
|
|
119
|
+
throw new Error('Camera permission is required. Please call requestCameraPermission() first.');
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Set callbacks
|
|
123
|
+
this.callbacks = callbacks || {};
|
|
124
|
+
this.challengeResults = [];
|
|
125
|
+
this.startTime = Date.now();
|
|
126
|
+
this.isActive = true;
|
|
127
|
+
|
|
128
|
+
// Start detection on native side
|
|
129
|
+
const result = await LivenessDetectionNative.startLivenessDetection(config.challenges);
|
|
130
|
+
console.log('Liveness detection started:', result);
|
|
131
|
+
|
|
132
|
+
// Return a promise that resolves when all challenges are complete
|
|
133
|
+
return new Promise((resolve, reject) => {
|
|
134
|
+
const originalOnComplete = this.callbacks.onAllChallengesComplete;
|
|
135
|
+
this.callbacks.onAllChallengesComplete = livenessResult => {
|
|
136
|
+
// Call original callback if provided
|
|
137
|
+
if (originalOnComplete) {
|
|
138
|
+
originalOnComplete(livenessResult);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// Resolve the promise
|
|
142
|
+
resolve(livenessResult);
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
// Set up timeout if specified
|
|
146
|
+
if (config.timeout) {
|
|
147
|
+
setTimeout(() => {
|
|
148
|
+
if (this.isActive) {
|
|
149
|
+
this.stopDetection();
|
|
150
|
+
reject(new Error('Liveness detection timed out'));
|
|
151
|
+
}
|
|
152
|
+
}, config.timeout);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
} catch (error) {
|
|
156
|
+
this.isActive = false;
|
|
157
|
+
throw error;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Stop liveness detection
|
|
163
|
+
*/
|
|
164
|
+
stopDetection() {
|
|
165
|
+
if (LivenessDetectionNative && this.isActive) {
|
|
166
|
+
LivenessDetectionNative.stopLivenessDetection();
|
|
167
|
+
this.isActive = false;
|
|
168
|
+
this.callbacks = {};
|
|
169
|
+
this.challengeResults = [];
|
|
170
|
+
console.log('Liveness detection stopped');
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Check if liveness detection is currently active
|
|
176
|
+
*/
|
|
177
|
+
isDetectionActive() {
|
|
178
|
+
return this.isActive;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Get available challenge types
|
|
183
|
+
*/
|
|
184
|
+
getAvailableChallenges() {
|
|
185
|
+
return ['smile', 'blink', 'turn_left', 'turn_right'];
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Check if camera permission is granted
|
|
190
|
+
*/
|
|
191
|
+
async checkCameraPermission() {
|
|
192
|
+
if (!LivenessDetectionNative) {
|
|
193
|
+
throw new Error('Liveness detection is not available on this platform');
|
|
194
|
+
}
|
|
195
|
+
try {
|
|
196
|
+
return await LivenessDetectionNative.checkCameraPermission();
|
|
197
|
+
} catch (error) {
|
|
198
|
+
console.error('Failed to check camera permission:', error);
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Request camera permission from the user
|
|
205
|
+
*/
|
|
206
|
+
async requestCameraPermission() {
|
|
207
|
+
if (!LivenessDetectionNative) {
|
|
208
|
+
throw new Error('Liveness detection is not available on this platform');
|
|
209
|
+
}
|
|
210
|
+
try {
|
|
211
|
+
return await LivenessDetectionNative.requestCameraPermission();
|
|
212
|
+
} catch (error) {
|
|
213
|
+
console.error('Failed to request camera permission:', error);
|
|
214
|
+
return false;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Cleanup - remove all event listeners
|
|
220
|
+
*/
|
|
221
|
+
cleanup() {
|
|
222
|
+
this.listeners.forEach(listener => {
|
|
223
|
+
if (listener && listener.remove) {
|
|
224
|
+
listener.remove();
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
this.listeners = [];
|
|
228
|
+
this.stopDetection();
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// Export singleton instance
|
|
233
|
+
export const LivenessDetection = new LivenessDetectionManager();
|
|
234
|
+
|
|
235
|
+
// Types are already exported above
|
|
236
|
+
|
|
237
|
+
// Constants from native module
|
|
238
|
+
export const LivenessConstants = {
|
|
239
|
+
CHALLENGE_SMILE: 'smile',
|
|
240
|
+
CHALLENGE_BLINK: 'blink',
|
|
241
|
+
CHALLENGE_TURN_LEFT: 'turn_left',
|
|
242
|
+
CHALLENGE_TURN_RIGHT: 'turn_right'
|
|
243
|
+
};
|
|
244
|
+
//# sourceMappingURL=LivenessDetection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["NativeModules","NativeEventEmitter","LivenessDetection","LivenessDetectionNative","LivenessDetectionManager","constructor","eventEmitter","setupEventListeners","listeners","push","addListener","event","console","log","challenge","callbacks","onChallengeStart","result","success","timestamp","Date","now","duration","startTime","challengeResults","onChallengeSuccess","reason","onChallengeFailure","screenshot","isActive","onAllChallengesComplete","onScreenshotCaptured","startLivenessDetection","config","Error","challenges","length","validChallenges","includes","hasPermission","checkCameraPermission","Promise","resolve","reject","originalOnComplete","livenessResult","timeout","setTimeout","stopDetection","error","stopLivenessDetection","isDetectionActive","getAvailableChallenges","requestCameraPermission","cleanup","forEach","listener","remove","LivenessConstants","CHALLENGE_SMILE","CHALLENGE_BLINK","CHALLENGE_TURN_LEFT","CHALLENGE_TURN_RIGHT"],"sourceRoot":"../../src","sources":["LivenessDetection.ts"],"mappings":";AAAA,SAASA,aAAa,EAAEC,kBAAkB,QAAQ,cAAc;AAEhE,MAAM;EAAEC,iBAAiB,EAAEC;AAAwB,CAAC,GAAGH,aAAa;;AAEpE;;AA6BA;AACA,MAAMI,wBAAwB,CAAC;EAQ7BC,WAAW,GAAG;IAAA,sCAPoC,IAAI;IAAA,mCAC3B,EAAE;IAAA,mCACU,CAAC,CAAC;IAAA,kCACtB,KAAK;IAAA,0CACsB,EAAE;IAAA,mCACpB,CAAC;IAG3B,IAAIF,uBAAuB,EAAE;MAC3B,IAAI,CAACG,YAAY,GAAG,IAAIL,kBAAkB,CAACE,uBAAuB,CAAC;MACnE,IAAI,CAACI,mBAAmB,EAAE;IAC5B;EACF;EAEQA,mBAAmB,GAAG;IAC5B,IAAI,CAAC,IAAI,CAACD,YAAY,EAAE;;IAExB;IACA,IAAI,CAACE,SAAS,CAACC,IAAI,CACjB,IAAI,CAACH,YAAY,CAACI,WAAW,CAAC,kBAAkB,EAAGC,KAAK,IAAK;MAC3DC,OAAO,CAACC,GAAG,CAAC,+BAA+B,EAAEF,KAAK,CAACG,SAAS,CAAC;MAC7D,IAAI,IAAI,CAACC,SAAS,CAACC,gBAAgB,EAAE;QACnC,IAAI,CAACD,SAAS,CAACC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MAC5B,MAAM,IAAI+B,KAAK,CAAC,sDAAsD,CAAC;IACzE;IAEA,IAAI;MACF,OAAO,MAAM/B,uBAAuB,CAACkD,uBAAuB,EAAE;IAChE,CAAC,CAAC,OAAOJ,KAAK,EAAE;MACdrC,OAAO,CAACqC,KAAK,CAAC,sCAAsC,EAAEA,KAAK,CAAC;MAC5D,OAAO,KAAK;IACd;EACF;;EAEA;AACF;AACA;EACEK,OAAO,GAAS;IACd,IAAI,CAAC9C,SAAS,CAAC+C,OAAO,CAAEC,QAAQ,IAAK;MACnC,IAAIA,QAAQ,IAAIA,QAAQ,CAACC,MAAM,EAAE;QAC/BD,QAAQ,CAACC,MAAM,EAAE;MACnB;IACF,CAAC,CAAC;IACF,IAAI,CAACjD,SAAS,GAAG,EAAE;IACnB,IAAI,CAACwC,aAAa,EAAE;EACtB;AACF;;AAEA;AACA,OAAO,MAAM9C,iBAAiB,GAAG,IAAIE,wBAAwB,EAAE;;AAE/D;;AAEA;AACA,OAAO,MAAMsD,iBAAiB,GAAG;EAC/BC,eAAe,EAAE,OAAO;EACxBC,eAAe,EAAE,OAAO;EACxBC,mBAAmB,EAAE,WAAW;EAChCC,oBAAoB,EAAE;AACxB,CAAU"}
|
package/lib/module/index.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import Omnipay from './components/OmnipayView';
|
|
2
2
|
export { OmnipayProvider } from './components/OmnipayProvider';
|
|
3
3
|
export { useOmnipay } from './hooks/useOmnipay';
|
|
4
|
+
|
|
5
|
+
// Liveness Detection exports
|
|
6
|
+
export { LivenessDetection, LivenessConstants } from './components/biometrics/LivenessDetection';
|
|
7
|
+
export { default as LivenessCameraView } from './components/biometrics/LivenessCameraView';
|
|
8
|
+
export { default as FaceVerification } from './components/biometrics/FaceVerification';
|
|
4
9
|
export default Omnipay;
|
|
5
10
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Omnipay","OmnipayProvider","useOmnipay"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,OAAOA,OAAO,MAAM,0BAA0B;AAE9C,SAASC,eAAe,QAAQ,8BAA8B;AAC9D,SAASC,UAAU,QAAQ,oBAAoB
|
|
1
|
+
{"version":3,"names":["Omnipay","OmnipayProvider","useOmnipay","LivenessDetection","LivenessConstants","default","LivenessCameraView","FaceVerification"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":"AAAA,OAAOA,OAAO,MAAM,0BAA0B;AAE9C,SAASC,eAAe,QAAQ,8BAA8B;AAC9D,SAASC,UAAU,QAAQ,oBAAoB;;AAE/C;AACA,SACEC,iBAAiB,EACjBC,iBAAiB,QAKZ,2CAA2C;AAElD,SACEC,OAAO,IAAIC,kBAAkB,QAExB,4CAA4C;AAEnD,SAASD,OAAO,IAAIE,gBAAgB,QAAQ,0CAA0C;AAEtF,eAAeP,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OmnipayProvider.d.ts","sourceRoot":"","sources":["../../../src/components/OmnipayProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsC,MAAM,OAAO,CAAC;AAyB3D,aAAK,oBAAoB,GAAG;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,KAAK,GAAG,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,KAAK,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,EAAE,CAAC;CACrD,CAAC;AAkBF,aAAK,iBAAiB,GAAG;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAEF,aAAK,kBAAkB,GAAG;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,OAAO,CAAC;IAC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EAAE,CAAC,EACf,WAAW,EACX,WAAW,EACX,OAAO,EACP,OAAO,EACP,YAAY,EACZ,SAAS,EACT,eAAe,EACf,YAAY,EACZ,SAAS,EACT,OAAO,EACP,kBAAkB,EAClB,QAAQ,EACR,UAAU,EACV,kBAAkB,EAClB,uBAAuB,EACvB,SAAS,EACT,SAAS,EACT,UAAU,EACV,SAAS,GACV,EAAE,kBAAkB,KAAK,IAAI,CAAC;CAChC,CAAC;AAOF,eAAO,MAAM,cAAc,0CAE1B,CAAC;AAEF,eAAO,MAAM,eAAe,yCAKzB,oBAAoB,gBAsWtB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type LivenessResult } from './LivenessDetection';
|
|
3
|
+
declare type FaceVerificationProps = {
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
onSuccess: (result: LivenessResult) => void;
|
|
6
|
+
primaryColor: string;
|
|
7
|
+
challenges?: ('smile' | 'blink' | 'turn_left' | 'turn_right')[];
|
|
8
|
+
timeout?: number;
|
|
9
|
+
};
|
|
10
|
+
declare const FaceVerification: React.FC<FaceVerificationProps>;
|
|
11
|
+
export default FaceVerification;
|
|
12
|
+
//# sourceMappingURL=FaceVerification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FaceVerification.d.ts","sourceRoot":"","sources":["../../../../src/components/biometrics/FaceVerification.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2C,MAAM,OAAO,CAAC;AAWhE,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,qBAAqB,CAAC;AAG7B,aAAK,qBAAqB,GAAG;IAC3B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,SAAS,EAAE,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC;IAC5C,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,CAAC,OAAO,GAAG,OAAO,GAAG,WAAW,GAAG,YAAY,CAAC,EAAE,CAAC;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAIF,QAAA,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CA8NrD,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ViewStyle } from 'react-native';
|
|
3
|
+
interface LivenessCameraViewProps {
|
|
4
|
+
style?: ViewStyle;
|
|
5
|
+
scaleType?: 'fillCenter' | 'fillStart' | 'fillEnd' | 'fitCenter' | 'fitStart' | 'fitEnd';
|
|
6
|
+
onCameraReady?: () => void;
|
|
7
|
+
onCameraError?: (error: {
|
|
8
|
+
nativeEvent: {
|
|
9
|
+
error: string;
|
|
10
|
+
};
|
|
11
|
+
}) => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* LivenessCameraView - Native camera component for liveness detection
|
|
15
|
+
*
|
|
16
|
+
* This component provides a camera preview that integrates with the
|
|
17
|
+
* liveness detection native module for real-time face analysis.
|
|
18
|
+
*/
|
|
19
|
+
declare const LivenessCameraView: React.FC<LivenessCameraViewProps>;
|
|
20
|
+
export default LivenessCameraView;
|
|
21
|
+
export type { LivenessCameraViewProps };
|
|
22
|
+
//# sourceMappingURL=LivenessCameraView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LivenessCameraView.d.ts","sourceRoot":"","sources":["../../../../src/components/biometrics/LivenessCameraView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAoC,SAAS,EAAE,MAAM,cAAc,CAAC;AAG3E,UAAU,uBAAuB;IAC/B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,SAAS,CAAC,EACN,YAAY,GACZ,WAAW,GACX,SAAS,GACT,WAAW,GACX,UAAU,GACV,QAAQ,CAAC;IACb,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,WAAW,EAAE;YAAE,KAAK,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE,KAAK,IAAI,CAAC;CACrE;AAgBD;;;;;GAKG;AACH,QAAA,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAoBzD,CAAC;AAEF,eAAe,kBAAkB,CAAC;AAClC,YAAY,EAAE,uBAAuB,EAAE,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export interface LivenessDetectionConfig {
|
|
2
|
+
challenges: ('smile' | 'blink' | 'turn_left' | 'turn_right')[];
|
|
3
|
+
timeout?: number;
|
|
4
|
+
}
|
|
5
|
+
export interface ChallengeResult {
|
|
6
|
+
challenge: string;
|
|
7
|
+
success: boolean;
|
|
8
|
+
timestamp: number;
|
|
9
|
+
duration?: number;
|
|
10
|
+
}
|
|
11
|
+
export interface LivenessResult {
|
|
12
|
+
success: boolean;
|
|
13
|
+
screenshot?: string;
|
|
14
|
+
challengeResults: ChallengeResult[];
|
|
15
|
+
error?: string;
|
|
16
|
+
}
|
|
17
|
+
export interface LivenessCallbacks {
|
|
18
|
+
onChallengeStart?: (challenge: string) => void;
|
|
19
|
+
onChallengeSuccess?: (challenge: string) => void;
|
|
20
|
+
onChallengeFailure?: (challenge: string, reason: string) => void;
|
|
21
|
+
onAllChallengesComplete?: (result: LivenessResult) => void;
|
|
22
|
+
onScreenshotCaptured?: (screenshot: string) => void;
|
|
23
|
+
}
|
|
24
|
+
declare class LivenessDetectionManager {
|
|
25
|
+
private eventEmitter;
|
|
26
|
+
private listeners;
|
|
27
|
+
private callbacks;
|
|
28
|
+
private isActive;
|
|
29
|
+
private challengeResults;
|
|
30
|
+
private startTime;
|
|
31
|
+
constructor();
|
|
32
|
+
private setupEventListeners;
|
|
33
|
+
/**
|
|
34
|
+
* Start liveness detection with specified challenges
|
|
35
|
+
* @param config - Configuration including challenges array
|
|
36
|
+
* @param callbacks - Event callbacks
|
|
37
|
+
* @returns Promise resolving to LivenessResult
|
|
38
|
+
*/
|
|
39
|
+
startLivenessDetection(config: LivenessDetectionConfig, callbacks?: LivenessCallbacks): Promise<LivenessResult>;
|
|
40
|
+
/**
|
|
41
|
+
* Stop liveness detection
|
|
42
|
+
*/
|
|
43
|
+
stopDetection(): void;
|
|
44
|
+
/**
|
|
45
|
+
* Check if liveness detection is currently active
|
|
46
|
+
*/
|
|
47
|
+
isDetectionActive(): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Get available challenge types
|
|
50
|
+
*/
|
|
51
|
+
getAvailableChallenges(): string[];
|
|
52
|
+
/**
|
|
53
|
+
* Check if camera permission is granted
|
|
54
|
+
*/
|
|
55
|
+
checkCameraPermission(): Promise<boolean>;
|
|
56
|
+
/**
|
|
57
|
+
* Request camera permission from the user
|
|
58
|
+
*/
|
|
59
|
+
requestCameraPermission(): Promise<boolean>;
|
|
60
|
+
/**
|
|
61
|
+
* Cleanup - remove all event listeners
|
|
62
|
+
*/
|
|
63
|
+
cleanup(): void;
|
|
64
|
+
}
|
|
65
|
+
export declare const LivenessDetection: LivenessDetectionManager;
|
|
66
|
+
export declare const LivenessConstants: {
|
|
67
|
+
readonly CHALLENGE_SMILE: "smile";
|
|
68
|
+
readonly CHALLENGE_BLINK: "blink";
|
|
69
|
+
readonly CHALLENGE_TURN_LEFT: "turn_left";
|
|
70
|
+
readonly CHALLENGE_TURN_RIGHT: "turn_right";
|
|
71
|
+
};
|
|
72
|
+
export {};
|
|
73
|
+
//# sourceMappingURL=LivenessDetection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LivenessDetection.d.ts","sourceRoot":"","sources":["../../../../src/components/biometrics/LivenessDetection.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,CAAC,OAAO,GAAG,OAAO,GAAG,WAAW,GAAG,YAAY,CAAC,EAAE,CAAC;IAC/D,OAAO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,IAAI,MAAM,EAAE;IAIlC;;OAEG;IACG,qBAAqB,IAAI,OAAO,CAAC,OAAO,CAAC;IAa/C;;OAEG;IACG,uBAAuB,IAAI,OAAO,CAAC,OAAO,CAAC;IAajD;;OAEG;IACH,OAAO,IAAI,IAAI;CAShB;AAGD,eAAO,MAAM,iBAAiB,0BAAiC,CAAC;AAKhE,eAAO,MAAM,iBAAiB;;;;;CAKpB,CAAC"}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import Omnipay from './components/OmnipayView';
|
|
2
2
|
export { OmnipayProvider } from './components/OmnipayProvider';
|
|
3
3
|
export { useOmnipay } from './hooks/useOmnipay';
|
|
4
|
+
export { LivenessDetection, LivenessConstants, type LivenessDetectionConfig, type ChallengeResult, type LivenessResult, type LivenessCallbacks, } from './components/biometrics/LivenessDetection';
|
|
5
|
+
export { default as LivenessCameraView, type LivenessCameraViewProps, } from './components/biometrics/LivenessCameraView';
|
|
6
|
+
export { default as FaceVerification } from './components/biometrics/FaceVerification';
|
|
4
7
|
export default Omnipay;
|
|
5
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,0BAA0B,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,0BAA0B,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,KAAK,uBAAuB,EAC5B,KAAK,eAAe,EACpB,KAAK,cAAc,EACnB,KAAK,iBAAiB,GACvB,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EACL,OAAO,IAAI,kBAAkB,EAC7B,KAAK,uBAAuB,GAC7B,MAAM,4CAA4C,CAAC;AAEpD,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAEvF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
require "json"
|
|
2
|
+
|
|
3
|
+
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
|
+
|
|
5
|
+
Pod::Spec.new do |s|
|
|
6
|
+
s.name = "omnipay-reactnative-sdk"
|
|
7
|
+
s.version = package["version"]
|
|
8
|
+
s.summary = package["description"]
|
|
9
|
+
s.homepage = package["homepage"]
|
|
10
|
+
s.license = package["license"]
|
|
11
|
+
s.authors = package["author"]
|
|
12
|
+
|
|
13
|
+
s.platforms = { :ios => "11.0" }
|
|
14
|
+
s.source = { :git => "https://github.com/engrtitus/omnipay-reactnative-sdk.git", :tag => "#{s.version}" }
|
|
15
|
+
|
|
16
|
+
# Source files
|
|
17
|
+
s.source_files = "ios/**/*.{h,m,mm,swift}"
|
|
18
|
+
|
|
19
|
+
# Required frameworks for liveness detection
|
|
20
|
+
s.frameworks = [
|
|
21
|
+
"AVFoundation",
|
|
22
|
+
"Vision",
|
|
23
|
+
"CoreMedia",
|
|
24
|
+
"CoreVideo",
|
|
25
|
+
"ImageIO",
|
|
26
|
+
"UIKit",
|
|
27
|
+
"Foundation"
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
# React Native dependencies
|
|
31
|
+
s.dependency "React-Core"
|
|
32
|
+
|
|
33
|
+
# iOS deployment target
|
|
34
|
+
s.ios.deployment_target = '11.0'
|
|
35
|
+
|
|
36
|
+
# Compiler flags
|
|
37
|
+
s.compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1'
|
|
38
|
+
|
|
39
|
+
# Pod configuration
|
|
40
|
+
s.pod_target_xcconfig = {
|
|
41
|
+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/Folly\""
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
# Minimum iOS version for Vision framework
|
|
45
|
+
s.ios.deployment_target = '11.0'
|
|
46
|
+
|
|
47
|
+
end
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "omnipay-reactnative-sdk",
|
|
3
|
-
"version": "1.2.2-beta.
|
|
3
|
+
"version": "1.2.2-beta.2",
|
|
4
4
|
"description": "Omnipay react native sdk",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -35,8 +35,7 @@
|
|
|
35
35
|
"example": "yarn --cwd example",
|
|
36
36
|
"bootstrap": "yarn example && yarn install && yarn example pods",
|
|
37
37
|
"format": "prettier --write '**'",
|
|
38
|
-
"lint-fix": "eslint --fix --ext .ts,.tsx ."
|
|
39
|
-
"publish": "npm publish --tag beta"
|
|
38
|
+
"lint-fix": "eslint --fix --ext .ts,.tsx ."
|
|
40
39
|
},
|
|
41
40
|
"keywords": [
|
|
42
41
|
"react-native",
|
|
@@ -81,8 +80,7 @@
|
|
|
81
80
|
"peerDependencies": {
|
|
82
81
|
"react": "*",
|
|
83
82
|
"react-native": "*",
|
|
84
|
-
"react-native-share": "^10.2.1"
|
|
85
|
-
"react-native-svg": "^13.4.0"
|
|
83
|
+
"react-native-share": "^10.2.1"
|
|
86
84
|
},
|
|
87
85
|
"jest": {
|
|
88
86
|
"preset": "react-native",
|
|
@@ -160,10 +158,7 @@
|
|
|
160
158
|
"dependencies": {
|
|
161
159
|
"@react-native-async-storage/async-storage": "^1.19.0",
|
|
162
160
|
"react-native-select-contact": "^1.6.3",
|
|
163
|
-
"react-native-webview": "^11.23.1"
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
"react-native-svg": "^13.4.0",
|
|
167
|
-
"react-native-worklets-core": "^1.0.0"
|
|
168
|
-
}
|
|
161
|
+
"react-native-webview": "^11.23.1"
|
|
162
|
+
},
|
|
163
|
+
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
169
164
|
}
|
|
@@ -19,7 +19,7 @@ import WebView, { WebViewMessageEvent } from 'react-native-webview';
|
|
|
19
19
|
import { getContact } from '../functions';
|
|
20
20
|
import Share from 'react-native-share';
|
|
21
21
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
22
|
-
import FaceVerification from './FaceVerification';
|
|
22
|
+
import FaceVerification from './biometrics/FaceVerification';
|
|
23
23
|
|
|
24
24
|
const OmnipayActivity = NativeModules.OmnipayActivity || {};
|
|
25
25
|
|
|
@@ -125,11 +125,7 @@ export const OmnipayProvider = ({
|
|
|
125
125
|
const isValidColor = color.length > 2;
|
|
126
126
|
const onCloseRef = useRef<(() => void) | undefined>(undefined);
|
|
127
127
|
const [canUsePos, setCanUsePos] = useState(false);
|
|
128
|
-
|
|
129
|
-
// Face verification state
|
|
130
128
|
const [showFaceVerification, setShowFaceVerification] = useState(false);
|
|
131
|
-
const [faceVerificationOptions, setFaceVerificationOptions] =
|
|
132
|
-
useState<any>(null);
|
|
133
129
|
|
|
134
130
|
useEffect(() => {
|
|
135
131
|
checkPaymentApp();
|
|
@@ -287,9 +283,6 @@ export const OmnipayProvider = ({
|
|
|
287
283
|
if (dataKey === 'startPosTransaction') {
|
|
288
284
|
startPosTransaction(JSON.parse(dataValue));
|
|
289
285
|
}
|
|
290
|
-
if (dataKey === 'startFaceVerification') {
|
|
291
|
-
startFaceVerification(dataValue ? JSON.parse(dataValue) : {});
|
|
292
|
-
}
|
|
293
286
|
}
|
|
294
287
|
} catch (error) {}
|
|
295
288
|
}
|
|
@@ -373,44 +366,6 @@ export const OmnipayProvider = ({
|
|
|
373
366
|
}
|
|
374
367
|
}
|
|
375
368
|
|
|
376
|
-
function startFaceVerification(options: any) {
|
|
377
|
-
setFaceVerificationOptions(options);
|
|
378
|
-
setShowFaceVerification(true);
|
|
379
|
-
}
|
|
380
|
-
|
|
381
|
-
function handleFaceVerificationSuccess(base64Image: string) {
|
|
382
|
-
setShowFaceVerification(false);
|
|
383
|
-
postMessage({
|
|
384
|
-
dataKey: 'faceVerificationComplete',
|
|
385
|
-
dataValue: {
|
|
386
|
-
success: true,
|
|
387
|
-
image: base64Image,
|
|
388
|
-
...(faceVerificationOptions || {}),
|
|
389
|
-
},
|
|
390
|
-
});
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
function handleFaceVerificationFailure() {
|
|
394
|
-
setShowFaceVerification(false);
|
|
395
|
-
postMessage({
|
|
396
|
-
dataKey: 'faceVerificationComplete',
|
|
397
|
-
dataValue: {
|
|
398
|
-
success: false,
|
|
399
|
-
error: 'Face verification failed',
|
|
400
|
-
},
|
|
401
|
-
});
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
function handleFaceVerificationCancel() {
|
|
405
|
-
setShowFaceVerification(false);
|
|
406
|
-
postMessage({
|
|
407
|
-
dataKey: 'faceVerificationCancelled',
|
|
408
|
-
dataValue: {
|
|
409
|
-
cancelled: true,
|
|
410
|
-
},
|
|
411
|
-
});
|
|
412
|
-
}
|
|
413
|
-
|
|
414
369
|
const webviewStyle = getWebviewStyle();
|
|
415
370
|
const isPropsValid = isValidColor && !!publicKey && isValidEnv;
|
|
416
371
|
const isWalletView = webviewUrl.includes('view=wallet');
|
|
@@ -503,24 +458,16 @@ export const OmnipayProvider = ({
|
|
|
503
458
|
</TouchableOpacity>
|
|
504
459
|
</Modal>
|
|
505
460
|
)}
|
|
506
|
-
|
|
507
|
-
{/* Face Verification Modal */}
|
|
508
|
-
<Modal
|
|
509
|
-
visible={showFaceVerification}
|
|
510
|
-
transparent
|
|
511
|
-
animationType="slide"
|
|
512
|
-
>
|
|
513
|
-
<View style={styles.faceVerificationContainer}>
|
|
514
|
-
<FaceVerification
|
|
515
|
-
onSuccess={handleFaceVerificationSuccess}
|
|
516
|
-
onFailure={handleFaceVerificationFailure}
|
|
517
|
-
onCancel={handleFaceVerificationCancel}
|
|
518
|
-
/>
|
|
519
|
-
</View>
|
|
520
|
-
</Modal>
|
|
521
461
|
</>
|
|
522
462
|
)}
|
|
523
463
|
{children}
|
|
464
|
+
{showFaceVerification && (
|
|
465
|
+
<FaceVerification
|
|
466
|
+
onClose={() => setShowFaceVerification(false)}
|
|
467
|
+
onSuccess={() => setShowFaceVerification(false)}
|
|
468
|
+
primaryColor={color}
|
|
469
|
+
/>
|
|
470
|
+
)}
|
|
524
471
|
</OmnipayContext.Provider>
|
|
525
472
|
);
|
|
526
473
|
};
|
|
@@ -640,8 +587,4 @@ const styles = StyleSheet.create({
|
|
|
640
587
|
justifyContent: 'center',
|
|
641
588
|
},
|
|
642
589
|
buttonText: { color: 'white', fontSize: 16, paddingHorizontal: 30 },
|
|
643
|
-
faceVerificationContainer: {
|
|
644
|
-
flex: 1,
|
|
645
|
-
backgroundColor: 'white',
|
|
646
|
-
},
|
|
647
590
|
});
|