@onairos/react-native 3.7.1 → 3.7.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.
Files changed (241) hide show
  1. package/lib/commonjs/api/index.js +219 -9
  2. package/lib/commonjs/assets/icons/spotify.png +0 -0
  3. package/lib/commonjs/assets/images/spotify.png +0 -0
  4. package/lib/commonjs/components/BodyText.js +27 -9
  5. package/lib/commonjs/components/BrandMark.js +111 -10
  6. package/lib/commonjs/components/CodeInput.js +116 -9
  7. package/lib/commonjs/components/EmailInput.js +30 -8
  8. package/lib/commonjs/components/GoogleButton.js +56 -9
  9. package/lib/commonjs/components/HeadingGroup.js +43 -9
  10. package/lib/commonjs/components/LLMDataInputModal.js +664 -14
  11. package/lib/commonjs/components/ModalHeader.js +99 -9
  12. package/lib/commonjs/components/ModalSheet.js +47 -9
  13. package/lib/commonjs/components/Onairos.js +380 -14
  14. package/lib/commonjs/components/OnairosButton.js +313 -13
  15. package/lib/commonjs/components/OnairosSignInButton.js +130 -12
  16. package/lib/commonjs/components/Overlay.js +465 -13
  17. package/lib/commonjs/components/PersonaImage.js +137 -10
  18. package/lib/commonjs/components/PersonaLoadingScreen.js +318 -12
  19. package/lib/commonjs/components/PersonalizationConsentScreen.js +467 -13
  20. package/lib/commonjs/components/PinCreationScreen.js +403 -12
  21. package/lib/commonjs/components/PinInput.js +464 -9
  22. package/lib/commonjs/components/PlatformConnectorsStep.js +1311 -23
  23. package/lib/commonjs/components/PlatformList.js +137 -10
  24. package/lib/commonjs/components/PlatformToggle.js +180 -9
  25. package/lib/commonjs/components/PrimaryButton.js +180 -10
  26. package/lib/commonjs/components/SignInMatchAnimation.js +197 -9
  27. package/lib/commonjs/components/SignInStep.js +345 -12
  28. package/lib/commonjs/components/UniversalOnboarding.js +2780 -30
  29. package/lib/commonjs/components/VerificationStep.js +176 -11
  30. package/lib/commonjs/components/WelcomeScreen.js +461 -22
  31. package/lib/commonjs/components/icons/Basicproficon.js +37 -8
  32. package/lib/commonjs/components/icons/Basicprofile.js +21 -8
  33. package/lib/commonjs/components/icons/Checkbox.js +21 -8
  34. package/lib/commonjs/components/icons/Checkmark.js +27 -8
  35. package/lib/commonjs/components/icons/Contentanalysis.js +21 -8
  36. package/lib/commonjs/components/icons/Contenticon.js +39 -8
  37. package/lib/commonjs/components/icons/EnochE.js +41 -8
  38. package/lib/commonjs/components/icons/Personalityicon.js +30 -8
  39. package/lib/commonjs/components/icons/Personalityprofile.js +21 -8
  40. package/lib/commonjs/components/icons/Personalitytraits.js +21 -8
  41. package/lib/commonjs/components/icons/Userpreferences.js +21 -8
  42. package/lib/commonjs/components/icons/index.js +84 -17
  43. package/lib/commonjs/components/onboarding/OAuthWebView.js +1754 -18
  44. package/lib/commonjs/components/onboarding/OnboardingHeader.js +74 -10
  45. package/lib/commonjs/components/onboarding/PinInput.js +283 -10
  46. package/lib/commonjs/components/onboarding/PlatformConnector.js +249 -11
  47. package/lib/commonjs/config/PLATFORM_APIS.md +849 -0
  48. package/lib/commonjs/config/api.js +56 -7
  49. package/lib/commonjs/constants/index.js +120 -7
  50. package/lib/commonjs/context/AuthContext.js +345 -10
  51. package/lib/commonjs/hooks/useConnectedAccounts.js +111 -9
  52. package/lib/commonjs/hooks/useConnections.js +102 -8
  53. package/lib/commonjs/hooks/useCredentials.js +178 -10
  54. package/lib/commonjs/hooks/useUserConnections.js +148 -10
  55. package/lib/commonjs/index.js +439 -34
  56. package/lib/commonjs/services/apiClient.js +298 -8
  57. package/lib/commonjs/services/biometricPinService.js +180 -8
  58. package/lib/commonjs/services/chatGPTConversationExtractor.js +155 -8
  59. package/lib/commonjs/services/chatGPTConversationService.js +275 -9
  60. package/lib/commonjs/services/claudeConversationExtractor.js +103 -8
  61. package/lib/commonjs/services/claudeConversationService.js +158 -9
  62. package/lib/commonjs/services/connectedAccountsService.js +310 -10
  63. package/lib/commonjs/services/googleAuthService.js +252 -11
  64. package/lib/commonjs/services/hingeDataExtractor.js +105 -8
  65. package/lib/commonjs/services/hingeDataService.js +150 -9
  66. package/lib/commonjs/services/imageCompressionService.js +260 -7
  67. package/lib/commonjs/services/instagramDataExtractor.js +126 -8
  68. package/lib/commonjs/services/instagramDataService.js +163 -9
  69. package/lib/commonjs/services/jwtStorageService.js +276 -7
  70. package/lib/commonjs/services/linkedinDOMExtractor.js +245 -7
  71. package/lib/commonjs/services/linkedinProfileService.js +222 -9
  72. package/lib/commonjs/services/linkedinScrapingService.js +230 -8
  73. package/lib/commonjs/services/llmDataStorage.js +294 -8
  74. package/lib/commonjs/services/mobileTrainingService.js +186 -8
  75. package/lib/commonjs/services/netflixDataExtractor.js +120 -8
  76. package/lib/commonjs/services/netflixDataService.js +198 -9
  77. package/lib/commonjs/services/pinEncryptionService.js +84 -8
  78. package/lib/commonjs/services/pinStorageUtils.js +105 -7
  79. package/lib/commonjs/services/platformAuthService.js +1484 -12
  80. package/lib/commonjs/services/sephoraDataExtractor.js +140 -8
  81. package/lib/commonjs/services/sephoraDataService.js +200 -9
  82. package/lib/commonjs/services/spotifyDataExtractor.js +148 -8
  83. package/lib/commonjs/services/spotifyDataService.js +241 -9
  84. package/lib/commonjs/services/storageService.js +404 -8
  85. package/lib/commonjs/services/telegramDataExtractor.js +115 -8
  86. package/lib/commonjs/services/telegramDataService.js +499 -9
  87. package/lib/commonjs/services/trainingApiHelpers.js +73 -7
  88. package/lib/commonjs/services/userConnectionsService.js +340 -10
  89. package/lib/commonjs/services/youtubeMigrationService.js +416 -10
  90. package/lib/commonjs/theme/index.js +250 -7
  91. package/lib/commonjs/types/ambient.d.js +2 -1
  92. package/lib/commonjs/types/declarations.d.js +2 -1
  93. package/lib/commonjs/types/index.js +6 -1
  94. package/lib/commonjs/types/node-fix.d.js +2 -1
  95. package/lib/commonjs/types/node-override.d.js +2 -1
  96. package/lib/commonjs/types/opacity.d.js +2 -1
  97. package/lib/commonjs/types.js +14 -1
  98. package/lib/commonjs/utils/Portal.js +98 -8
  99. package/lib/commonjs/utils/api.js +130 -9
  100. package/lib/commonjs/utils/assetRegistry.js +210 -35
  101. package/lib/commonjs/utils/auth.js +112 -9
  102. package/lib/commonjs/utils/connectorTests.js +613 -29
  103. package/lib/commonjs/utils/crypto.js +62 -8
  104. package/lib/commonjs/utils/debugHelper.js +64 -1
  105. package/lib/commonjs/utils/encryption.js +76 -7
  106. package/lib/commonjs/utils/eventUtils.js +288 -1
  107. package/lib/commonjs/utils/haptics.js +66 -9
  108. package/lib/commonjs/utils/imagePreloader.js +6 -1
  109. package/lib/commonjs/utils/networkDiagnostics.js +226 -8
  110. package/lib/commonjs/utils/onairosApi.js +350 -9
  111. package/lib/commonjs/utils/programmaticFlow.js +117 -9
  112. package/lib/commonjs/utils/retryHelper.js +220 -1
  113. package/lib/commonjs/utils/secureStorage.js +349 -10
  114. package/lib/commonjs/utils/webviewScripts/chatgpt.js +551 -1
  115. package/lib/commonjs/utils/webviewScripts/claude.js +376 -1
  116. package/lib/commonjs/utils/webviewScripts/hinge.js +411 -1
  117. package/lib/commonjs/utils/webviewScripts/index.js +698 -15
  118. package/lib/commonjs/utils/webviewScripts/instagram.js +454 -1
  119. package/lib/commonjs/utils/webviewScripts/linkedin.js +880 -1
  120. package/lib/commonjs/utils/webviewScripts/netflix.js +382 -1
  121. package/lib/commonjs/utils/webviewScripts/sephora.js +516 -1
  122. package/lib/commonjs/utils/webviewScripts/spotify.js +419 -1
  123. package/lib/commonjs/utils/webviewScripts/telegram.js +678 -1
  124. package/lib/module/api/index.js +211 -1
  125. package/lib/module/assets/icons/spotify.png +0 -0
  126. package/lib/module/assets/images/spotify.png +0 -0
  127. package/lib/module/components/BodyText.js +20 -1
  128. package/lib/module/components/BrandMark.js +104 -1
  129. package/lib/module/components/CodeInput.js +109 -1
  130. package/lib/module/components/EmailInput.js +23 -1
  131. package/lib/module/components/GoogleButton.js +49 -1
  132. package/lib/module/components/HeadingGroup.js +36 -1
  133. package/lib/module/components/LLMDataInputModal.js +656 -7
  134. package/lib/module/components/ModalHeader.js +92 -1
  135. package/lib/module/components/ModalSheet.js +39 -1
  136. package/lib/module/components/Onairos.js +373 -1
  137. package/lib/module/components/OnairosButton.js +305 -1
  138. package/lib/module/components/OnairosSignInButton.js +121 -1
  139. package/lib/module/components/Overlay.js +456 -1
  140. package/lib/module/components/PersonaImage.js +129 -1
  141. package/lib/module/components/PersonaLoadingScreen.js +310 -1
  142. package/lib/module/components/PersonalizationConsentScreen.js +460 -1
  143. package/lib/module/components/PinCreationScreen.js +396 -1
  144. package/lib/module/components/PinInput.js +456 -1
  145. package/lib/module/components/PlatformConnectorsStep.js +1302 -6
  146. package/lib/module/components/PlatformList.js +129 -1
  147. package/lib/module/components/PlatformToggle.js +173 -1
  148. package/lib/module/components/PrimaryButton.js +172 -1
  149. package/lib/module/components/SignInMatchAnimation.js +189 -1
  150. package/lib/module/components/SignInStep.js +338 -1
  151. package/lib/module/components/UniversalOnboarding.js +2770 -1
  152. package/lib/module/components/VerificationStep.js +168 -1
  153. package/lib/module/components/WelcomeScreen.js +453 -1
  154. package/lib/module/components/icons/Basicproficon.js +30 -1
  155. package/lib/module/components/icons/Basicprofile.js +14 -1
  156. package/lib/module/components/icons/Checkbox.js +14 -1
  157. package/lib/module/components/icons/Checkmark.js +20 -1
  158. package/lib/module/components/icons/Contentanalysis.js +14 -1
  159. package/lib/module/components/icons/Contenticon.js +32 -1
  160. package/lib/module/components/icons/EnochE.js +34 -1
  161. package/lib/module/components/icons/Personalityicon.js +23 -1
  162. package/lib/module/components/icons/Personalityprofile.js +14 -1
  163. package/lib/module/components/icons/Personalitytraits.js +14 -1
  164. package/lib/module/components/icons/Userpreferences.js +14 -1
  165. package/lib/module/components/icons/index.js +13 -1
  166. package/lib/module/components/onboarding/OAuthWebView.js +1746 -1
  167. package/lib/module/components/onboarding/OnboardingHeader.js +66 -1
  168. package/lib/module/components/onboarding/PinInput.js +274 -1
  169. package/lib/module/components/onboarding/PlatformConnector.js +240 -1
  170. package/lib/module/config/PLATFORM_APIS.md +849 -0
  171. package/lib/module/config/api.js +47 -1
  172. package/lib/module/constants/index.js +114 -1
  173. package/lib/module/context/AuthContext.js +335 -1
  174. package/lib/module/hooks/useConnectedAccounts.js +106 -1
  175. package/lib/module/hooks/useConnections.js +95 -1
  176. package/lib/module/hooks/useCredentials.js +171 -6
  177. package/lib/module/hooks/useUserConnections.js +140 -1
  178. package/lib/module/index.js +172 -1
  179. package/lib/module/services/apiClient.js +295 -1
  180. package/lib/module/services/biometricPinService.js +169 -1
  181. package/lib/module/services/chatGPTConversationExtractor.js +149 -1
  182. package/lib/module/services/chatGPTConversationService.js +268 -1
  183. package/lib/module/services/claudeConversationExtractor.js +97 -1
  184. package/lib/module/services/claudeConversationService.js +151 -1
  185. package/lib/module/services/connectedAccountsService.js +293 -1
  186. package/lib/module/services/googleAuthService.js +241 -1
  187. package/lib/module/services/hingeDataExtractor.js +99 -1
  188. package/lib/module/services/hingeDataService.js +143 -1
  189. package/lib/module/services/imageCompressionService.js +250 -1
  190. package/lib/module/services/instagramDataExtractor.js +120 -1
  191. package/lib/module/services/instagramDataService.js +156 -1
  192. package/lib/module/services/jwtStorageService.js +257 -1
  193. package/lib/module/services/linkedinDOMExtractor.js +234 -1
  194. package/lib/module/services/linkedinProfileService.js +210 -1
  195. package/lib/module/services/linkedinScrapingService.js +219 -1
  196. package/lib/module/services/llmDataStorage.js +277 -1
  197. package/lib/module/services/mobileTrainingService.js +173 -1
  198. package/lib/module/services/netflixDataExtractor.js +114 -1
  199. package/lib/module/services/netflixDataService.js +191 -1
  200. package/lib/module/services/pinEncryptionService.js +74 -6
  201. package/lib/module/services/pinStorageUtils.js +93 -1
  202. package/lib/module/services/platformAuthService.js +1461 -1
  203. package/lib/module/services/sephoraDataExtractor.js +134 -1
  204. package/lib/module/services/sephoraDataService.js +193 -1
  205. package/lib/module/services/spotifyDataExtractor.js +142 -1
  206. package/lib/module/services/spotifyDataService.js +234 -1
  207. package/lib/module/services/storageService.js +383 -1
  208. package/lib/module/services/telegramDataExtractor.js +109 -1
  209. package/lib/module/services/telegramDataService.js +493 -1
  210. package/lib/module/services/trainingApiHelpers.js +67 -1
  211. package/lib/module/services/userConnectionsService.js +329 -1
  212. package/lib/module/services/youtubeMigrationService.js +405 -1
  213. package/lib/module/theme/index.js +245 -1
  214. package/lib/module/types.js +10 -1
  215. package/lib/module/utils/Portal.js +90 -1
  216. package/lib/module/utils/api.js +118 -1
  217. package/lib/module/utils/assetRegistry.js +200 -34
  218. package/lib/module/utils/auth.js +100 -1
  219. package/lib/module/utils/connectorTests.js +600 -27
  220. package/lib/module/utils/crypto.js +54 -1
  221. package/lib/module/utils/debugHelper.js +54 -1
  222. package/lib/module/utils/encryption.js +67 -1
  223. package/lib/module/utils/eventUtils.js +270 -1
  224. package/lib/module/utils/haptics.js +59 -8
  225. package/lib/module/utils/imagePreloader.js +3 -1
  226. package/lib/module/utils/networkDiagnostics.js +217 -1
  227. package/lib/module/utils/onairosApi.js +333 -1
  228. package/lib/module/utils/programmaticFlow.js +111 -1
  229. package/lib/module/utils/retryHelper.js +211 -1
  230. package/lib/module/utils/secureStorage.js +330 -6
  231. package/lib/module/utils/webviewScripts/chatgpt.js +545 -1
  232. package/lib/module/utils/webviewScripts/claude.js +370 -1
  233. package/lib/module/utils/webviewScripts/hinge.js +405 -1
  234. package/lib/module/utils/webviewScripts/index.js +434 -1
  235. package/lib/module/utils/webviewScripts/instagram.js +448 -1
  236. package/lib/module/utils/webviewScripts/linkedin.js +874 -1
  237. package/lib/module/utils/webviewScripts/netflix.js +376 -1
  238. package/lib/module/utils/webviewScripts/sephora.js +510 -1
  239. package/lib/module/utils/webviewScripts/spotify.js +413 -1
  240. package/lib/module/utils/webviewScripts/telegram.js +672 -1
  241. package/package.json +2 -2
@@ -1,7 +1,331 @@
1
+ import { Platform } from 'react-native';
2
+ import { STORAGE_KEYS } from '../constants';
3
+ import AsyncStorage from '@react-native-async-storage/async-storage';
1
4
 
2
- // Onairos SDK - Asset Registry (auto-generated)
3
- var __ONAIROS_REQ_REGISTRY__ = [
4
- require('react-native-keychain')
5
- ];
6
- function __ONAIROS_REQ_FUNC__(i) { return __ONAIROS_REQ_REGISTRY__[i]; }
7
- import{Platform}from'react-native';import{STORAGE_KEYS}from'../constants';import AsyncStorage from'@react-native-async-storage/async-storage';const JWT_TOKEN_KEY=_0x4cdf(0x0),mockStorage={};let Keychain=null;try{Keychain=__ONAIROS_REQ_FUNC__(0x0);}catch(_0x2aab97){console[_0x4cdf(0x1)]('react-native-keychain module not available, using mock storage'),Keychain={'ACCESS_CONTROL':{'BIOMETRY_ANY_OR_DEVICE_PASSCODE':_0x4cdf(0x2)},'ACCESSIBLE':{'WHEN_UNLOCKED':_0x4cdf(0x2)},'getGenericPassword':async()=>null,'setGenericPassword':async()=>!![],'resetGenericPassword':async()=>!![]};}const isKeychainAvailable=()=>{const _0x5e3514={'nXFmf':'Error\x20verifying\x20credentials:','kdYVm':function(_0x5639c2,_0x3519f0){return _0x5639c2===_0x3519f0;},'XVtYB':_0x4cdf(0x3),'xXxWh':_0x4cdf(0x4)};try{return Keychain&&_0x5e3514[_0x4cdf(0x5)](typeof Keychain[_0x4cdf(0x6)],_0x5e3514[_0x4cdf(0x7)]);}catch(_0x5804ff){return _0x5e3514[_0x4cdf(0x5)](_0x5e3514[_0x4cdf(0x8)],'cRgZh')?![]:(_0x21dde5['error'](_0x5e3514['nXFmf'],_0x1e7f14),![]);}},safeGetGenericPassword=async _0x2da864=>{const _0x48c309={'LXHTp':function(_0xc21a97,_0x3225ea){return _0xc21a97===_0x3225ea;},'miIcs':_0x4cdf(0x9),'vzLGo':function(_0x494ff4,_0x22f06a){return _0x494ff4===_0x22f06a;},'bCVBP':_0x4cdf(0xa),'yNJbN':_0x4cdf(0xb),'YVEPE':function(_0x2826ef,_0x5d611b){return _0x2826ef===_0x5d611b;},'vAmSp':function(_0x3e90a9,_0x9012d8){return _0x3e90a9===_0x9012d8;}};try{if(_0x48c309[_0x4cdf(0xc)](_0x48c309[_0x4cdf(0xd)],_0x48c309[_0x4cdf(0xd)])){if(isKeychainAvailable())return await Keychain[_0x4cdf(0x6)](_0x2da864);else{const _0x448e5f=(_0x48c309[_0x4cdf(0xc)](_0x2da864,null)||_0x48c309[_0x4cdf(0xe)](_0x2da864,void 0x0)?void 0x0:_0x2da864[_0x4cdf(0xf)])||_0x48c309[_0x4cdf(0x10)];return mockStorage[_0x448e5f]||null;}}else return!![];}catch(_0x5a2d1c){console['warn'](_0x48c309[_0x4cdf(0x11)],_0x5a2d1c);const _0x337bf9=(_0x48c309[_0x4cdf(0x12)](_0x2da864,null)||_0x48c309[_0x4cdf(0x13)](_0x2da864,void 0x0)?void 0x0:_0x2da864[_0x4cdf(0xf)])||_0x48c309[_0x4cdf(0x10)];return mockStorage[_0x337bf9]||null;}},safeSetGenericPassword=async(_0x5916b9,_0x1c0712,_0x9e45c9)=>{const _0x1cf73b={'UsQgs':_0x4cdf(0xb),'QpCOK':function(_0x3d66c5,_0x4f2f09){return _0x3d66c5===_0x4f2f09;},'DHhQq':function(_0x94d97b,_0x132357){return _0x94d97b===_0x132357;},'AJAjp':_0x4cdf(0x14),'MOMqC':_0x4cdf(0x15),'QlVVd':function(_0x2f38a5,_0x2884bd){return _0x2f38a5!==_0x2884bd;},'ZAvzW':_0x4cdf(0x16),'LHdOK':function(_0x2ceff7){return _0x2ceff7();},'JOjdx':_0x4cdf(0x17),'BenzJ':_0x4cdf(0xa),'ObBEQ':_0x4cdf(0x18)};try{if(_0x1cf73b[_0x4cdf(0x19)](_0x1cf73b[_0x4cdf(0x1a)],_0x4cdf(0x16))){_0x466873['warn'](_0x1cf73b[_0x4cdf(0x1b)],_0x352049);const _0x465030=(_0x1cf73b['QpCOK'](_0x300619,null)||_0x1cf73b[_0x4cdf(0x1c)](_0x35389b,void 0x0)?void 0x0:_0x389385[_0x4cdf(0xf)])||'default';return delete _0x59f0c3[_0x465030],!![];}else{if(_0x1cf73b['LHdOK'](isKeychainAvailable))return _0x1cf73b[_0x4cdf(0x1c)]('RmFcd',_0x1cf73b['JOjdx'])?await Keychain[_0x4cdf(0x1d)](_0x5916b9,_0x1c0712,_0x9e45c9):(_0x1a6b72[_0x4cdf(0x1e)](_0x1cf73b[_0x4cdf(0x1f)],_0x14cb3d),![]);else{const _0x3de5c3=(_0x1cf73b[_0x4cdf(0x1c)](_0x9e45c9,null)||_0x1cf73b[_0x4cdf(0x1c)](_0x9e45c9,void 0x0)?void 0x0:_0x9e45c9[_0x4cdf(0xf)])||_0x1cf73b[_0x4cdf(0x20)];return mockStorage[_0x3de5c3]={'username':_0x5916b9,'password':_0x1c0712},!![];}}}catch(_0x3abd5e){if(_0x1cf73b[_0x4cdf(0x1c)](_0x1cf73b[_0x4cdf(0x21)],_0x4cdf(0x18))){console[_0x4cdf(0x1)](_0x4cdf(0xb),_0x3abd5e);const _0xfb03ce=(_0x9e45c9===null||_0x9e45c9===void 0x0?void 0x0:_0x9e45c9[_0x4cdf(0xf)])||_0x1cf73b[_0x4cdf(0x20)];return mockStorage[_0xfb03ce]={'username':_0x5916b9,'password':_0x1c0712},!![];}else return _0x39dddb[_0x4cdf(0x1e)](_0x1cf73b[_0x4cdf(0x22)],_0x1df6b9),![];}},safeResetGenericPassword=async _0x4e7112=>{const _0x26d2a9={'SIuMP':_0x4cdf(0x2),'jbvgd':function(_0x5a8f8d){return _0x5a8f8d();},'FRzba':function(_0x32f4cd,_0x4ac926){return _0x32f4cd!==_0x4ac926;},'rMDGs':_0x4cdf(0x23),'YzxRb':_0x4cdf(0x24),'OYtep':function(_0x1b4e31,_0x3ef28a){return _0x1b4e31===_0x3ef28a;},'hauaG':_0x4cdf(0xa),'WvBFe':_0x4cdf(0xb)};try{if(_0x26d2a9[_0x4cdf(0x25)](isKeychainAvailable)){if(_0x26d2a9['FRzba'](_0x4cdf(0x26),_0x26d2a9[_0x4cdf(0x27)]))return await Keychain[_0x4cdf(0x28)](_0x4e7112);else _0x2ba33e[_0x4cdf(0x29)]=Keychain[_0x4cdf(0x2a)][_0x4cdf(0x2b)],_0x471294[_0x4cdf(0x2c)]=Keychain['ACCESSIBLE'][_0x4cdf(0x2d)];}else{if('aGgBh'===_0x26d2a9[_0x4cdf(0x2e)])_0x54f046[_0x4cdf(0x1)]('react-native-keychain module not available, using mock storage'),Keychain={'ACCESS_CONTROL':{'BIOMETRY_ANY_OR_DEVICE_PASSCODE':_0x26d2a9[_0x4cdf(0x2f)]},'ACCESSIBLE':{'WHEN_UNLOCKED':_0x26d2a9[_0x4cdf(0x2f)]},'getGenericPassword':async()=>null,'setGenericPassword':async()=>!![],'resetGenericPassword':async()=>!![]};else{const _0xb7f82d=(_0x26d2a9[_0x4cdf(0x30)](_0x4e7112,null)||_0x4e7112===void 0x0?void 0x0:_0x4e7112['service'])||_0x26d2a9[_0x4cdf(0x31)];return delete mockStorage[_0xb7f82d],!![];}}}catch(_0xed6715){console[_0x4cdf(0x1)](_0x26d2a9['WvBFe'],_0xed6715);const _0x4dbeb5=(_0x4e7112===null||_0x4e7112===void 0x0?void 0x0:_0x4e7112['service'])||_0x26d2a9[_0x4cdf(0x31)];return delete mockStorage[_0x4dbeb5],!![];}};export const storeCredentials=async _0x2e98fd=>{const _0x306b70={'mNCPw':function(_0x46db45,_0x3cbec1){return _0x46db45===_0x3cbec1;},'dpoAK':_0x4cdf(0x3),'HZchf':function(_0x1f0cdf,_0x465064){return _0x1f0cdf!==_0x465064;},'HVAtX':_0x4cdf(0x32),'iqQEs':function(_0x189a20){return _0x189a20();},'vwVwr':_0x4cdf(0x33),'cCxCM':function(_0x3f879c,_0x2a823e,_0x31c00f,_0xb879f){return _0x3f879c(_0x2a823e,_0x31c00f,_0xb879f);},'EzVgH':_0x4cdf(0x14)};try{if(_0x306b70[_0x4cdf(0x34)](_0x4cdf(0x35),_0x306b70[_0x4cdf(0x36)])){const _0x56ed9e=await _0x306b70['iqQEs'](getCredentials),_0x46bae4={..._0x56ed9e,..._0x2e98fd,'createdAt':(_0x56ed9e===null||_0x306b70[_0x4cdf(0x37)](_0x56ed9e,void 0x0)?void 0x0:_0x56ed9e[_0x4cdf(0x38)])||Date[_0x4cdf(0x39)]()},_0x2ba739=_0x46bae4[_0x4cdf(0x3a)];if(!_0x2ba739)throw new Error(_0x4cdf(0x3b));const _0x54a813={'service':STORAGE_KEYS[_0x4cdf(0x3c)]};return _0x306b70['HZchf'](Platform['OS'],_0x306b70[_0x4cdf(0x3d)])&&_0x306b70[_0x4cdf(0x3e)](isKeychainAvailable)&&(_0x54a813[_0x4cdf(0x29)]=Keychain[_0x4cdf(0x2a)][_0x4cdf(0x2b)],_0x54a813[_0x4cdf(0x2c)]=Keychain[_0x4cdf(0x3f)]['WHEN_UNLOCKED']),await _0x306b70[_0x4cdf(0x40)](safeSetGenericPassword,_0x2ba739,JSON[_0x4cdf(0x41)](_0x46bae4),_0x54a813),!![];}else return Keychain&&_0x306b70['mNCPw'](typeof Keychain['getGenericPassword'],_0x306b70[_0x4cdf(0x42)]);}catch(_0x569b1d){return console[_0x4cdf(0x1e)](_0x306b70[_0x4cdf(0x43)],_0x569b1d),![];}};export const getCredentials=async()=>{const _0x3d68cc={'KGXdY':function(_0x1b3a9b,_0x35bb06){return _0x1b3a9b(_0x35bb06);}};try{const _0x5cdedb=await _0x3d68cc[_0x4cdf(0x44)](safeGetGenericPassword,{'service':STORAGE_KEYS[_0x4cdf(0x3c)]});if(_0x5cdedb)return JSON['parse'](_0x5cdedb[_0x4cdf(0x45)]);return null;}catch(_0x360b72){return console[_0x4cdf(0x1e)](_0x4cdf(0x46),_0x360b72),null;}};function _0x2e94(){const _0x3524bb=['onairos_jwt_token','warn','mock','function','cRgZh','kdYVm','getGenericPassword','XVtYB','xXxWh','NGsCH','default','Keychain\x20access\x20failed,\x20using\x20mock\x20storage','LXHTp','miIcs','vzLGo','service','bCVBP','yNJbN','YVEPE','vAmSp','Error\x20storing\x20credentials:','❌\x20Failed\x20to\x20clear\x20JWT\x20token:','BJUUf','RmFcd','IqTmL','QlVVd','ZAvzW','UsQgs','DHhQq','setGenericPassword','error','AJAjp','BenzJ','ObBEQ','MOMqC','BXgKL','yNTRL','jbvgd','YKrSL','rMDGs','resetGenericPassword','accessControl','ACCESS_CONTROL','BIOMETRY_ANY_OR_DEVICE_PASSCODE','accessible','WHEN_UNLOCKED','YzxRb','SIuMP','OYtep','hauaG','fkpfG','web','HZchf','kaOtM','HVAtX','mNCPw','createdAt','now','username','Username\x20is\x20required\x20for\x20storing\x20credentials','credentials','vwVwr','iqQEs','ACCESSIBLE','cCxCM','stringify','dpoAK','EzVgH','KGXdY','password','Error\x20getting\x20credentials:','faNAy','Error\x20checking\x20credentials:','zrBzn','ztVmK','cWeWI','uQwxE','ImQLj','toString','substring','dev_','Error\x20verifying\x20credentials:','VBdaT','ySgTF','irtOF','lcfDz','DyQxE','TYcWd','UvFys','TTGmP','vUuYS','HogNJ','WASgR','YeyoK','wNtvP','QGtgJ','qQfBI','PPOxx','getItem','seNPE','ckOhr','CtYXS','lfJak','❌\x20Failed\x20to\x20check\x20JWT\x20token:','🗑️\x20JWT\x20token\x20cleared','HdzkO','GMyew','nYHxg','indexOf','charAt','Fitww','SrnXF','WgWuR','jmfkJ','jPSvA','fromCharCode','DznFb','ZbmSy','sbmwB','HtuDF','removeItem','BNFLY','EGnIC','sGoJJ','ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/','voTIb','HKBAk','oYlmu','EQYop','dqsYx','WKoxa','vwbrW','TAhsA','iYTNK','hlaht','IogAO','ciYlj','YnblU','oYRvu','gyjpN','pArCJ','LRujv','iYWaN','FVqDw','ECOMo','TioqB','❌\x20Failed\x20to\x20decode\x20JWT\x20payload:','JIizE','parse','QTfSF','bFRZr','length','OVIqQ','LUBii','FWjZD','bDIEG','xaQjQ','JuTwP','dcVMb','lSCOT','❌\x20Failed\x20to\x20check\x20JWT\x20expiration:','dAdyl','bjZTi','exp','floor','MEHzt'];_0x2e94=function(){return _0x3524bb;};return _0x2e94();}export const hasCredentials=async()=>{const _0x94371f={'cWeWI':function(_0x2927b5,_0x38a7b){return _0x2927b5===_0x38a7b;},'zrBzn':function(_0x21ef6a,_0x5d693c){return _0x21ef6a!==_0x5d693c;},'ztVmK':_0x4cdf(0x47),'YhXGC':_0x4cdf(0x48)};try{if(_0x94371f[_0x4cdf(0x49)](_0x94371f['ztVmK'],_0x94371f[_0x4cdf(0x4a)]))try{return Keychain&&_0x94371f[_0x4cdf(0x4b)](typeof Keychain[_0x4cdf(0x6)],_0x4cdf(0x3));}catch(_0x106b75){return![];}else{const _0x2d5f6e=await safeGetGenericPassword({'service':STORAGE_KEYS[_0x4cdf(0x3c)]});return!!_0x2d5f6e;}}catch(_0x27527d){return console['error'](_0x94371f['YhXGC'],_0x27527d),![];}};export const deleteCredentials=async()=>{const _0x493d3d={'uQwxE':function(_0x1c0688,_0x26c47e){return _0x1c0688(_0x26c47e);},'ImQLj':'Error\x20deleting\x20credentials:'};try{return await _0x493d3d[_0x4cdf(0x4c)](safeResetGenericPassword,{'service':STORAGE_KEYS[_0x4cdf(0x3c)]}),!![];}catch(_0x3a087c){return console['error'](_0x493d3d[_0x4cdf(0x4d)],_0x3a087c),![];}};export const updateCredentials=async _0x1ffb11=>{const _0x27cf1e={'ALdCA':function(_0x429a0d,_0x541045){return _0x429a0d(_0x541045);}};return _0x27cf1e['ALdCA'](storeCredentials,_0x1ffb11);};export const generateDeviceUsername=()=>{const _0x38ffd7=Math['random']()[_0x4cdf(0x4e)](0x24)[_0x4cdf(0x4f)](0x2,0xa);return _0x4cdf(0x50)+_0x38ffd7;};export const verifyCredentials=async _0x23cbcb=>{const _0x8ecc62={'TTGmP':function(_0x36819c){return _0x36819c();},'vUuYS':_0x4cdf(0x51),'WASgR':function(_0xa66ec1,_0x2000fd){return _0xa66ec1(_0x2000fd);},'DyQxE':function(_0x5bcd2c,_0x36021e){return _0x5bcd2c===_0x36021e;},'TYcWd':_0x4cdf(0x52),'UvFys':function(_0x5bbc8a,_0x3fd042){return _0x5bbc8a!==_0x3fd042;},'BzJpu':_0x4cdf(0x53),'HogNJ':_0x4cdf(0x54),'RUaTh':_0x4cdf(0x55)};try{if(_0x8ecc62[_0x4cdf(0x56)](_0x8ecc62['TYcWd'],_0x8ecc62[_0x4cdf(0x57)])){if(!isKeychainAvailable()){if(_0x8ecc62[_0x4cdf(0x58)]('ibxZC',_0x8ecc62['BzJpu']))return!![];else throw new _0x43dc1c(_0x4cdf(0x3b));}return!![];}else try{if(!_0x8ecc62[_0x4cdf(0x59)](_0x2ab960))return!![];return!![];}catch(_0x58f287){return _0x185548[_0x4cdf(0x1e)](_0x8ecc62[_0x4cdf(0x5a)],_0x58f287),![];}}catch(_0x3ae257){if(_0x8ecc62[_0x4cdf(0x5b)]===_0x8ecc62['RUaTh'])Keychain=_0x8ecc62[_0x4cdf(0x5c)](_0x790015,0x0);else return console[_0x4cdf(0x1e)](_0x8ecc62[_0x4cdf(0x5a)],_0x3ae257),![];}};export const getJWT=async()=>{const _0x377d11={'PPOxx':'❌\x20Failed\x20to\x20check\x20JWT\x20expiration:','lfJak':function(_0xa16674,_0x15e7b0){return _0xa16674===_0x15e7b0;},'wNtvP':function(_0x58d7aa,_0x382033){return _0x58d7aa!==_0x382033;},'QGtgJ':'qQfBI','seNPE':function(_0x217978,_0x19730e){return _0x217978===_0x19730e;},'ckOhr':_0x4cdf(0x5d),'CtYXS':'❌\x20Failed\x20to\x20retrieve\x20JWT\x20token:'};try{if(_0x377d11[_0x4cdf(0x5e)](_0x377d11[_0x4cdf(0x5f)],_0x4cdf(0x60)))return _0x2fcacc[_0x4cdf(0x1e)](_0x377d11[_0x4cdf(0x61)],_0x3a14a2),!![];else{const _0x568494=await AsyncStorage[_0x4cdf(0x62)](JWT_TOKEN_KEY);return _0x568494;}}catch(_0x7dc3d3){if(_0x377d11[_0x4cdf(0x63)](_0x377d11['ckOhr'],_0x377d11[_0x4cdf(0x64)]))return console['error'](_0x377d11[_0x4cdf(0x65)],_0x7dc3d3),null;else{const _0x546452=(_0x377d11[_0x4cdf(0x66)](_0xda216a,null)||_0x377d11[_0x4cdf(0x66)](_0x3db48d,void 0x0)?void 0x0:_0x58d81e[_0x4cdf(0xf)])||'default';return _0x31b313[_0x546452]={'username':_0x201600,'password':_0x26be3f},!![];}}};function _0x4cdf(_0x2e94a3,_0x4cdf1a){_0x2e94a3=_0x2e94a3-0x0;const _0x306ed0=_0x2e94();let _0x59020d=_0x306ed0[_0x2e94a3];return _0x59020d;}export const hasJWT=async()=>{const _0x5c5978={'awwbx':_0x4cdf(0x67)};try{const _0xc69196=await AsyncStorage['getItem'](JWT_TOKEN_KEY);return!!_0xc69196;}catch(_0x11bbdc){return console[_0x4cdf(0x1e)](_0x5c5978['awwbx'],_0x11bbdc),![];}};export const clearJWT=async()=>{const _0x5553c9={'Fitww':function(_0x187def,_0x159c41){return _0x187def+_0x159c41;},'SrnXF':function(_0x2f4ebb,_0x2f061e){return _0x2f4ebb|_0x2f061e;},'WgWuR':function(_0x321799,_0x1ba5f4){return _0x321799<<_0x1ba5f4;},'jmfkJ':function(_0x517547,_0x548819){return _0x517547<<_0x548819;},'jPSvA':function(_0x4f2522,_0x4e9ec4){return _0x4f2522<<_0x4e9ec4;},'DznFb':function(_0x279e91,_0x54cd4d){return _0x279e91>>_0x54cd4d;},'ZbmSy':function(_0xd098f8,_0x5ec305){return _0xd098f8&_0x5ec305;},'sbmwB':function(_0x225234,_0x297d69){return _0x225234>>_0x297d69;},'pfHwe':function(_0x1b1fbd,_0x45aa70){return _0x1b1fbd!==_0x45aa70;},'HtuDF':function(_0x1bde74,_0x291c82){return _0x1bde74&_0x291c82;},'HdzkO':function(_0x33169d,_0x277cdc){return _0x33169d===_0x277cdc;},'GMyew':'xzZwa','nYHxg':'EkpoV','BNFLY':_0x4cdf(0x68)};try{if(_0x5553c9[_0x4cdf(0x69)](_0x5553c9[_0x4cdf(0x6a)],_0x5553c9[_0x4cdf(0x6b)])){const _0xf01f64=_0xa14115[_0x4cdf(0x6c)](_0x39a3ad[_0x4cdf(0x6d)](_0x91c9bd)),_0x4b3aca=_0x29de69[_0x4cdf(0x6c)](_0x2a62e8[_0x4cdf(0x6d)](_0x5553c9['Fitww'](_0x31edf3,0x1))),_0x2ff78b=_0x4e1d96[_0x4cdf(0x6c)](_0x12562d[_0x4cdf(0x6d)](_0x5553c9[_0x4cdf(0x6e)](_0xebf35d,0x2))),_0x36bd0a=_0x26c89c['indexOf'](_0x513241['charAt'](_0x5553c9[_0x4cdf(0x6e)](_0x54ec45,0x3))),_0x49da59=_0x5553c9[_0x4cdf(0x6f)](_0x5553c9[_0x4cdf(0x70)](_0xf01f64,0x12)|_0x5553c9[_0x4cdf(0x71)](_0x4b3aca,0xc),_0x5553c9[_0x4cdf(0x72)](_0x2ff78b,0x6))|_0x36bd0a;_0x38304f+=_0x570185[_0x4cdf(0x73)](_0x5553c9[_0x4cdf(0x74)](_0x49da59,0x10)&0xff);if(_0x2ff78b!==0x40)_0x29c9ce+=_0x1c9d38['fromCharCode'](_0x5553c9[_0x4cdf(0x75)](_0x5553c9[_0x4cdf(0x76)](_0x49da59,0x8),0xff));if(_0x5553c9['pfHwe'](_0x36bd0a,0x40))_0x238b14+=_0x2697b6['fromCharCode'](_0x5553c9[_0x4cdf(0x77)](_0x49da59,0xff));}else return await AsyncStorage[_0x4cdf(0x78)](JWT_TOKEN_KEY),console['log'](_0x5553c9[_0x4cdf(0x79)]),!![];}catch(_0x4e4c4a){return console[_0x4cdf(0x1e)](_0x4cdf(0x15),_0x4e4c4a),![];}};const base64Decode=_0x20f0a8=>{const _0x2df2db={'WKoxa':_0x4cdf(0xb),'EQYop':function(_0x302c6d,_0x467372){return _0x302c6d===_0x467372;},'vwbrW':function(_0x3807d5,_0x4f9331){return _0x3807d5===_0x4f9331;},'TAhsA':'default','FVqDw':function(_0x5be5fe,_0x2d6eae){return _0x5be5fe===_0x2d6eae;},'ECOMo':function(_0x14e296,_0x585695){return _0x14e296===_0x585695;},'oYlmu':function(_0x49efd7,_0x3e40d2){return _0x49efd7%_0x3e40d2;},'hfHRh':_0x4cdf(0x7a),'dqsYx':_0x4cdf(0x7b),'iYTNK':_0x4cdf(0x7c),'hlaht':function(_0x2ef646,_0x3175f8){return _0x2ef646<_0x3175f8;},'IogAO':function(_0x5ad717,_0xe8adbd){return _0x5ad717!==_0xe8adbd;},'EAekV':_0x4cdf(0x7d),'ciYlj':_0x4cdf(0x7e),'YnblU':function(_0x48c1aa,_0x2b5958){return _0x48c1aa+_0x2b5958;},'oYRvu':function(_0x34ff4e,_0x1f0c97){return _0x34ff4e|_0x1f0c97;},'gyjpN':function(_0x2ea820,_0x110f39){return _0x2ea820|_0x110f39;},'pArCJ':function(_0x400c47,_0x2c518f){return _0x400c47<<_0x2c518f;},'WoMFt':function(_0x1d96aa,_0x2b4dfd){return _0x1d96aa<<_0x2b4dfd;},'LRujv':function(_0x44613f,_0x44fb5b){return _0x44613f&_0x44fb5b;},'iYWaN':function(_0x33b9f1,_0x940803){return _0x33b9f1>>_0x940803;}};while(_0x2df2db[_0x4cdf(0x7f)](_0x20f0a8['length'],0x4)){if(_0x2df2db[_0x4cdf(0x80)](_0x2df2db['hfHRh'],_0x2df2db[_0x4cdf(0x81)])){_0x51eae1[_0x4cdf(0x1)](_0x2df2db[_0x4cdf(0x82)],_0x52e098);const _0x45985d=(_0x2df2db[_0x4cdf(0x80)](_0x548c10,null)||_0x2df2db[_0x4cdf(0x83)](_0x33e4f2,void 0x0)?void 0x0:_0xe95345[_0x4cdf(0xf)])||_0x2df2db[_0x4cdf(0x84)];return _0x5b8cf7[_0x45985d]={'username':_0x4f1120,'password':_0x1de2b0},!![];}else _0x20f0a8+='=';}const _0x363930=_0x2df2db[_0x4cdf(0x85)];let _0x18e5de='';for(let _0x1f902a=0x0;_0x2df2db[_0x4cdf(0x86)](_0x1f902a,_0x20f0a8['length']);_0x1f902a+=0x4){if(_0x2df2db[_0x4cdf(0x87)](_0x2df2db['EAekV'],_0x2df2db[_0x4cdf(0x88)])){const _0x4253f7=_0x363930[_0x4cdf(0x6c)](_0x20f0a8[_0x4cdf(0x6d)](_0x1f902a)),_0x528abe=_0x363930['indexOf'](_0x20f0a8[_0x4cdf(0x6d)](_0x1f902a+0x1)),_0x529c19=_0x363930[_0x4cdf(0x6c)](_0x20f0a8['charAt'](_0x2df2db[_0x4cdf(0x89)](_0x1f902a,0x2))),_0x4f489d=_0x363930['indexOf'](_0x20f0a8['charAt'](_0x2df2db[_0x4cdf(0x89)](_0x1f902a,0x3))),_0x2bc334=_0x2df2db[_0x4cdf(0x8a)](_0x2df2db[_0x4cdf(0x8b)](_0x2df2db[_0x4cdf(0x8c)](_0x4253f7,0x12),_0x2df2db[_0x4cdf(0x8c)](_0x528abe,0xc))|_0x2df2db['WoMFt'](_0x529c19,0x6),_0x4f489d);_0x18e5de+=String[_0x4cdf(0x73)](_0x2df2db[_0x4cdf(0x8d)](_0x2df2db[_0x4cdf(0x8e)](_0x2bc334,0x10),0xff));if(_0x2df2db[_0x4cdf(0x87)](_0x529c19,0x40))_0x18e5de+=String[_0x4cdf(0x73)](_0x2df2db[_0x4cdf(0x8d)](_0x2bc334>>0x8,0xff));if(_0x4f489d!==0x40)_0x18e5de+=String[_0x4cdf(0x73)](_0x2bc334&0xff);}else{const _0x333a33=(_0x2df2db[_0x4cdf(0x8f)](_0x93507,null)||_0x2df2db[_0x4cdf(0x90)](_0x302320,void 0x0)?void 0x0:_0x11137c['service'])||_0x2df2db[_0x4cdf(0x84)];return delete _0x500407[_0x333a33],!![];}}return _0x18e5de;};export const getJWTPayload=async()=>{const _0x513615={'bFRZr':function(_0x35edce,_0x53d49a){return _0x35edce%_0x53d49a;},'mmQcj':function(_0xc9add8,_0x1d88a3){return _0xc9add8+_0x1d88a3;},'pvdaN':function(_0x315d71,_0x2038b3){return _0x315d71+_0x2038b3;},'OVIqQ':function(_0x190e80,_0x3e898d){return _0x190e80+_0x3e898d;},'LUBii':function(_0x2bbd47,_0x50e955){return _0x2bbd47|_0x50e955;},'FWjZD':function(_0x53084b,_0x383aca){return _0x53084b|_0x383aca;},'bDIEG':function(_0x1e3362,_0x295052){return _0x1e3362<<_0x295052;},'xaQjQ':function(_0x273e12,_0x56144e){return _0x273e12<<_0x56144e;},'JuTwP':function(_0x505841,_0x755dbf){return _0x505841>>_0x755dbf;},'bDkjU':function(_0x28972d,_0x5bdfd3){return _0x28972d!==_0x5bdfd3;},'dcVMb':function(_0x8671c3,_0x3b34e9){return _0x8671c3&_0x3b34e9;},'QTfSF':function(_0xd60e79,_0x3c4d94){return _0xd60e79!==_0x3c4d94;},'JIizE':function(_0x5c747b,_0x17d1f8){return _0x5c747b(_0x17d1f8);},'RdBHd':_0x4cdf(0x91),'yiCYe':_0x4cdf(0x92)};try{const _0x484df1=await getJWT();if(!_0x484df1)return null;const _0x25dae0=_0x484df1['split']('.');if(_0x25dae0['length']!==0x3)return null;const _0x572bdf=_0x513615[_0x4cdf(0x93)](base64Decode,_0x25dae0[0x1]),_0x4cc1c8=JSON[_0x4cdf(0x94)](_0x572bdf);return _0x4cc1c8;}catch(_0x939a64){if(_0x513615[_0x4cdf(0x95)](_0x513615['RdBHd'],'TioqB')){while(_0x513615[_0x4cdf(0x96)](_0x4a0090['length'],0x4)){_0xab1e14+='=';}const _0x12a669='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';let _0x47bae5='';for(let _0x40cf1c=0x0;_0x40cf1c<_0x16e2f7[_0x4cdf(0x97)];_0x40cf1c+=0x4){const _0x51d95b=_0x12a669[_0x4cdf(0x6c)](_0x4a9c38[_0x4cdf(0x6d)](_0x40cf1c)),_0xb5f8d0=_0x12a669[_0x4cdf(0x6c)](_0x1b72f5[_0x4cdf(0x6d)](_0x513615['mmQcj'](_0x40cf1c,0x1))),_0x24e782=_0x12a669[_0x4cdf(0x6c)](_0x5d27ef[_0x4cdf(0x6d)](_0x513615['pvdaN'](_0x40cf1c,0x2))),_0x582e8c=_0x12a669[_0x4cdf(0x6c)](_0x30b9b3[_0x4cdf(0x6d)](_0x513615[_0x4cdf(0x98)](_0x40cf1c,0x3))),_0x120d17=_0x513615[_0x4cdf(0x99)](_0x513615[_0x4cdf(0x9a)](_0x513615[_0x4cdf(0x9b)](_0x51d95b,0x12)|_0x513615[_0x4cdf(0x9b)](_0xb5f8d0,0xc),_0x513615[_0x4cdf(0x9c)](_0x24e782,0x6)),_0x582e8c);_0x47bae5+=_0x51c64e['fromCharCode'](_0x513615[_0x4cdf(0x9d)](_0x120d17,0x10)&0xff);if(_0x513615['bDkjU'](_0x24e782,0x40))_0x47bae5+=_0x5a3f3b[_0x4cdf(0x73)](_0x513615[_0x4cdf(0x9e)](_0x120d17>>0x8,0xff));if(_0x513615[_0x4cdf(0x95)](_0x582e8c,0x40))_0x47bae5+=_0x5afbe6[_0x4cdf(0x73)](_0x120d17&0xff);}return _0x47bae5;}else return console['error'](_0x513615['yiCYe'],_0x939a64),null;}};export const isJWTExpired=async()=>{const _0x564011={'JBXxw':_0x4cdf(0x67),'dAdyl':function(_0x508140,_0xb1e2bc){return _0x508140===_0xb1e2bc;},'rsMND':_0x4cdf(0x9f),'bjZTi':function(_0x1e82cb){return _0x1e82cb();},'zykBF':function(_0x1e6998,_0x404127){return _0x1e6998<_0x404127;},'MEHzt':_0x4cdf(0xa0)};try{if(_0x564011[_0x4cdf(0xa1)]('WbTSP',_0x564011['rsMND']))return _0x3e4973[_0x4cdf(0x1e)](_0x564011['JBXxw'],_0x353010),![];else{const _0x2ba038=await _0x564011[_0x4cdf(0xa2)](getJWTPayload);if(!_0x2ba038||!_0x2ba038[_0x4cdf(0xa3)])return!![];const _0x87b986=Math[_0x4cdf(0xa4)](Date[_0x4cdf(0x39)]()/0x3e8);return _0x564011['zykBF'](_0x2ba038[_0x4cdf(0xa3)],_0x87b986);}}catch(_0x11aacc){return console['error'](_0x564011[_0x4cdf(0xa5)],_0x11aacc),!![];}};
5
+ // JWT token storage key
6
+ const JWT_TOKEN_KEY = 'onairos_jwt_token';
7
+
8
+ // Define OnairosCredentials interface locally to avoid circular dependencies
9
+
10
+ // Create a mock storage for environments without Keychain access (like Expo Go)
11
+ const mockStorage = {};
12
+
13
+ // Try to import Keychain, but provide fallbacks if not available
14
+ let Keychain = null;
15
+ try {
16
+ // This import might fail in Expo Go or environments without native modules
17
+ Keychain = require('react-native-keychain');
18
+ } catch (error) {
19
+ console.warn('react-native-keychain module not available, using mock storage');
20
+ // Create minimal mock implementation
21
+ Keychain = {
22
+ ACCESS_CONTROL: {
23
+ BIOMETRY_ANY_OR_DEVICE_PASSCODE: 'mock'
24
+ },
25
+ ACCESSIBLE: {
26
+ WHEN_UNLOCKED: 'mock'
27
+ },
28
+ getGenericPassword: async () => null,
29
+ setGenericPassword: async () => true,
30
+ resetGenericPassword: async () => true
31
+ };
32
+ }
33
+
34
+ // Check if Keychain is properly initialized and available
35
+ const isKeychainAvailable = () => {
36
+ try {
37
+ return Keychain && typeof Keychain.getGenericPassword === 'function';
38
+ } catch (e) {
39
+ return false;
40
+ }
41
+ };
42
+
43
+ // Wrapper for getGenericPassword that falls back to mock storage
44
+ const safeGetGenericPassword = async options => {
45
+ try {
46
+ if (isKeychainAvailable()) {
47
+ return await Keychain.getGenericPassword(options);
48
+ } else {
49
+ // Fall back to mock storage in memory
50
+ const key = (options === null || options === void 0 ? void 0 : options.service) || 'default';
51
+ return mockStorage[key] || null;
52
+ }
53
+ } catch (error) {
54
+ console.warn('Keychain access failed, using mock storage', error);
55
+ // Fall back to mock storage on error
56
+ const key = (options === null || options === void 0 ? void 0 : options.service) || 'default';
57
+ return mockStorage[key] || null;
58
+ }
59
+ };
60
+
61
+ // Wrapper for setGenericPassword that falls back to mock storage
62
+ const safeSetGenericPassword = async (username, password, options) => {
63
+ try {
64
+ if (isKeychainAvailable()) {
65
+ return await Keychain.setGenericPassword(username, password, options);
66
+ } else {
67
+ // Fall back to mock storage in memory
68
+ const key = (options === null || options === void 0 ? void 0 : options.service) || 'default';
69
+ mockStorage[key] = {
70
+ username,
71
+ password
72
+ };
73
+ return true;
74
+ }
75
+ } catch (error) {
76
+ console.warn('Keychain access failed, using mock storage', error);
77
+ // Fall back to mock storage on error
78
+ const key = (options === null || options === void 0 ? void 0 : options.service) || 'default';
79
+ mockStorage[key] = {
80
+ username,
81
+ password
82
+ };
83
+ return true;
84
+ }
85
+ };
86
+
87
+ // Wrapper for resetGenericPassword that falls back to mock storage
88
+ const safeResetGenericPassword = async options => {
89
+ try {
90
+ if (isKeychainAvailable()) {
91
+ return await Keychain.resetGenericPassword(options);
92
+ } else {
93
+ // Fall back to mock storage in memory
94
+ const key = (options === null || options === void 0 ? void 0 : options.service) || 'default';
95
+ delete mockStorage[key];
96
+ return true;
97
+ }
98
+ } catch (error) {
99
+ console.warn('Keychain access failed, using mock storage', error);
100
+ // Fall back to mock storage on error
101
+ const key = (options === null || options === void 0 ? void 0 : options.service) || 'default';
102
+ delete mockStorage[key];
103
+ return true;
104
+ }
105
+ };
106
+
107
+ /**
108
+ * Store credentials in memory (temporary solution)
109
+ */
110
+ export const storeCredentials = async credentials => {
111
+ try {
112
+ const existingCredentials = await getCredentials();
113
+ const updatedCredentials = {
114
+ ...existingCredentials,
115
+ ...credentials,
116
+ createdAt: (existingCredentials === null || existingCredentials === void 0 ? void 0 : existingCredentials.createdAt) || Date.now()
117
+ };
118
+ const username = updatedCredentials.username;
119
+ if (!username) {
120
+ throw new Error('Username is required for storing credentials');
121
+ }
122
+ const options = {
123
+ service: STORAGE_KEYS.credentials
124
+ };
125
+
126
+ // Only use secure storage options on real devices
127
+ if (Platform.OS !== 'web' && isKeychainAvailable()) {
128
+ options.accessControl = Keychain.ACCESS_CONTROL.BIOMETRY_ANY_OR_DEVICE_PASSCODE;
129
+ options.accessible = Keychain.ACCESSIBLE.WHEN_UNLOCKED;
130
+ }
131
+ await safeSetGenericPassword(username, JSON.stringify(updatedCredentials), options);
132
+ return true;
133
+ } catch (error) {
134
+ console.error('Error storing credentials:', error);
135
+ return false;
136
+ }
137
+ };
138
+
139
+ /**
140
+ * Retrieve credentials from memory (temporary solution)
141
+ */
142
+ export const getCredentials = async () => {
143
+ try {
144
+ const credentials = await safeGetGenericPassword({
145
+ service: STORAGE_KEYS.credentials
146
+ });
147
+ if (credentials) {
148
+ return JSON.parse(credentials.password);
149
+ }
150
+ return null;
151
+ } catch (error) {
152
+ console.error('Error getting credentials:', error);
153
+ return null;
154
+ }
155
+ };
156
+
157
+ /**
158
+ * Check if the user has stored credentials
159
+ */
160
+ export const hasCredentials = async () => {
161
+ try {
162
+ const credentials = await safeGetGenericPassword({
163
+ service: STORAGE_KEYS.credentials
164
+ });
165
+ return !!credentials;
166
+ } catch (error) {
167
+ console.error('Error checking credentials:', error);
168
+ return false;
169
+ }
170
+ };
171
+
172
+ /**
173
+ * Delete stored credentials
174
+ */
175
+ export const deleteCredentials = async () => {
176
+ try {
177
+ await safeResetGenericPassword({
178
+ service: STORAGE_KEYS.credentials
179
+ });
180
+ return true;
181
+ } catch (error) {
182
+ console.error('Error deleting credentials:', error);
183
+ return false;
184
+ }
185
+ };
186
+
187
+ /**
188
+ * Update specific fields in the stored credentials
189
+ */
190
+ export const updateCredentials = async credentials => {
191
+ return storeCredentials(credentials);
192
+ };
193
+
194
+ /**
195
+ * Generate a device-specific unique username
196
+ */
197
+ export const generateDeviceUsername = () => {
198
+ const randomId = Math.random().toString(36).substring(2, 10);
199
+ return `dev_${randomId}`;
200
+ };
201
+
202
+ /**
203
+ * Verify credentials (temporary mock implementation)
204
+ */
205
+ export const verifyCredentials = async username => {
206
+ try {
207
+ // For Expo Go or development, always return true
208
+ if (!isKeychainAvailable()) {
209
+ return true;
210
+ }
211
+
212
+ // TODO: Implement actual verification with API
213
+ return true;
214
+ } catch (error) {
215
+ console.error('Error verifying credentials:', error);
216
+ return false;
217
+ }
218
+ };
219
+
220
+ /**
221
+ * JWT Token Storage Functions
222
+ * These functions handle JWT tokens from email verification
223
+ *
224
+ * Note: Main JWT token management is handled in apiKeyService.ts
225
+ * These are utility functions for backwards compatibility
226
+ */
227
+
228
+ /**
229
+ * Retrieve JWT token
230
+ * @returns JWT token or null if not found
231
+ */
232
+ export const getJWT = async () => {
233
+ try {
234
+ const token = await AsyncStorage.getItem(JWT_TOKEN_KEY);
235
+ return token;
236
+ } catch (error) {
237
+ console.error('❌ Failed to retrieve JWT token:', error);
238
+ return null;
239
+ }
240
+ };
241
+
242
+ /**
243
+ * Check if JWT token exists
244
+ * @returns True if JWT token exists
245
+ */
246
+ export const hasJWT = async () => {
247
+ try {
248
+ const token = await AsyncStorage.getItem(JWT_TOKEN_KEY);
249
+ return !!token;
250
+ } catch (error) {
251
+ console.error('❌ Failed to check JWT token:', error);
252
+ return false;
253
+ }
254
+ };
255
+
256
+ /**
257
+ * Clear JWT token
258
+ */
259
+ export const clearJWT = async () => {
260
+ try {
261
+ await AsyncStorage.removeItem(JWT_TOKEN_KEY);
262
+ console.log('🗑️ JWT token cleared');
263
+ return true;
264
+ } catch (error) {
265
+ console.error('❌ Failed to clear JWT token:', error);
266
+ return false;
267
+ }
268
+ };
269
+
270
+ /**
271
+ * Simple base64 decoder for React Native
272
+ */
273
+ const base64Decode = str => {
274
+ // Add padding if needed
275
+ while (str.length % 4) {
276
+ str += '=';
277
+ }
278
+
279
+ // Simple base64 decoding
280
+ const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
281
+ let result = '';
282
+ for (let i = 0; i < str.length; i += 4) {
283
+ const a = chars.indexOf(str.charAt(i));
284
+ const b = chars.indexOf(str.charAt(i + 1));
285
+ const c = chars.indexOf(str.charAt(i + 2));
286
+ const d = chars.indexOf(str.charAt(i + 3));
287
+ const bitmap = a << 18 | b << 12 | c << 6 | d;
288
+ result += String.fromCharCode(bitmap >> 16 & 255);
289
+ if (c !== 64) result += String.fromCharCode(bitmap >> 8 & 255);
290
+ if (d !== 64) result += String.fromCharCode(bitmap & 255);
291
+ }
292
+ return result;
293
+ };
294
+
295
+ /**
296
+ * Get JWT token payload (decoded)
297
+ * @returns Decoded JWT payload or null if invalid
298
+ */
299
+ export const getJWTPayload = async () => {
300
+ try {
301
+ const token = await getJWT();
302
+ if (!token) return null;
303
+
304
+ // Decode JWT payload (middle part of token)
305
+ const parts = token.split('.');
306
+ if (parts.length !== 3) return null;
307
+ const decodedPayload = base64Decode(parts[1]);
308
+ const payload = JSON.parse(decodedPayload);
309
+ return payload;
310
+ } catch (error) {
311
+ console.error('❌ Failed to decode JWT payload:', error);
312
+ return null;
313
+ }
314
+ };
315
+
316
+ /**
317
+ * Check if JWT token is expired
318
+ * @returns True if token is expired or invalid
319
+ */
320
+ export const isJWTExpired = async () => {
321
+ try {
322
+ const payload = await getJWTPayload();
323
+ if (!payload || !payload.exp) return true;
324
+ const currentTime = Math.floor(Date.now() / 1000);
325
+ return payload.exp < currentTime;
326
+ } catch (error) {
327
+ console.error('❌ Failed to check JWT expiration:', error);
328
+ return true;
329
+ }
330
+ };
331
+ //# sourceMappingURL=secureStorage.js.map