@hexar/biometric-identity-sdk-react-native 1.1.2 → 1.1.3

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;AASxE,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,CAwKtE,CAAC;AAuCF,eAAe,qBAAqB,CAAC"}
1
+ {"version":3,"file":"ProfilePictureCapture.d.ts","sourceRoot":"","sources":["../../src/components/ProfilePictureCapture.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAC;AASxE,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,CAsLtE,CAAC;AAuCF,eAAe,qBAAqB,CAAC"}
@@ -40,7 +40,7 @@ const VideoRecorder_1 = require("./VideoRecorder");
40
40
  const biometric_identity_sdk_core_1 = require("@hexar/biometric-identity-sdk-core");
41
41
  const useBiometricSDK_1 = require("../hooks/useBiometricSDK");
42
42
  const ProfilePictureCapture = ({ onComplete, onError, onCancel, theme, language, }) => {
43
- const { sdk, isInitialized, isUsingBackend, } = (0, useBiometricSDK_1.useBiometricSDK)();
43
+ const { sdk, isInitialized, isUsingBackend, sessionId, } = (0, useBiometricSDK_1.useBiometricSDK)();
44
44
  const [isValidating, setIsValidating] = (0, react_1.useState)(false);
45
45
  const [validationError, setValidationError] = (0, react_1.useState)(null);
46
46
  (0, react_1.useEffect)(() => {
@@ -59,9 +59,20 @@ const ProfilePictureCapture = ({ onComplete, onError, onCancel, theme, language,
59
59
  biometric_identity_sdk_core_1.logger.error('Backend not available - SDK not configured with backend');
60
60
  throw new Error('NETWORK_ERROR');
61
61
  }
62
- const sessionId = videoResult.sessionId;
62
+ let sessionId = videoResult.sessionId || sdk.getSessionId();
63
63
  if (!sessionId) {
64
- biometric_identity_sdk_core_1.logger.error('Session ID not available');
64
+ biometric_identity_sdk_core_1.logger.info('No session ID available, generating challenge to create one');
65
+ try {
66
+ const challengeResponse = await sdk.generateLivenessChallenge('active');
67
+ sessionId = challengeResponse.session_id;
68
+ biometric_identity_sdk_core_1.logger.info('Session ID generated', { sessionId });
69
+ }
70
+ catch (challengeError) {
71
+ biometric_identity_sdk_core_1.logger.error('Failed to generate challenge for session ID', challengeError);
72
+ }
73
+ }
74
+ if (!sessionId) {
75
+ biometric_identity_sdk_core_1.logger.error('Session ID not available after attempting to generate');
65
76
  throw new Error('VALIDATION_ERROR');
66
77
  }
67
78
  biometric_identity_sdk_core_1.logger.info('Validating profile picture with backend', {
@@ -71,7 +82,7 @@ const ProfilePictureCapture = ({ onComplete, onError, onCancel, theme, language,
71
82
  isUsingBackend,
72
83
  });
73
84
  const result = await sdk.validateProfilePicture({
74
- sessionId,
85
+ sessionId: sessionId,
75
86
  videoFrames: videoResult.frames,
76
87
  videoDurationMs: videoResult.duration,
77
88
  challengesCompleted: videoResult.challengesCompleted || [],
@@ -153,7 +164,7 @@ const ProfilePictureCapture = ({ onComplete, onError, onCancel, theme, language,
153
164
  react_1.default.createElement(react_native_1.Text, { style: [styles.errorTitle, { color: theme?.errorColor || '#EF4444' }] }, strings.errors.unknownError || strings.validation.title || 'Error'),
154
165
  react_1.default.createElement(react_native_1.Text, { style: [styles.errorText, { color: theme?.textColor || '#1e1b4b' }] }, validationError))));
155
166
  }
156
- return (react_1.default.createElement(VideoRecorder_1.VideoRecorder, { theme: theme, language: language, duration: 8000, smartMode: true, onComplete: handleVideoComplete, onCancel: handleVideoCancel }));
167
+ return (react_1.default.createElement(VideoRecorder_1.VideoRecorder, { theme: theme, language: language, duration: 8000, smartMode: true, sessionId: sdk.getSessionId() || undefined, onComplete: handleVideoComplete, onCancel: handleVideoCancel }));
157
168
  };
158
169
  exports.ProfilePictureCapture = ProfilePictureCapture;
159
170
  const styles = react_native_1.StyleSheet.create({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hexar/biometric-identity-sdk-react-native",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "React Native wrapper for Biometric Identity SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -37,6 +37,7 @@ export const ProfilePictureCapture: React.FC<ProfilePictureCaptureProps> = ({
37
37
  sdk,
38
38
  isInitialized,
39
39
  isUsingBackend,
40
+ sessionId,
40
41
  } = useBiometricSDK();
41
42
 
42
43
  const [isValidating, setIsValidating] = useState(false);
@@ -62,9 +63,21 @@ export const ProfilePictureCapture: React.FC<ProfilePictureCaptureProps> = ({
62
63
  throw new Error('NETWORK_ERROR');
63
64
  }
64
65
 
65
- const sessionId = videoResult.sessionId;
66
+ let sessionId = videoResult.sessionId || sdk.getSessionId();
67
+
66
68
  if (!sessionId) {
67
- logger.error('Session ID not available');
69
+ logger.info('No session ID available, generating challenge to create one');
70
+ try {
71
+ const challengeResponse = await sdk.generateLivenessChallenge('active');
72
+ sessionId = challengeResponse.session_id;
73
+ logger.info('Session ID generated', { sessionId });
74
+ } catch (challengeError) {
75
+ logger.error('Failed to generate challenge for session ID', challengeError);
76
+ }
77
+ }
78
+
79
+ if (!sessionId) {
80
+ logger.error('Session ID not available after attempting to generate');
68
81
  throw new Error('VALIDATION_ERROR');
69
82
  }
70
83
 
@@ -76,7 +89,7 @@ export const ProfilePictureCapture: React.FC<ProfilePictureCaptureProps> = ({
76
89
  });
77
90
 
78
91
  const result = await (sdk as any).validateProfilePicture({
79
- sessionId,
92
+ sessionId: sessionId!,
80
93
  videoFrames: videoResult.frames,
81
94
  videoDurationMs: videoResult.duration,
82
95
  challengesCompleted: videoResult.challengesCompleted || [],
@@ -190,6 +203,7 @@ export const ProfilePictureCapture: React.FC<ProfilePictureCaptureProps> = ({
190
203
  language={language}
191
204
  duration={8000}
192
205
  smartMode={true}
206
+ sessionId={sdk.getSessionId() || undefined}
193
207
  onComplete={handleVideoComplete}
194
208
  onCancel={handleVideoCancel}
195
209
  />