@finos_sdk/sdk-ekyc 0.0.22 → 0.0.23
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.
|
@@ -1,3 +1,473 @@
|
|
|
1
|
-
|
|
1
|
+
package com.sdkekycrn
|
|
2
2
|
|
|
3
|
+
import android.util.Base64
|
|
4
|
+
import android.util.Log
|
|
5
|
+
import com.facebook.react.bridge.Arguments
|
|
6
|
+
import com.facebook.react.bridge.Promise
|
|
7
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
8
|
+
import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
9
|
+
import com.facebook.react.bridge.ReactMethod
|
|
10
|
+
import com.facebook.react.bridge.WritableMap
|
|
11
|
+
import com.facebook.react.module.annotations.ReactModule
|
|
12
|
+
import com.facebook.react.modules.core.DeviceEventManagerModule
|
|
13
|
+
import finos.sdk.c06.SdkEkycC06
|
|
14
|
+
import finos.sdk.core.define.EKYCEvent
|
|
15
|
+
import finos.sdk.core.define.SDKType
|
|
16
|
+
import finos.sdk.core.model.response.SDKEkycResult
|
|
17
|
+
import finos.sdk.core.model.sdk.config.C06Config
|
|
18
|
+
import finos.sdk.core.model.sdk.config.EKYCConfigSDK
|
|
19
|
+
import finos.sdk.core.model.sdk.config.FaceServiceConfig
|
|
20
|
+
import finos.sdk.core.model.sdk.config.LivenessConfig
|
|
21
|
+
import finos.sdk.core.model.sdk.config.NfcConfig
|
|
22
|
+
import finos.sdk.core.model.sdk.config.OcrConfig
|
|
23
|
+
import finos.sdk.ekyc.SdkEkyc
|
|
24
|
+
import finos.sdk.faceservice.SdkEkycFaceService
|
|
25
|
+
import finos.sdk.liveness.SdkEkycLiveness
|
|
26
|
+
import finos.sdk.nfc.SdkEkycNfc
|
|
27
|
+
import finos.sdk.ocr.SdkEkycOcr
|
|
28
|
+
import java.io.File
|
|
29
|
+
import java.io.FileOutputStream
|
|
30
|
+
import java.util.Date
|
|
3
31
|
|
|
32
|
+
@ReactModule(name = EKYCModule.NAME)
|
|
33
|
+
class EKYCModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
|
|
34
|
+
|
|
35
|
+
companion object {
|
|
36
|
+
const val NAME = "EKYCModule"
|
|
37
|
+
private const val TAG = "EKYCModule"
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
override fun getName(): String = NAME
|
|
41
|
+
|
|
42
|
+
private fun sendEvent(eventName: String, params: WritableMap?) {
|
|
43
|
+
reactApplicationContext
|
|
44
|
+
.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
|
|
45
|
+
.emit(eventName, params)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@ReactMethod
|
|
49
|
+
fun initSdkEkyc(promise: Promise) {
|
|
50
|
+
try {
|
|
51
|
+
SdkEkyc.initSDKEkyc(reactApplicationContext) {
|
|
52
|
+
val params =
|
|
53
|
+
Arguments.createMap().apply {
|
|
54
|
+
putString("status", "success")
|
|
55
|
+
putString("message", "SDK EKYC initialized successfully")
|
|
56
|
+
}
|
|
57
|
+
sendEvent("EKYCInitEvent", params)
|
|
58
|
+
//promise.resolve("SDK EKYC initialized successfully")
|
|
59
|
+
promise.resolve(true)
|
|
60
|
+
}
|
|
61
|
+
} catch (e: Exception) {
|
|
62
|
+
promise.reject("INIT_ERROR", "Failed to initialize SDK EKYC: ${e.message}")
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@ReactMethod
|
|
67
|
+
fun startNfcScan(
|
|
68
|
+
appKey: String,
|
|
69
|
+
documentNumber: String,
|
|
70
|
+
birthDate: String,
|
|
71
|
+
expireDate: String,
|
|
72
|
+
transactionId: String?,
|
|
73
|
+
facePathStorage: String?,
|
|
74
|
+
promise: Promise
|
|
75
|
+
) {
|
|
76
|
+
try {
|
|
77
|
+
Log.d(TAG, "startNfcScan:::0000")
|
|
78
|
+
val currentActivity = reactApplicationContext.currentActivity
|
|
79
|
+
if (currentActivity == null) {
|
|
80
|
+
promise.reject("NO_ACTIVITY", "Activity not available")
|
|
81
|
+
return
|
|
82
|
+
}
|
|
83
|
+
Log.d(TAG, "startNfcScan:::1111")
|
|
84
|
+
val nfcConfig = NfcConfig(
|
|
85
|
+
documentNumber = documentNumber,
|
|
86
|
+
birthDate = birthDate,
|
|
87
|
+
expireDate = expireDate,
|
|
88
|
+
facePathStorage = facePathStorage ?: "",
|
|
89
|
+
transactionId = transactionId ?: ""
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
val ekycConfig =
|
|
93
|
+
EKYCConfigSDK(appKey = appKey, sdkType = SDKType.NFC, nfcConfig = nfcConfig)
|
|
94
|
+
|
|
95
|
+
SdkEkycNfc.startEkyc(
|
|
96
|
+
activity = currentActivity,
|
|
97
|
+
ekycConfigSDK = ekycConfig,
|
|
98
|
+
callbackSuccess = { event, data ->
|
|
99
|
+
Log.d(TAG, "NFC Success - Event: $event, Data: $data")
|
|
100
|
+
|
|
101
|
+
when (event) {
|
|
102
|
+
EKYCEvent.SCAN_NFC_START -> {
|
|
103
|
+
val eventMap =
|
|
104
|
+
Arguments.createMap().apply {
|
|
105
|
+
putString("event", event.name)
|
|
106
|
+
putString("data", data.toString())
|
|
107
|
+
}
|
|
108
|
+
sendEvent("onNfcScanStart", eventMap)
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
EKYCEvent.SCAN_NFC_SUCCESS -> {
|
|
112
|
+
val eventMap =
|
|
113
|
+
Arguments.createMap().apply {
|
|
114
|
+
putString("event", event.name)
|
|
115
|
+
putString("data", (data as SDKEkycResult).nfcResponse)
|
|
116
|
+
}
|
|
117
|
+
sendEvent("onNfcScanSuccess", eventMap)
|
|
118
|
+
val promiseMap =
|
|
119
|
+
Arguments.createMap().apply {
|
|
120
|
+
putString("event", event.name)
|
|
121
|
+
putString("data", (data as SDKEkycResult).nfcResponse)
|
|
122
|
+
}
|
|
123
|
+
promise.resolve(promiseMap)
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
else -> {
|
|
127
|
+
val eventMap =
|
|
128
|
+
Arguments.createMap().apply {
|
|
129
|
+
putString("event", event.name)
|
|
130
|
+
putString("data", data.toString())
|
|
131
|
+
}
|
|
132
|
+
sendEvent("onNfcEvent", eventMap)
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
callbackError = { event, message ->
|
|
137
|
+
Log.e(TAG, "NFC Error - Event: $event, Message: $message")
|
|
138
|
+
|
|
139
|
+
val errorMap =
|
|
140
|
+
Arguments.createMap().apply {
|
|
141
|
+
putString("event", event.name)
|
|
142
|
+
putString("message", message ?: "Unknown error")
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
sendEvent("onNfcError", errorMap)
|
|
146
|
+
promise.reject(event.name, message ?: "Unknown NFC error")
|
|
147
|
+
}
|
|
148
|
+
)
|
|
149
|
+
Log.d(TAG, "startNfcScan:::222222")
|
|
150
|
+
} catch (e: Exception) {
|
|
151
|
+
Log.e(TAG, "Exception in startNfcScan: ${e.message}", e)
|
|
152
|
+
promise.reject("NFC_EXCEPTION", e.message, e)
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
@ReactMethod
|
|
157
|
+
fun checkC06(
|
|
158
|
+
appKey: String,
|
|
159
|
+
sod: String,
|
|
160
|
+
idCardNumber: String,
|
|
161
|
+
recentLocation: String,
|
|
162
|
+
transactionId: String?,
|
|
163
|
+
promise: Promise
|
|
164
|
+
) {
|
|
165
|
+
try {
|
|
166
|
+
val c06Config =
|
|
167
|
+
C06Config(
|
|
168
|
+
transactionId = transactionId ?: "",
|
|
169
|
+
sod = sod,
|
|
170
|
+
idCardNumber = idCardNumber,
|
|
171
|
+
recentLocation = recentLocation
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
val ekycConfig = EKYCConfigSDK(appKey = appKey, c06Config = c06Config)
|
|
175
|
+
|
|
176
|
+
SdkEkycC06.startEkyc(
|
|
177
|
+
ekycConfigSDK = ekycConfig,
|
|
178
|
+
callbackSuccess = { event, data ->
|
|
179
|
+
Log.d(TAG, "C06 Success - Event: $event, Data: $data")
|
|
180
|
+
|
|
181
|
+
// Create separate maps for event and promise
|
|
182
|
+
val eventMap =
|
|
183
|
+
Arguments.createMap().apply {
|
|
184
|
+
putString("event", event.name)
|
|
185
|
+
putString("data", data.toString())
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
val promiseMap =
|
|
189
|
+
Arguments.createMap().apply {
|
|
190
|
+
putString("event", event.name)
|
|
191
|
+
putString("data", data.toString())
|
|
192
|
+
}
|
|
193
|
+
sendEvent("onC06Success", eventMap)
|
|
194
|
+
promise.resolve(promiseMap)
|
|
195
|
+
},
|
|
196
|
+
callbackError = { event, message ->
|
|
197
|
+
Log.e(TAG, "C06 Error - Event: $event, Message: $message")
|
|
198
|
+
|
|
199
|
+
val errorMap =
|
|
200
|
+
Arguments.createMap().apply {
|
|
201
|
+
putString("event", event.name)
|
|
202
|
+
putString("message", message ?: "Unknown error")
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
sendEvent("onC06Error", errorMap)
|
|
206
|
+
promise.reject(event.name, message ?: "Unknown C06 error")
|
|
207
|
+
}
|
|
208
|
+
)
|
|
209
|
+
} catch (e: Exception) {
|
|
210
|
+
Log.e(TAG, "Exception in checkC06: ${e.message}", e)
|
|
211
|
+
promise.reject("C06_EXCEPTION", e.message, e)
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
@ReactMethod
|
|
216
|
+
fun startOcr(
|
|
217
|
+
appKey: String,
|
|
218
|
+
idImage: String,
|
|
219
|
+
expectedDocumentSide: String,
|
|
220
|
+
transactionId: String,
|
|
221
|
+
promise: Promise
|
|
222
|
+
) {
|
|
223
|
+
try {
|
|
224
|
+
val currentActivity = reactApplicationContext.currentActivity
|
|
225
|
+
if (currentActivity == null) {
|
|
226
|
+
promise.reject("NO_ACTIVITY", "Activity not available")
|
|
227
|
+
return
|
|
228
|
+
}
|
|
229
|
+
val imageFile = File(idImage.replace("file://", ""))
|
|
230
|
+
if (!imageFile.exists()) {
|
|
231
|
+
promise.reject("FILE_NOT_FOUND", "Image file does not exist")
|
|
232
|
+
return
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
val ocrConfig =
|
|
236
|
+
OcrConfig(
|
|
237
|
+
idImage = imageFile,
|
|
238
|
+
expectedDocumentSide = expectedDocumentSide,
|
|
239
|
+
transactionId = transactionId
|
|
240
|
+
)
|
|
241
|
+
val ekycConfig =
|
|
242
|
+
EKYCConfigSDK(appKey = appKey, sdkType = SDKType.OCR, ocrConfig = ocrConfig)
|
|
243
|
+
SdkEkycOcr.startEkyc(
|
|
244
|
+
ekycConfigSDK = ekycConfig,
|
|
245
|
+
callbackSuccess = { event, data ->
|
|
246
|
+
Log.d(TAG, "OCR Success - Event: $event, Data: $data")
|
|
247
|
+
val resultMap =
|
|
248
|
+
Arguments.createMap().apply {
|
|
249
|
+
putString("event", event.name)
|
|
250
|
+
putString(
|
|
251
|
+
"data",
|
|
252
|
+
(data as SDKEkycResult).ocrResponse.toString()
|
|
253
|
+
)
|
|
254
|
+
}
|
|
255
|
+
sendEvent("onOcrSuccess", resultMap)
|
|
256
|
+
val promiseMap =
|
|
257
|
+
Arguments.createMap().apply {
|
|
258
|
+
putString("event", event.name)
|
|
259
|
+
putString(
|
|
260
|
+
"data",
|
|
261
|
+
(data as SDKEkycResult).ocrResponse.toString()
|
|
262
|
+
)
|
|
263
|
+
}
|
|
264
|
+
promise.resolve(promiseMap)
|
|
265
|
+
},
|
|
266
|
+
callbackError = { event, message ->
|
|
267
|
+
Log.e(TAG, "OCR Error - Event: $event, Message: $message")
|
|
268
|
+
val errorMap =
|
|
269
|
+
Arguments.createMap().apply {
|
|
270
|
+
putString("event", event.name)
|
|
271
|
+
putString("message", message ?: "Unknown error")
|
|
272
|
+
}
|
|
273
|
+
sendEvent("onOcrError", errorMap)
|
|
274
|
+
promise.reject(event.name, message ?: "Unknown OCR error")
|
|
275
|
+
}
|
|
276
|
+
)
|
|
277
|
+
} catch (e: Exception) {
|
|
278
|
+
Log.e(TAG, "Exception in startOcr: ${e.message}", e)
|
|
279
|
+
promise.reject("OCR_ERROR", e.message)
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
@ReactMethod
|
|
284
|
+
fun startLiveness(
|
|
285
|
+
appKey: String,
|
|
286
|
+
selfieImage: String,
|
|
287
|
+
usingRandomAction: Boolean,
|
|
288
|
+
transactionId: String,
|
|
289
|
+
isStraight: Boolean,
|
|
290
|
+
promise: Promise
|
|
291
|
+
) {
|
|
292
|
+
try {
|
|
293
|
+
val currentActivity = reactApplicationContext.currentActivity
|
|
294
|
+
if (currentActivity == null) {
|
|
295
|
+
promise.reject("NO_ACTIVITY", "Activity not available")
|
|
296
|
+
return
|
|
297
|
+
}
|
|
298
|
+
val imageFile = File(selfieImage.replace("file://", ""))
|
|
299
|
+
if (!imageFile.exists()) {
|
|
300
|
+
promise.reject("FILE_NOT_FOUND", "Image file does not exist")
|
|
301
|
+
return
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
val livenessConfig =
|
|
305
|
+
LivenessConfig(
|
|
306
|
+
selfieImage = imageFile,
|
|
307
|
+
usingRandomAction = usingRandomAction,
|
|
308
|
+
isStraight = isStraight,
|
|
309
|
+
transactionId = transactionId
|
|
310
|
+
)
|
|
311
|
+
val ekycConfig =
|
|
312
|
+
EKYCConfigSDK(
|
|
313
|
+
appKey = appKey,
|
|
314
|
+
sdkType = SDKType.LIVE_NESS,
|
|
315
|
+
livenessConfig = livenessConfig
|
|
316
|
+
)
|
|
317
|
+
SdkEkycLiveness.startEkyc(
|
|
318
|
+
ekycConfigSDK = ekycConfig,
|
|
319
|
+
callbackSuccess = { event, data ->
|
|
320
|
+
Log.d(TAG, "Liveness Success - Event: $event, Data: $data")
|
|
321
|
+
val resultMap =
|
|
322
|
+
Arguments.createMap().apply {
|
|
323
|
+
putString("event", event.name)
|
|
324
|
+
putString(
|
|
325
|
+
"data",
|
|
326
|
+
(data as SDKEkycResult).checkLivenessResponse.toString()
|
|
327
|
+
)
|
|
328
|
+
}
|
|
329
|
+
sendEvent("onLivenessSuccess", resultMap)
|
|
330
|
+
val promiseMap =
|
|
331
|
+
Arguments.createMap().apply {
|
|
332
|
+
putString("event", event.name)
|
|
333
|
+
putString(
|
|
334
|
+
"data",
|
|
335
|
+
(data as SDKEkycResult).checkLivenessResponse.toString()
|
|
336
|
+
)
|
|
337
|
+
}
|
|
338
|
+
promise.resolve(promiseMap)
|
|
339
|
+
},
|
|
340
|
+
callbackError = { event, message ->
|
|
341
|
+
Log.e(TAG, "Liveness Error - Event: $event, Message: $message")
|
|
342
|
+
val errorMap =
|
|
343
|
+
Arguments.createMap().apply {
|
|
344
|
+
putString("event", event.name)
|
|
345
|
+
putString("message", message ?: "Unknown error")
|
|
346
|
+
}
|
|
347
|
+
sendEvent("onLivenessError", errorMap)
|
|
348
|
+
promise.reject(event.name, message ?: "Unknown Liveness error")
|
|
349
|
+
}
|
|
350
|
+
)
|
|
351
|
+
} catch (e: Exception) {
|
|
352
|
+
Log.e(TAG, "Exception in startLiveness: ${e.message}", e)
|
|
353
|
+
promise.reject("LIVENESS_ERROR", e.message)
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
@ReactMethod
|
|
358
|
+
fun startFaceCompare(
|
|
359
|
+
appKey: String,
|
|
360
|
+
transactionId: String,
|
|
361
|
+
selfieImage: String,
|
|
362
|
+
idImage: String,
|
|
363
|
+
promise: Promise
|
|
364
|
+
) {
|
|
365
|
+
try {
|
|
366
|
+
val currentActivity = reactApplicationContext.currentActivity
|
|
367
|
+
if (currentActivity == null) {
|
|
368
|
+
promise.reject("NO_ACTIVITY", "Activity not available")
|
|
369
|
+
return
|
|
370
|
+
}
|
|
371
|
+
val imageFile = File(selfieImage.replace("file://", ""))
|
|
372
|
+
if (!imageFile.exists()) {
|
|
373
|
+
promise.reject("FILE_NOT_FOUND", "Image file does not exist")
|
|
374
|
+
return
|
|
375
|
+
}
|
|
376
|
+
val idImageFile = base64ToImageFile(idImage)
|
|
377
|
+
|
|
378
|
+
val faceServiceConfig =
|
|
379
|
+
FaceServiceConfig(
|
|
380
|
+
appKey = appKey,
|
|
381
|
+
transactionId = transactionId,
|
|
382
|
+
selfieImage = imageFile,
|
|
383
|
+
idImage = idImageFile
|
|
384
|
+
)
|
|
385
|
+
val ekycConfig = EKYCConfigSDK(faceServiceConfig = faceServiceConfig)
|
|
386
|
+
SdkEkycFaceService.startEkyc(
|
|
387
|
+
ekycConfigSDK = ekycConfig,
|
|
388
|
+
callbackSuccess = { event, data ->
|
|
389
|
+
Log.d(TAG, "Face Compare Success - Event: $event, Data: $data")
|
|
390
|
+
val resultMap =
|
|
391
|
+
Arguments.createMap().apply {
|
|
392
|
+
putString("event", event.name)
|
|
393
|
+
putString("data", data.toString())
|
|
394
|
+
}
|
|
395
|
+
sendEvent("onFaceCompareSuccess", resultMap)
|
|
396
|
+
val promiseMap =
|
|
397
|
+
Arguments.createMap().apply {
|
|
398
|
+
putString("event", event.name)
|
|
399
|
+
putString("data", data.toString())
|
|
400
|
+
}
|
|
401
|
+
promise.resolve(promiseMap)
|
|
402
|
+
},
|
|
403
|
+
callbackError = { event, message ->
|
|
404
|
+
Log.e(TAG, "FaceService Error - Event: $event, Message: $message")
|
|
405
|
+
val errorMap =
|
|
406
|
+
Arguments.createMap().apply {
|
|
407
|
+
putString("event", event.name)
|
|
408
|
+
putString("message", message ?: "Unknown error")
|
|
409
|
+
}
|
|
410
|
+
sendEvent("onFaceCompareError", errorMap)
|
|
411
|
+
promise.reject(event.name, message ?: "Unknown FaceService error")
|
|
412
|
+
}
|
|
413
|
+
)
|
|
414
|
+
} catch (e: Exception) {
|
|
415
|
+
Log.e(TAG, "Exception in startFaceCompare: ${e.message}", e)
|
|
416
|
+
promise.reject("FACE_COMPARE_ERROR", e.message)
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
@ReactMethod
|
|
421
|
+
fun onResume() {
|
|
422
|
+
reactApplicationContext.currentActivity?.let { activity ->
|
|
423
|
+
activity.runOnUiThread { SdkEkycNfc.onResumeNfc(activity) }
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
@ReactMethod
|
|
428
|
+
fun onPause() {
|
|
429
|
+
reactApplicationContext.currentActivity?.let { activity ->
|
|
430
|
+
activity.runOnUiThread { SdkEkycNfc.onPauseNfc(activity) }
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
@ReactMethod
|
|
435
|
+
fun handleNewIntent() {
|
|
436
|
+
reactApplicationContext.currentActivity?.let { activity ->
|
|
437
|
+
activity.runOnUiThread { SdkEkycNfc.onNewIntentNfc(activity.intent) }
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
private fun base64ToImageFile(base64Image: String): File {
|
|
442
|
+
try {
|
|
443
|
+
// Remove data URI prefix if present (like "data:image/png;base64,")
|
|
444
|
+
var processedBase64 = base64Image
|
|
445
|
+
if (base64Image.contains(",")) {
|
|
446
|
+
processedBase64 = base64Image.split(",")[1]
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
// Decode base64 string to bytes
|
|
450
|
+
val bytes = Base64.decode(processedBase64, Base64.DEFAULT)
|
|
451
|
+
|
|
452
|
+
// Create a unique filename with timestamp
|
|
453
|
+
val timestamp = Date().time.toString()
|
|
454
|
+
val fileName = "image_$timestamp.jpg"
|
|
455
|
+
|
|
456
|
+
// Get temporary directory and create file path
|
|
457
|
+
val directory = reactApplicationContext.cacheDir
|
|
458
|
+
val filePath = "${directory.path}/$fileName"
|
|
459
|
+
|
|
460
|
+
// Write bytes to file
|
|
461
|
+
val imageFile = File(filePath)
|
|
462
|
+
FileOutputStream(imageFile).use { it.write(bytes) }
|
|
463
|
+
|
|
464
|
+
return imageFile
|
|
465
|
+
} catch (e: Exception) {
|
|
466
|
+
Log.e("LivenessFragment", "Error converting base64 to image file: ${e.message}", e)
|
|
467
|
+
// In case of error, create an empty file to avoid null returns
|
|
468
|
+
val errorFile = File(reactApplicationContext.cacheDir, "error_image_${Date().time}.jpg")
|
|
469
|
+
errorFile.createNewFile()
|
|
470
|
+
return errorFile
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|