@hexar/biometric-identity-sdk-react-native 1.4.0 → 1.6.0

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 +1 @@
1
- {"version":3,"file":"ProfilePictureCapture.d.ts","sourceRoot":"","sources":["../../src/components/ProfilePictureCapture.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAWxE,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAmC,cAAc,EAAsB,MAAM,oCAAoC,CAAC;AAGzJ,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,0BAA0B;IACzC,UAAU,EAAE,CAAC,MAAM,EAAE,8BAA8B,KAAK,IAAI,CAAC;IAC7D,OAAO,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,QAAQ,CAAC,EAAE,iBAAiB,CAAC;CAC9B;AAED,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CA8UtE,CAAC;AAsEF,eAAe,qBAAqB,CAAC"}
1
+ {"version":3,"file":"ProfilePictureCapture.d.ts","sourceRoot":"","sources":["../../src/components/ProfilePictureCapture.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AAWxE,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAmC,cAAc,EAAsB,MAAM,oCAAoC,CAAC;AAGzJ,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,0BAA0B;IACzC,UAAU,EAAE,CAAC,MAAM,EAAE,8BAA8B,KAAK,IAAI,CAAC;IAC7D,OAAO,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,QAAQ,CAAC,EAAE,iBAAiB,CAAC;CAC9B;AAED,eAAO,MAAM,qBAAqB,EAAE,KAAK,CAAC,EAAE,CAAC,0BAA0B,CA8VtE,CAAC;AAsEF,eAAe,qBAAqB,CAAC"}
@@ -225,7 +225,25 @@ const ProfilePictureCapture = ({ onComplete, onError, onCancel, theme, language,
225
225
  }
226
226
  setIsValidating(false);
227
227
  if (error && typeof error === 'object' && 'code' in error) {
228
- onError(error);
228
+ const biometricErr = error;
229
+ // Sanitize codes that may carry internal technical detail — replace with friendly messages.
230
+ if (biometricErr.code === biometric_identity_sdk_core_1.BiometricErrorCode.CAMERA_NOT_AVAILABLE) {
231
+ onError({
232
+ name: 'BiometricError',
233
+ message: strings.errors.cameraNotAvailable,
234
+ code: biometricErr.code,
235
+ });
236
+ }
237
+ else if (biometricErr.code === biometric_identity_sdk_core_1.BiometricErrorCode.UNKNOWN_ERROR) {
238
+ onError({
239
+ name: 'BiometricError',
240
+ message: strings.errors.unknownError,
241
+ code: biometricErr.code,
242
+ });
243
+ }
244
+ else {
245
+ onError(biometricErr);
246
+ }
229
247
  return;
230
248
  }
231
249
  let errorCode = biometric_identity_sdk_core_1.BiometricErrorCode.UNKNOWN_ERROR;
@@ -47,25 +47,25 @@ const getDefaultChallenges = (strings) => [
47
47
  {
48
48
  action: 'look_left',
49
49
  instruction: strings.liveness.instructions.lookLeft || 'Slowly turn your head to the LEFT',
50
- duration_ms: 2500,
50
+ duration_ms: 2000,
51
51
  order: 1,
52
52
  },
53
53
  {
54
54
  action: 'look_right',
55
55
  instruction: strings.liveness.instructions.lookRight || 'Slowly turn your head to the RIGHT',
56
- duration_ms: 2500,
56
+ duration_ms: 2000,
57
57
  order: 2,
58
58
  },
59
59
  {
60
60
  action: 'blink',
61
61
  instruction: strings.liveness.instructions.blink || 'Blink your eyes naturally',
62
- duration_ms: 2000,
62
+ duration_ms: 1800,
63
63
  order: 3,
64
64
  },
65
65
  {
66
66
  action: 'smile',
67
67
  instruction: strings.liveness.instructions.smile || 'Smile',
68
- duration_ms: 2000,
68
+ duration_ms: 1800,
69
69
  order: 4,
70
70
  },
71
71
  ];
@@ -419,7 +419,7 @@ const VideoRecorder = ({ theme, language, duration, instructions, challenges: pr
419
419
  // Schedule next capture only after this one completes (serial chain).
420
420
  // Small delay lets the camera hardware reset between captures.
421
421
  if (isRecordingRef.current && framesRef.current.length < MAX_FRAMES) {
422
- frameCaptureInterval.current = setTimeout(captureNextFrame, 150);
422
+ frameCaptureInterval.current = setTimeout(captureNextFrame, 66);
423
423
  }
424
424
  };
425
425
  captureNextFrame();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hexar/biometric-identity-sdk-react-native",
3
- "version": "1.4.0",
3
+ "version": "1.6.0",
4
4
  "description": "React Native wrapper for Biometric Identity SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -11,7 +11,7 @@
11
11
  "clean": "rm -rf dist"
12
12
  },
13
13
  "peerDependencies": {
14
- "@hexar/biometric-identity-sdk-core": ">=1.3.0",
14
+ "@hexar/biometric-identity-sdk-core": ">=1.4.0",
15
15
  "react": ">=18.0.0",
16
16
  "react-native": ">=0.70.0",
17
17
  "react-native-permissions": ">=4.0.0",
@@ -246,7 +246,23 @@ export const ProfilePictureCapture: React.FC<ProfilePictureCaptureProps> = ({
246
246
  setIsValidating(false);
247
247
 
248
248
  if (error && typeof error === 'object' && 'code' in error) {
249
- onError(error as BiometricError);
249
+ const biometricErr = error as BiometricError;
250
+ // Sanitize codes that may carry internal technical detail — replace with friendly messages.
251
+ if (biometricErr.code === BiometricErrorCode.CAMERA_NOT_AVAILABLE) {
252
+ onError({
253
+ name: 'BiometricError',
254
+ message: strings.errors.cameraNotAvailable,
255
+ code: biometricErr.code,
256
+ } as BiometricError);
257
+ } else if (biometricErr.code === BiometricErrorCode.UNKNOWN_ERROR) {
258
+ onError({
259
+ name: 'BiometricError',
260
+ message: strings.errors.unknownError,
261
+ code: biometricErr.code,
262
+ } as BiometricError);
263
+ } else {
264
+ onError(biometricErr);
265
+ }
250
266
  return;
251
267
  }
252
268
 
@@ -60,25 +60,25 @@ const getDefaultChallenges = (strings: any): ChallengeAction[] => [
60
60
  {
61
61
  action: 'look_left',
62
62
  instruction: strings.liveness.instructions.lookLeft || 'Slowly turn your head to the LEFT',
63
- duration_ms: 2500,
63
+ duration_ms: 2000,
64
64
  order: 1,
65
65
  },
66
66
  {
67
67
  action: 'look_right',
68
68
  instruction: strings.liveness.instructions.lookRight || 'Slowly turn your head to the RIGHT',
69
- duration_ms: 2500,
69
+ duration_ms: 2000,
70
70
  order: 2,
71
71
  },
72
72
  {
73
73
  action: 'blink',
74
74
  instruction: strings.liveness.instructions.blink || 'Blink your eyes naturally',
75
- duration_ms: 2000,
75
+ duration_ms: 1800,
76
76
  order: 3,
77
77
  },
78
78
  {
79
79
  action: 'smile',
80
80
  instruction: strings.liveness.instructions.smile || 'Smile',
81
- duration_ms: 2000,
81
+ duration_ms: 1800,
82
82
  order: 4,
83
83
  },
84
84
  ];
@@ -489,7 +489,7 @@ export const VideoRecorder: React.FC<VideoRecorderProps> = ({
489
489
  // Schedule next capture only after this one completes (serial chain).
490
490
  // Small delay lets the camera hardware reset between captures.
491
491
  if (isRecordingRef.current && framesRef.current.length < MAX_FRAMES) {
492
- frameCaptureInterval.current = setTimeout(captureNextFrame, 150);
492
+ frameCaptureInterval.current = setTimeout(captureNextFrame, 66);
493
493
  }
494
494
  };
495
495