@onairos/react-native 3.0.75 → 3.1.1

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.
Files changed (43) hide show
  1. package/lib/commonjs/components/EmailVerificationModal.js +7 -5
  2. package/lib/commonjs/components/EmailVerificationModal.js.map +1 -1
  3. package/lib/commonjs/index.js +18 -6
  4. package/lib/commonjs/index.js.map +1 -1
  5. package/lib/commonjs/services/apiKeyService.js +401 -27
  6. package/lib/commonjs/services/apiKeyService.js.map +1 -1
  7. package/lib/commonjs/services/platformAuthService.js +130 -299
  8. package/lib/commonjs/services/platformAuthService.js.map +1 -1
  9. package/lib/commonjs/utils/onairosApi.js +151 -71
  10. package/lib/commonjs/utils/onairosApi.js.map +1 -1
  11. package/lib/commonjs/utils/secureStorage.js +123 -1
  12. package/lib/commonjs/utils/secureStorage.js.map +1 -1
  13. package/lib/module/components/EmailVerificationModal.js +7 -5
  14. package/lib/module/components/EmailVerificationModal.js.map +1 -1
  15. package/lib/module/index.js +4 -2
  16. package/lib/module/index.js.map +1 -1
  17. package/lib/module/services/apiKeyService.js +384 -22
  18. package/lib/module/services/apiKeyService.js.map +1 -1
  19. package/lib/module/services/platformAuthService.js +127 -295
  20. package/lib/module/services/platformAuthService.js.map +1 -1
  21. package/lib/module/utils/onairosApi.js +147 -70
  22. package/lib/module/utils/onairosApi.js.map +1 -1
  23. package/lib/module/utils/secureStorage.js +116 -0
  24. package/lib/module/utils/secureStorage.js.map +1 -1
  25. package/lib/typescript/components/EmailVerificationModal.d.ts.map +1 -1
  26. package/lib/typescript/index.d.ts +2 -2
  27. package/lib/typescript/index.d.ts.map +1 -1
  28. package/lib/typescript/services/apiKeyService.d.ts +68 -2
  29. package/lib/typescript/services/apiKeyService.d.ts.map +1 -1
  30. package/lib/typescript/services/platformAuthService.d.ts +29 -14
  31. package/lib/typescript/services/platformAuthService.d.ts.map +1 -1
  32. package/lib/typescript/utils/onairosApi.d.ts +25 -10
  33. package/lib/typescript/utils/onairosApi.d.ts.map +1 -1
  34. package/lib/typescript/utils/secureStorage.d.ts +31 -0
  35. package/lib/typescript/utils/secureStorage.d.ts.map +1 -1
  36. package/package.json +1 -1
  37. package/src/components/EmailVerificationModal.tsx +9 -5
  38. package/src/index.ts +4 -1
  39. package/src/services/apiKeyService.ts +412 -18
  40. package/src/services/platformAuthService.ts +219 -421
  41. package/src/types/index.d.ts +11 -5
  42. package/src/utils/onairosApi.ts +162 -74
  43. package/src/utils/secureStorage.ts +122 -0
@@ -1,67 +1,33 @@
1
1
  import AsyncStorage from '@react-native-async-storage/async-storage';
2
- import { makeAuthenticatedRequest } from './apiKeyService';
2
+ import { makeDeveloperRequest, getApiConfig, storeJWT, extractUsernameFromJWT } from './apiKeyService';
3
3
 
4
- // 🔑 CRITICAL: Initialize API key service for authentication
5
- let isApiKeyInitialized = false;
4
+ // 🔑 CRITICAL: Use two-tier authentication system
5
+ // - Developer API key for email verification requests
6
+ // - JWT tokens for user-authenticated requests after email verification
6
7
 
7
8
  /**
8
- * Initialize the API key service with the admin key for testing
9
- * This ensures all API requests include proper authentication headers
9
+ * Initialize the platform auth service
10
+ * This service now uses the two-tier authentication system
10
11
  */
11
12
  export const initializePlatformAuthService = async () => {
12
- if (isApiKeyInitialized) {
13
- console.log('🔑 API key service already initialized');
14
- return;
15
- }
16
13
  try {
17
- // Import the initialization function
18
- const {
19
- initializeApiKey,
20
- ADMIN_API_KEY,
21
- getApiConfig
22
- } = await import('./apiKeyService');
23
-
24
- // Check if there's already an app initialization
14
+ // Check if app is already initialized with API key
25
15
  const existingConfig = getApiConfig();
26
16
  if (existingConfig && existingConfig.apiKey) {
27
- console.log('🔑 App already initialized with API key, using existing configuration');
28
- // Use the existing app's configuration instead of overriding
29
- isApiKeyInitialized = true;
30
- console.log(`✅ Platform auth service using existing app configuration (${existingConfig.environment})`);
17
+ console.log('🔑 Platform auth service using existing app configuration');
18
+ console.log(`✅ Environment: ${existingConfig.environment}`);
31
19
  return;
32
20
  }
33
21
 
34
- // Only initialize with admin key if no app initialization exists
35
- const environment = __DEV__ ? 'development' : 'production';
36
- console.log('🔑 No app initialization found, initializing platform auth service with admin key');
37
- console.log('🔑 Environment:', environment);
38
-
39
- // Initialize with admin key as fallback
40
- await initializeApiKey({
41
- apiKey: ADMIN_API_KEY,
42
- // 'OnairosIsAUnicorn2025'
43
- environment: environment,
44
- enableLogging: true,
45
- timeout: 30000
46
- });
47
- isApiKeyInitialized = true;
48
- console.log(`✅ Platform auth service initialized with admin key (${environment})`);
22
+ // If no app initialization, we can't proceed
23
+ console.error('❌ Platform auth service requires app-level API key initialization');
24
+ throw new Error('Platform auth service requires app-level API key initialization. Please call initializeApiKey() first.');
49
25
  } catch (error) {
50
26
  console.error('❌ Failed to initialize platform auth service:', error);
51
27
  throw error;
52
28
  }
53
29
  };
54
30
 
55
- /**
56
- * Ensure API key is initialized before making authenticated requests
57
- */
58
- const ensureApiKeyInitialized = async () => {
59
- if (!isApiKeyInitialized) {
60
- console.log('🔑 API key not initialized, initializing now...');
61
- await initializePlatformAuthService();
62
- }
63
- };
64
-
65
31
  // Configuration for each platform's authentication
66
32
  let PLATFORM_AUTH_CONFIG = {
67
33
  instagram: {
@@ -169,7 +135,7 @@ export const initiateOAuth = async (platform, username, appName) => {
169
135
  }
170
136
  };
171
137
  console.log('📤 Sending Instagram OAuth request:', jsonData);
172
- const response = await makeAuthenticatedRequest(PLATFORM_AUTH_CONFIG[platform].authEndpoint, {
138
+ const response = await makeDeveloperRequest(PLATFORM_AUTH_CONFIG[platform].authEndpoint, {
173
139
  method: 'POST',
174
140
  body: JSON.stringify(jsonData)
175
141
  });
@@ -207,7 +173,7 @@ export const initiateOAuth = async (platform, username, appName) => {
207
173
  console.log(`📤 Sending ${platform} OAuth request:`, jsonData);
208
174
 
209
175
  // Make the authenticated request to get the OAuth URL
210
- const response = await makeAuthenticatedRequest(PLATFORM_AUTH_CONFIG[platform].authEndpoint, {
176
+ const response = await makeDeveloperRequest(PLATFORM_AUTH_CONFIG[platform].authEndpoint, {
211
177
  method: 'POST',
212
178
  body: JSON.stringify(jsonData)
213
179
  });
@@ -808,355 +774,221 @@ export const updateGoogleClientIds = config => {
808
774
  };
809
775
 
810
776
  /**
811
- * 📧 EMAIL VERIFICATION FUNCTIONS
812
- * Using the correct Onairos email verification endpoints
777
+ * Request email verification using developer API key
778
+ * @param email Email address to verify
779
+ * @param testMode Whether to use test mode
780
+ * @returns Promise with verification result
813
781
  */
814
782
  export const requestEmailVerification = async (email, testMode = false) => {
815
783
  try {
816
784
  console.log('📧 Requesting email verification for:', email);
817
- console.log('🧪 Test mode:', testMode);
818
- if (!email || !email.includes('@')) {
819
- return {
820
- success: false,
821
- error: 'Valid email address is required'
822
- };
823
- }
824
-
825
- // In test mode, always return success with mock request ID
826
- if (testMode) {
827
- console.log('🧪 Test mode: Always returning success with mock request ID');
828
- const mockRequestId = 'test-request-' + Date.now();
829
-
830
- // Store request info for tracking
831
- await AsyncStorage.setItem('email_verification_request_id', mockRequestId);
832
- await AsyncStorage.setItem('email_verification_request_email', email);
785
+ const response = await makeDeveloperRequest('/email/verification', {
786
+ method: 'POST',
787
+ body: JSON.stringify({
788
+ email,
789
+ action: 'request',
790
+ testMode
791
+ })
792
+ });
793
+ const data = await response.json();
794
+ if (response.ok && data.success) {
795
+ console.log(' Email verification requested successfully');
833
796
  return {
834
797
  success: true,
835
- message: 'Email verification sent successfully (test mode)',
836
- requestId: mockRequestId
798
+ message: data.message || 'Verification code sent to your email'
837
799
  };
838
- }
839
-
840
- // Production mode: Make real API call with API key authentication
841
- try {
842
- // 🔑 Ensure API key is initialized before making authenticated requests
843
- await ensureApiKeyInitialized();
844
- const response = await makeAuthenticatedRequest('/email/verification', {
845
- method: 'POST',
846
- body: JSON.stringify({
847
- email,
848
- action: 'request'
849
- })
850
- });
851
- const result = await response.json();
852
- console.log('📡 Email verification API response:', result);
853
- if (response.ok && result.success) {
854
- console.log('✅ Email verification request sent');
855
-
856
- // Store request info for tracking
857
- const requestId = result.requestId || result.id || 'req-' + Date.now();
858
- await AsyncStorage.setItem('email_verification_request_id', requestId);
859
- await AsyncStorage.setItem('email_verification_request_email', email);
860
- return {
861
- success: true,
862
- message: result.message || 'Email verification sent successfully',
863
- requestId: requestId
864
- };
865
- } else {
866
- console.error('❌ Email verification request failed:', result.error);
867
- return {
868
- success: false,
869
- error: result.error || 'Failed to send verification email'
870
- };
871
- }
872
- } catch (apiError) {
873
- console.error('❌ Email verification API call failed:', apiError);
800
+ } else {
801
+ console.error('❌ Email verification request failed:', data.error);
874
802
  return {
875
803
  success: false,
876
- error: 'Network error while sending verification email'
804
+ error: data.error || 'Failed to send verification code'
877
805
  };
878
806
  }
879
807
  } catch (error) {
880
- console.error('❌ Email verification request error:', error);
808
+ console.error('❌ Error requesting email verification:', error);
881
809
  return {
882
810
  success: false,
883
- error: error instanceof Error ? error.message : 'Unknown error'
811
+ error: error instanceof Error ? error.message : 'Network error'
884
812
  };
885
813
  }
886
814
  };
815
+
816
+ /**
817
+ * Verify email code and store JWT token
818
+ * @param email Email address
819
+ * @param code Verification code
820
+ * @param testMode Whether to use test mode
821
+ * @returns Promise with verification result and JWT token
822
+ */
887
823
  export const verifyEmailCode = async (email, code, testMode = false) => {
888
824
  try {
889
825
  console.log('🔍 Verifying email code for:', email);
890
- console.log('🔑 Code length:', code.length);
891
- console.log('🧪 Test mode:', testMode);
892
- if (!email || !email.includes('@')) {
893
- return {
894
- success: false,
895
- error: 'Valid email address is required'
896
- };
897
- }
898
- if (!code || code.length < 4) {
899
- return {
900
- success: false,
901
- error: 'Valid verification code is required'
902
- };
903
- }
904
-
905
- // In test mode, always return success with mock JWT token
906
- if (testMode) {
907
- console.log('🧪 Test mode: Always returning success with mock JWT token');
908
- const mockToken = 'test-jwt-token-' + Date.now();
909
-
910
- // Store mock token for API requests
911
- await AsyncStorage.setItem('email_verification_token', mockToken);
912
- await AsyncStorage.setItem('onairos_jwt_token', mockToken);
913
- await AsyncStorage.setItem('email_verification_email', email);
826
+ const response = await makeDeveloperRequest('/email/verification', {
827
+ method: 'POST',
828
+ body: JSON.stringify({
829
+ email,
830
+ action: 'verify',
831
+ code,
832
+ testMode
833
+ })
834
+ });
835
+ const data = await response.json();
836
+ if (response.ok && data.success) {
837
+ console.log(' Email verification successful');
838
+
839
+ // Store JWT token if received
840
+ if (data.token || data.jwtToken) {
841
+ const jwtToken = data.token || data.jwtToken;
842
+ await storeJWT(jwtToken);
843
+ console.log('🎫 JWT token stored successfully');
844
+ }
914
845
  return {
915
846
  success: true,
916
- message: 'Email verification successful (test mode)',
917
- existingUser: false,
918
- jwtToken: mockToken
847
+ message: data.message || 'Email verified successfully',
848
+ existingUser: data.existingUser || false,
849
+ token: data.token || data.jwtToken
919
850
  };
920
- }
921
-
922
- // Production mode: Make real API call with API key authentication
923
- try {
924
- // 🔑 Ensure API key is initialized before making authenticated requests
925
- await ensureApiKeyInitialized();
926
- const response = await makeAuthenticatedRequest('/email/verification', {
927
- method: 'POST',
928
- body: JSON.stringify({
929
- email,
930
- code,
931
- action: 'verify'
932
- })
933
- });
934
- const result = await response.json();
935
- console.log('📡 Email verification API response:', result);
936
- if (response.ok && result.success) {
937
- console.log('✅ Email verification successful');
938
-
939
- // 🎫 CRITICAL: Store JWT token from email verification response
940
- const jwtToken = result.token || result.jwtToken || result.jwt || result.authToken;
941
- if (jwtToken) {
942
- console.log('🎫 Storing JWT token from email verification response');
943
- await AsyncStorage.setItem('email_verification_token', jwtToken);
944
- await AsyncStorage.setItem('onairos_jwt_token', jwtToken);
945
- await AsyncStorage.setItem('enoch_token', jwtToken);
946
- await AsyncStorage.setItem('auth_token', jwtToken);
947
- await AsyncStorage.setItem('email_verification_email', email);
948
- await AsyncStorage.setItem('token_timestamp', Date.now().toString());
949
- } else {
950
- console.warn('⚠️ No JWT token received from email verification API');
951
- }
952
- return {
953
- success: true,
954
- message: result.message || 'Email verification successful',
955
- existingUser: result.existingUser || false,
956
- jwtToken: jwtToken
957
- };
958
- } else {
959
- console.error('❌ Email verification failed:', result.error);
960
- return {
961
- success: false,
962
- error: result.error || 'Email verification failed'
963
- };
964
- }
965
- } catch (apiError) {
966
- console.error('❌ Email verification API call failed:', apiError);
851
+ } else {
852
+ console.error('❌ Email verification failed:', data.error);
967
853
  return {
968
854
  success: false,
969
- error: 'Network error during email verification'
855
+ error: data.error || 'Invalid verification code'
970
856
  };
971
857
  }
972
858
  } catch (error) {
973
- console.error('❌ Email verification error:', error);
859
+ console.error('❌ Error verifying email code:', error);
974
860
  return {
975
861
  success: false,
976
- error: error instanceof Error ? error.message : 'Unknown error'
862
+ error: error instanceof Error ? error.message : 'Network error'
977
863
  };
978
864
  }
979
865
  };
866
+
867
+ /**
868
+ * Check email verification status
869
+ * @param email Email address
870
+ * @param testMode Whether to use test mode
871
+ * @returns Promise with status result
872
+ */
980
873
  export const checkEmailVerificationStatus = async (email, testMode = false) => {
981
874
  try {
982
875
  console.log('🔍 Checking email verification status for:', email);
983
- console.log('🔍 Test mode:', testMode);
984
-
985
- // In test mode, always return no pending verification
986
- if (testMode) {
987
- console.log('🧪 Test mode: Always returning no pending verification');
876
+ const response = await makeDeveloperRequest('/email/verification/status', {
877
+ method: 'POST',
878
+ body: JSON.stringify({
879
+ email,
880
+ testMode
881
+ })
882
+ });
883
+ const data = await response.json();
884
+ if (response.ok && data.success) {
988
885
  return {
989
886
  success: true,
990
- isPending: false,
991
- message: 'Status retrieved successfully (test mode)'
887
+ isPending: data.isPending || false
992
888
  };
993
- }
994
-
995
- // Production mode: Make real API call with API key authentication
996
- try {
997
- // 🔑 Ensure API key is initialized before making authenticated requests
998
- await ensureApiKeyInitialized();
999
- const response = await makeAuthenticatedRequest(`/email/verify/status/${encodeURIComponent(email)}`, {
1000
- method: 'GET'
1001
- });
1002
- const result = await response.json();
1003
- console.log('📡 Email verification status API response:', result);
1004
- if (response.ok && result.success) {
1005
- console.log('✅ Email verification status retrieved');
1006
- return {
1007
- success: true,
1008
- isPending: result.isPending || false,
1009
- message: result.message || 'Status retrieved successfully'
1010
- };
1011
- } else {
1012
- console.error('❌ Email verification status failed:', result.error);
1013
- return {
1014
- success: false,
1015
- error: result.error || 'Failed to check verification status'
1016
- };
1017
- }
1018
- } catch (apiError) {
1019
- console.error('❌ Email verification status API call failed:', apiError);
889
+ } else {
1020
890
  return {
1021
891
  success: false,
1022
- error: 'Network error while checking status'
892
+ error: data.error || 'Failed to check verification status'
1023
893
  };
1024
894
  }
1025
895
  } catch (error) {
1026
- console.error('❌ Email verification status error:', error);
896
+ console.error('❌ Error checking email verification status:', error);
1027
897
  return {
1028
898
  success: false,
1029
- error: error instanceof Error ? error.message : 'Unknown error'
899
+ error: error instanceof Error ? error.message : 'Network error'
1030
900
  };
1031
901
  }
1032
902
  };
1033
903
 
1034
904
  /**
1035
- * 🔌 UNIVERSAL PLATFORM DISCONNECTION
1036
- * Backend confirmed this endpoint is fully implemented
905
+ * Disconnect a platform (uses developer API key)
906
+ * @param platform Platform to disconnect
907
+ * @param username Username associated with the platform
908
+ * @returns Promise with disconnect result
1037
909
  */
1038
910
  export const disconnectPlatform = async (platform, username) => {
1039
911
  try {
1040
912
  console.log('🔌 Disconnecting platform:', platform, 'for user:', username);
1041
- if (!platform || !username) {
1042
- return {
1043
- success: false,
1044
- error: 'Platform and username are required'
1045
- };
1046
- }
1047
913
 
1048
914
  // Make authenticated API call to disconnect platform
1049
- const response = await makeAuthenticatedRequest('/revoke', {
915
+ const response = await makeDeveloperRequest('/revoke', {
1050
916
  method: 'POST',
1051
917
  body: JSON.stringify({
1052
918
  platform,
1053
919
  username
1054
920
  })
1055
921
  });
1056
- const result = await response.json();
1057
- console.log('📡 Platform disconnect API response:', result);
1058
- if (response.ok && result.success) {
1059
- console.log('✅ Platform disconnected successfully');
922
+ const data = await response.json();
923
+ if (response.ok && data.success) {
924
+ console.log(`✅ ${platform} disconnected successfully`);
1060
925
  return {
1061
- success: true,
1062
- message: result.message || 'Platform disconnected successfully'
926
+ success: true
1063
927
  };
1064
928
  } else {
1065
- console.error('❌ Platform disconnect failed:', result.error);
929
+ console.error(`❌ Failed to disconnect ${platform}:`, data.error);
1066
930
  return {
1067
931
  success: false,
1068
- error: result.error || 'Failed to disconnect platform'
932
+ error: data.error || 'Failed to disconnect platform'
1069
933
  };
1070
934
  }
1071
935
  } catch (error) {
1072
- console.error('❌ Platform disconnect error:', error);
936
+ console.error(`❌ Error disconnecting ${platform}:`, error);
1073
937
  return {
1074
938
  success: false,
1075
- error: error instanceof Error ? error.message : 'Platform disconnect failed'
939
+ error: error instanceof Error ? error.message : 'Network error'
1076
940
  };
1077
941
  }
1078
942
  };
1079
943
 
1080
944
  /**
1081
- * 🔐 STORE PIN AFTER BIOMETRIC AUTHENTICATION
1082
- * Send PIN separately to /store-pin/web endpoint after biometric Face ID verification
945
+ * Store PIN for user (uses JWT authentication and extracts username from JWT)
946
+ * @param pin User PIN
947
+ * @param username Optional username (if not provided, extracts from JWT)
948
+ * @returns Promise with result
1083
949
  */
1084
- export const storePinAfterBiometric = async (username, pin, jwtToken) => {
950
+ export const storePIN = async (pin, username) => {
1085
951
  try {
1086
- console.log('🔐 Storing PIN after biometric authentication for user:', username);
1087
- console.log('🔑 PIN length:', pin.length);
1088
- console.log('🎫 JWT token provided:', !!jwtToken);
1089
- if (!username || !pin) {
1090
- return {
1091
- success: false,
1092
- error: 'Username and PIN are required'
1093
- };
1094
- }
1095
- if (pin.length < 4) {
952
+ // Extract username from JWT if not provided
953
+ const userToStore = username || extractUsernameFromJWT();
954
+ if (!userToStore) {
955
+ console.error('❌ No username available - either provide username or ensure JWT token is valid');
1096
956
  return {
1097
957
  success: false,
1098
- error: 'PIN must be at least 4 digits'
958
+ error: 'No username available for PIN storage'
1099
959
  };
1100
960
  }
961
+ console.log('🔐 Storing PIN for user:', userToStore);
1101
962
 
1102
- // Get JWT token from storage if not provided
1103
- let authToken = jwtToken;
1104
- if (!authToken) {
1105
- authToken = (await AsyncStorage.getItem('onairos_jwt_token')) || (await AsyncStorage.getItem('enoch_token')) || (await AsyncStorage.getItem('auth_token')) || (await AsyncStorage.getItem('email_verification_token'));
1106
- }
1107
- if (!authToken) {
1108
- console.warn('⚠️ No JWT token available for PIN storage');
1109
- return {
1110
- success: false,
1111
- error: 'No authentication token available'
1112
- };
1113
- }
1114
- console.log('📤 Sending PIN to /store-pin/web endpoint');
1115
-
1116
- // Make authenticated request to store PIN
1117
- const response = await makeAuthenticatedRequest('/store-pin/web', {
963
+ // Make authenticated request to store PIN (using developer API key for now)
964
+ const response = await makeDeveloperRequest('/store-pin/web', {
1118
965
  method: 'POST',
1119
966
  headers: {
1120
- 'Authorization': `Bearer ${authToken}`
967
+ 'Content-Type': 'application/json'
1121
968
  },
1122
969
  body: JSON.stringify({
1123
- username,
970
+ username: userToStore,
1124
971
  pin
1125
972
  })
1126
973
  });
1127
- console.log('📡 PIN storage response status:', response.status);
1128
- if (!response.ok) {
1129
- const errorText = await response.text();
1130
- console.error('❌ PIN storage failed:', errorText);
1131
- return {
1132
- success: false,
1133
- error: `PIN storage failed: ${response.status} - ${errorText}`
1134
- };
1135
- }
1136
- const result = await response.json();
1137
- console.log('📥 PIN storage response:', result);
1138
- if (result.success) {
1139
- console.log('✅ PIN stored successfully after biometric authentication');
1140
-
1141
- // Store PIN locally for future use
1142
- await AsyncStorage.setItem('user_pin_stored', 'true');
1143
- await AsyncStorage.setItem('pin_storage_timestamp', Date.now().toString());
974
+ const data = await response.json();
975
+ if (response.ok && data.success) {
976
+ console.log('✅ PIN stored successfully for user:', userToStore);
1144
977
  return {
1145
- success: true,
1146
- message: result.message || 'PIN stored successfully'
978
+ success: true
1147
979
  };
1148
980
  } else {
1149
- console.error('❌ PIN storage API returned error:', result.error);
981
+ console.error('❌ Failed to store PIN:', data.error);
1150
982
  return {
1151
983
  success: false,
1152
- error: result.error || 'PIN storage failed'
984
+ error: data.error || 'Failed to store PIN'
1153
985
  };
1154
986
  }
1155
987
  } catch (error) {
1156
- console.error('❌ Error storing PIN after biometric authentication:', error);
988
+ console.error('❌ Error storing PIN:', error);
1157
989
  return {
1158
990
  success: false,
1159
- error: error instanceof Error ? error.message : 'PIN storage failed'
991
+ error: error instanceof Error ? error.message : 'Network error'
1160
992
  };
1161
993
  }
1162
994
  };