@hexar/biometric-identity-sdk-react-native 1.4.0 → 1.5.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;
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.5.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