@onairos/react-native 3.4.1 → 3.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.
- package/README.md +423 -374
- package/lib/commonjs/api/index.js +9 -145
- package/lib/commonjs/assets/animations/loaderani.json +1 -0
- package/lib/commonjs/assets/animations/persona-animation.json +1 -0
- package/lib/commonjs/assets/fonts/EBGaramond-VariableFont_wght.ttf +0 -0
- package/lib/commonjs/assets/fonts/IBMPlexSans-VariableFont_wdth,wght.ttf +0 -0
- package/lib/commonjs/assets/icons/Facebookicon.png +0 -0
- package/lib/commonjs/assets/icons/Gmail.png +0 -0
- package/lib/commonjs/assets/icons/Linkedinicon.png +0 -0
- package/lib/commonjs/assets/icons/Redditicon.png +0 -0
- package/lib/commonjs/assets/icons/YouTubeicon2.png +0 -0
- package/lib/commonjs/assets/icons/YouTubeicon3.png +0 -0
- package/lib/commonjs/assets/icons/chatgpt.png +0 -0
- package/lib/commonjs/assets/icons/claude.png +0 -0
- package/lib/commonjs/assets/icons/gemini.png +0 -0
- package/lib/commonjs/assets/icons/grok.png +0 -0
- package/lib/commonjs/assets/images/Checkbox.svg +3 -0
- package/lib/commonjs/assets/images/EnochE.svg +19 -0
- package/lib/commonjs/assets/images/Enochicon1.png +0 -0
- package/lib/commonjs/assets/images/Face_ID_logo.png +0 -0
- package/lib/commonjs/assets/images/Facebookicon.png +0 -0
- package/lib/commonjs/assets/images/Gmail.png +0 -0
- package/lib/commonjs/assets/images/Googlelogo.png +0 -0
- package/lib/commonjs/assets/images/Linkedinicon.png +0 -0
- package/lib/commonjs/assets/images/OnairosNewLogo.png +0 -0
- package/lib/commonjs/assets/images/Onairoslogo.png +0 -0
- package/lib/commonjs/assets/images/Personalityprofile.svg +3 -0
- package/lib/commonjs/assets/images/Personalitytraits.svg +3 -0
- package/lib/commonjs/assets/images/Redditicon.png +0 -0
- package/lib/commonjs/assets/images/Userpreferences.svg +3 -0
- package/lib/commonjs/assets/images/YouTubeicon3.png +0 -0
- package/lib/commonjs/assets/images/arrow.svg +20 -0
- package/lib/commonjs/assets/images/basicproficon.svg +43 -0
- package/lib/commonjs/assets/images/basicprofile.svg +3 -0
- package/lib/commonjs/assets/images/chatgpt.png +0 -0
- package/lib/commonjs/assets/images/checkmark.svg +4 -0
- package/lib/commonjs/assets/images/claude.png +0 -0
- package/lib/commonjs/assets/images/contentanalysis.svg +3 -0
- package/lib/commonjs/assets/images/contenticon.svg +23 -0
- package/lib/commonjs/assets/images/gemini.png +0 -0
- package/lib/commonjs/assets/images/grok.png +0 -0
- package/lib/commonjs/assets/images/persona1.png +0 -0
- package/lib/commonjs/assets/images/persona2.png +0 -0
- package/lib/commonjs/assets/images/persona3.png +0 -0
- package/lib/commonjs/assets/images/persona4.png +0 -0
- package/lib/commonjs/assets/images/persona5.png +0 -0
- package/lib/commonjs/assets/images/personalityicon.svg +18 -0
- package/lib/commonjs/assets/images/x-close.svg +3 -0
- package/lib/commonjs/components/BodyText.js +9 -0
- package/lib/commonjs/components/BrandMark.js +10 -0
- package/lib/commonjs/components/CodeInput.js +9 -0
- package/lib/commonjs/components/EmailInput.js +8 -0
- package/lib/commonjs/components/GoogleButton.js +9 -0
- package/lib/commonjs/components/HeadingGroup.js +9 -0
- package/lib/commonjs/components/LLMDataInputModal.js +14 -0
- package/lib/commonjs/components/ModalHeader.js +9 -0
- package/lib/commonjs/components/ModalSheet.js +9 -0
- package/lib/commonjs/components/Onairos.js +14 -374
- package/lib/commonjs/components/OnairosButton.js +13 -309
- package/lib/commonjs/components/OnairosSignInButton.js +12 -0
- package/lib/commonjs/components/Overlay.js +13 -483
- package/lib/commonjs/components/PersonaImage.js +10 -0
- package/lib/commonjs/components/PersonaLoadingScreen.js +12 -0
- package/lib/commonjs/components/PersonalizationConsentScreen.js +13 -0
- package/lib/commonjs/components/PinCreationScreen.js +12 -0
- package/lib/commonjs/components/PinInput.js +9 -302
- package/lib/commonjs/components/PlatformConnectorsStep.js +23 -0
- package/lib/commonjs/components/PlatformList.js +10 -137
- package/lib/commonjs/components/PlatformToggle.js +9 -0
- package/lib/commonjs/components/PrimaryButton.js +10 -0
- package/lib/commonjs/components/SignInMatchAnimation.js +9 -0
- package/lib/commonjs/components/SignInStep.js +12 -0
- package/lib/commonjs/components/UniversalOnboarding.js +30 -1702
- package/lib/commonjs/components/VerificationStep.js +11 -0
- package/lib/commonjs/components/WelcomeScreen.js +22 -0
- package/lib/commonjs/components/icons/Basicproficon.js +8 -0
- package/lib/commonjs/components/icons/Basicprofile.js +8 -0
- package/lib/commonjs/components/icons/Checkbox.js +8 -0
- package/lib/commonjs/components/icons/Checkmark.js +8 -0
- package/lib/commonjs/components/icons/Contentanalysis.js +8 -0
- package/lib/commonjs/components/icons/Contenticon.js +8 -0
- package/lib/commonjs/components/icons/EnochE.js +8 -0
- package/lib/commonjs/components/icons/Personalityicon.js +8 -0
- package/lib/commonjs/components/icons/Personalityprofile.js +8 -0
- package/lib/commonjs/components/icons/Personalitytraits.js +8 -0
- package/lib/commonjs/components/icons/Userpreferences.js +8 -0
- package/lib/commonjs/components/icons/index.js +17 -0
- package/lib/commonjs/components/onboarding/OAuthWebView.js +18 -827
- package/lib/commonjs/components/onboarding/OnboardingHeader.js +10 -74
- package/lib/commonjs/components/onboarding/PinInput.js +10 -283
- package/lib/commonjs/components/onboarding/PlatformConnector.js +11 -249
- package/lib/commonjs/config/api.js +7 -0
- package/lib/commonjs/constants/index.js +7 -83
- package/lib/commonjs/context/AuthContext.js +10 -0
- package/lib/commonjs/hooks/useConnectedAccounts.js +9 -0
- package/lib/commonjs/hooks/useConnections.js +8 -159
- package/lib/commonjs/hooks/useCredentials.js +10 -177
- package/lib/commonjs/hooks/useUserConnections.js +10 -0
- package/lib/commonjs/index.js +34 -106
- package/lib/commonjs/services/SDK_API_KEY_VALIDATION.md +421 -421
- package/lib/commonjs/services/apiClient.js +8 -0
- package/lib/commonjs/services/apiKeyService.js +9 -952
- package/lib/commonjs/services/authService.js +10 -0
- package/lib/commonjs/services/biometricPinService.js +8 -0
- package/lib/commonjs/services/chatGPTConversationExtractor.js +8 -0
- package/lib/commonjs/services/chatGPTConversationService.js +9 -0
- package/lib/commonjs/services/claudeConversationExtractor.js +8 -0
- package/lib/commonjs/services/claudeConversationService.js +9 -0
- package/lib/commonjs/services/connectedAccountsService.js +10 -0
- package/lib/commonjs/services/googleAuthService.js +11 -0
- package/lib/commonjs/services/hingeDataExtractor.js +8 -0
- package/lib/commonjs/services/hingeDataService.js +9 -0
- package/lib/commonjs/services/imageCompressionService.js +7 -0
- package/lib/commonjs/services/instagramDataExtractor.js +8 -0
- package/lib/commonjs/services/instagramDataService.js +9 -0
- package/lib/commonjs/services/jwtStorageService.js +7 -0
- package/lib/commonjs/services/linkedinDOMExtractor.js +7 -0
- package/lib/commonjs/services/linkedinProfileService.js +9 -0
- package/lib/commonjs/services/linkedinScrapingService.js +8 -0
- package/lib/commonjs/services/llmDataStorage.js +8 -0
- package/lib/commonjs/services/mobileTrainingService.js +8 -0
- package/lib/commonjs/services/oauthService.js +11 -390
- package/lib/commonjs/services/pinEncryptionService.js +8 -0
- package/lib/commonjs/services/pinStorageUtils.js +7 -0
- package/lib/commonjs/services/platformAuthService.js +12 -1067
- package/lib/commonjs/services/sephoraDataExtractor.js +8 -0
- package/lib/commonjs/services/sephoraDataService.js +9 -0
- package/lib/commonjs/services/storageService.js +8 -0
- package/lib/commonjs/services/telegramDataExtractor.js +8 -0
- package/lib/commonjs/services/telegramDataService.js +11 -0
- package/lib/commonjs/services/trainingApiHelpers.js +7 -0
- package/lib/commonjs/services/userConnectionsService.js +10 -0
- package/lib/commonjs/services/youtubeMigrationService.js +10 -0
- package/lib/commonjs/theme/index.js +7 -0
- package/lib/commonjs/types/ambient.d.js +1 -2
- package/lib/commonjs/types/declarations.d.js +1 -2
- package/lib/commonjs/types/index.js +1 -6
- package/lib/commonjs/types/node-fix.d.js +1 -2
- package/lib/commonjs/types/node-override.d.js +1 -2
- package/lib/commonjs/types/opacity.d.js +1 -2
- package/lib/commonjs/types.js +1 -14
- package/lib/commonjs/utils/Portal.js +8 -98
- package/lib/commonjs/utils/api.js +9 -129
- package/lib/commonjs/utils/assetRegistry.js +33 -0
- package/lib/commonjs/utils/auth.js +9 -111
- package/lib/commonjs/utils/connectorTests.js +29 -0
- package/lib/commonjs/utils/crypto.js +8 -62
- package/lib/commonjs/utils/debugHelper.js +1 -64
- package/lib/commonjs/utils/encryption.js +7 -76
- package/lib/commonjs/utils/eventUtils.js +1 -0
- package/lib/commonjs/utils/haptics.js +9 -0
- package/lib/commonjs/utils/imagePreloader.js +1 -0
- package/lib/commonjs/utils/networkDiagnostics.js +8 -0
- package/lib/commonjs/utils/onairosApi.js +9 -350
- package/lib/commonjs/utils/programmaticFlow.js +9 -117
- package/lib/commonjs/utils/retryHelper.js +1 -220
- package/lib/commonjs/utils/secureStorage.js +10 -349
- package/lib/commonjs/utils/webviewScripts/chatgpt.js +1 -0
- package/lib/commonjs/utils/webviewScripts/claude.js +1 -0
- package/lib/commonjs/utils/webviewScripts/hinge.js +1 -0
- package/lib/commonjs/utils/webviewScripts/index.js +13 -0
- package/lib/commonjs/utils/webviewScripts/instagram.js +1 -0
- package/lib/commonjs/utils/webviewScripts/linkedin.js +1 -0
- package/lib/commonjs/utils/webviewScripts/sephora.js +1 -0
- package/lib/commonjs/utils/webviewScripts/telegram.js +1 -0
- package/lib/module/api/index.js +1 -139
- package/lib/module/assets/animations/loaderani.json +1 -0
- package/lib/module/assets/animations/persona-animation.json +1 -0
- package/lib/module/assets/fonts/EBGaramond-VariableFont_wght.ttf +0 -0
- package/lib/module/assets/fonts/IBMPlexSans-VariableFont_wdth,wght.ttf +0 -0
- package/lib/module/assets/icons/Facebookicon.png +0 -0
- package/lib/module/assets/icons/Gmail.png +0 -0
- package/lib/module/assets/icons/Linkedinicon.png +0 -0
- package/lib/module/assets/icons/Redditicon.png +0 -0
- package/lib/module/assets/icons/YouTubeicon2.png +0 -0
- package/lib/module/assets/icons/YouTubeicon3.png +0 -0
- package/lib/module/assets/icons/chatgpt.png +0 -0
- package/lib/module/assets/icons/claude.png +0 -0
- package/lib/module/assets/icons/farcaster.png +0 -0
- package/lib/module/assets/icons/gemini.png +0 -0
- package/lib/module/assets/icons/grok.png +0 -0
- package/lib/module/assets/icons/instagram.png +0 -0
- package/lib/module/assets/icons/pinterest.png +0 -0
- package/lib/module/assets/icons/swerv_logo.png +0 -0
- package/lib/module/assets/icons/twitter.jpg +0 -0
- package/lib/module/assets/images/Checkbox.svg +3 -0
- package/lib/module/assets/images/EnochE.svg +19 -0
- package/lib/module/assets/images/Enochicon1.png +0 -0
- package/lib/module/assets/images/Face_ID_logo.png +0 -0
- package/lib/module/assets/images/Facebookicon.png +0 -0
- package/lib/module/assets/images/Gmail.png +0 -0
- package/lib/module/assets/images/Googlelogo.png +0 -0
- package/lib/module/assets/images/Linkedinicon.png +0 -0
- package/lib/module/assets/images/OnairosNewLogo.png +0 -0
- package/lib/module/assets/images/Onairoslogo.png +0 -0
- package/lib/module/assets/images/Personalityprofile.svg +3 -0
- package/lib/module/assets/images/Personalitytraits.svg +3 -0
- package/lib/module/assets/images/Redditicon.png +0 -0
- package/lib/module/assets/images/Userpreferences.svg +3 -0
- package/lib/module/assets/images/YouTubeicon3.png +0 -0
- package/lib/module/assets/images/arrow.svg +20 -0
- package/lib/module/assets/images/basicproficon.svg +43 -0
- package/lib/module/assets/images/basicprofile.svg +3 -0
- package/lib/module/assets/images/chatgpt.png +0 -0
- package/lib/module/assets/images/checkmark.svg +4 -0
- package/lib/module/assets/images/claude.png +0 -0
- package/lib/module/assets/images/contentanalysis.svg +3 -0
- package/lib/module/assets/images/contenticon.svg +23 -0
- package/lib/module/assets/images/gemini.png +0 -0
- package/lib/module/assets/images/grok.png +0 -0
- package/lib/module/assets/images/persona1.png +0 -0
- package/lib/module/assets/images/persona2.png +0 -0
- package/lib/module/assets/images/persona3.png +0 -0
- package/lib/module/assets/images/persona4.png +0 -0
- package/lib/module/assets/images/persona5.png +0 -0
- package/lib/module/assets/images/personalityicon.svg +18 -0
- package/lib/module/assets/images/x-close.svg +3 -0
- package/lib/module/components/BodyText.js +1 -0
- package/lib/module/components/BrandMark.js +1 -0
- package/lib/module/components/CodeInput.js +1 -0
- package/lib/module/components/EmailInput.js +1 -0
- package/lib/module/components/GoogleButton.js +1 -0
- package/lib/module/components/HeadingGroup.js +1 -0
- package/lib/module/components/LLMDataInputModal.js +8 -0
- package/lib/module/components/ModalHeader.js +1 -0
- package/lib/module/components/ModalSheet.js +1 -0
- package/lib/module/components/Onairos.js +1 -367
- package/lib/module/components/OnairosButton.js +1 -302
- package/lib/module/components/OnairosSignInButton.js +1 -0
- package/lib/module/components/Overlay.js +1 -474
- package/lib/module/components/PersonaImage.js +1 -0
- package/lib/module/components/PersonaLoadingScreen.js +1 -0
- package/lib/module/components/PersonalizationConsentScreen.js +1 -0
- package/lib/module/components/PinCreationScreen.js +1 -0
- package/lib/module/components/PinInput.js +1 -293
- package/lib/module/components/PlatformConnectorsStep.js +7 -0
- package/lib/module/components/PlatformList.js +1 -129
- package/lib/module/components/PlatformToggle.js +1 -0
- package/lib/module/components/PrimaryButton.js +1 -0
- package/lib/module/components/SignInMatchAnimation.js +1 -0
- package/lib/module/components/SignInStep.js +1 -0
- package/lib/module/components/UniversalOnboarding.js +1 -1693
- package/lib/module/components/VerificationStep.js +1 -0
- package/lib/module/components/WelcomeScreen.js +1 -0
- package/lib/module/components/icons/Basicproficon.js +1 -0
- package/lib/module/components/icons/Basicprofile.js +1 -0
- package/lib/module/components/icons/Checkbox.js +1 -0
- package/lib/module/components/icons/Checkmark.js +1 -0
- package/lib/module/components/icons/Contentanalysis.js +1 -0
- package/lib/module/components/icons/Contenticon.js +1 -0
- package/lib/module/components/icons/EnochE.js +1 -0
- package/lib/module/components/icons/Personalityicon.js +1 -0
- package/lib/module/components/icons/Personalityprofile.js +1 -0
- package/lib/module/components/icons/Personalitytraits.js +1 -0
- package/lib/module/components/icons/Userpreferences.js +1 -0
- package/lib/module/components/icons/index.js +1 -0
- package/lib/module/components/onboarding/OAuthWebView.js +1 -818
- package/lib/module/components/onboarding/OnboardingHeader.js +1 -66
- package/lib/module/components/onboarding/PinInput.js +1 -274
- package/lib/module/components/onboarding/PlatformConnector.js +1 -240
- package/lib/module/config/api.js +1 -0
- package/lib/module/constants/index.js +1 -77
- package/lib/module/context/AuthContext.js +1 -0
- package/lib/module/hooks/useConnectedAccounts.js +1 -0
- package/lib/module/hooks/useConnections.js +1 -152
- package/lib/module/hooks/useCredentials.js +6 -169
- package/lib/module/hooks/useUserConnections.js +1 -0
- package/lib/module/index.js +1 -32
- package/lib/module/services/SDK_API_KEY_VALIDATION.md +421 -421
- package/lib/module/services/apiClient.js +1 -0
- package/lib/module/services/apiKeyService.js +1 -925
- package/lib/module/services/authService.js +1 -0
- package/lib/module/services/biometricPinService.js +1 -0
- package/lib/module/services/chatGPTConversationExtractor.js +1 -0
- package/lib/module/services/chatGPTConversationService.js +1 -0
- package/lib/module/services/claudeConversationExtractor.js +1 -0
- package/lib/module/services/claudeConversationService.js +1 -0
- package/lib/module/services/connectedAccountsService.js +1 -0
- package/lib/module/services/googleAuthService.js +1 -0
- package/lib/module/services/hingeDataExtractor.js +1 -0
- package/lib/module/services/hingeDataService.js +1 -0
- package/lib/module/services/imageCompressionService.js +1 -0
- package/lib/module/services/instagramDataExtractor.js +1 -0
- package/lib/module/services/instagramDataService.js +1 -0
- package/lib/module/services/jwtStorageService.js +1 -0
- package/lib/module/services/linkedinDOMExtractor.js +1 -0
- package/lib/module/services/linkedinProfileService.js +1 -0
- package/lib/module/services/linkedinScrapingService.js +1 -0
- package/lib/module/services/llmDataStorage.js +1 -0
- package/lib/module/services/mobileTrainingService.js +1 -0
- package/lib/module/services/oauthService.js +1 -380
- package/lib/module/services/pinEncryptionService.js +7 -0
- package/lib/module/services/pinStorageUtils.js +1 -0
- package/lib/module/services/platformAuthService.js +1 -1041
- package/lib/module/services/sephoraDataExtractor.js +1 -0
- package/lib/module/services/sephoraDataService.js +1 -0
- package/lib/module/services/storageService.js +1 -0
- package/lib/module/services/telegramDataExtractor.js +1 -0
- package/lib/module/services/telegramDataService.js +8 -0
- package/lib/module/services/trainingApiHelpers.js +1 -0
- package/lib/module/services/userConnectionsService.js +1 -0
- package/lib/module/services/youtubeMigrationService.js +1 -0
- package/lib/module/theme/index.js +1 -0
- package/lib/module/types.js +1 -10
- package/lib/module/utils/Portal.js +1 -90
- package/lib/module/utils/api.js +1 -117
- package/lib/module/utils/assetRegistry.js +33 -0
- package/lib/module/utils/auth.js +1 -99
- package/lib/module/utils/connectorTests.js +28 -0
- package/lib/module/utils/crypto.js +1 -54
- package/lib/module/utils/debugHelper.js +1 -54
- package/lib/module/utils/encryption.js +1 -67
- package/lib/module/utils/eventUtils.js +1 -0
- package/lib/module/utils/haptics.js +8 -0
- package/lib/module/utils/imagePreloader.js +1 -0
- package/lib/module/utils/networkDiagnostics.js +1 -0
- package/lib/module/utils/onairosApi.js +1 -333
- package/lib/module/utils/programmaticFlow.js +1 -111
- package/lib/module/utils/retryHelper.js +1 -211
- package/lib/module/utils/secureStorage.js +6 -330
- package/lib/module/utils/webviewScripts/chatgpt.js +1 -0
- package/lib/module/utils/webviewScripts/claude.js +1 -0
- package/lib/module/utils/webviewScripts/hinge.js +1 -0
- package/lib/module/utils/webviewScripts/index.js +1 -0
- package/lib/module/utils/webviewScripts/instagram.js +1 -0
- package/lib/module/utils/webviewScripts/linkedin.js +1 -0
- package/lib/module/utils/webviewScripts/sephora.js +1 -0
- package/lib/module/utils/webviewScripts/telegram.js +1 -0
- package/package.json +62 -39
- package/lib/commonjs/api/index.js.map +0 -1
- package/lib/commonjs/assets/images/email.png +0 -0
- package/lib/commonjs/assets/images/linkedin.png +0 -0
- package/lib/commonjs/assets/images/reddit.png +0 -0
- package/lib/commonjs/assets/images/youtube.png +0 -0
- package/lib/commonjs/components/DataRequestModal.js +0 -228
- package/lib/commonjs/components/DataRequestModal.js.map +0 -1
- package/lib/commonjs/components/DataRequestScreen.js +0 -329
- package/lib/commonjs/components/DataRequestScreen.js.map +0 -1
- package/lib/commonjs/components/EmailVerificationModal.js +0 -320
- package/lib/commonjs/components/EmailVerificationModal.js.map +0 -1
- package/lib/commonjs/components/Onairos.js.map +0 -1
- package/lib/commonjs/components/OnairosButton.js.map +0 -1
- package/lib/commonjs/components/Overlay.js.map +0 -1
- package/lib/commonjs/components/PinInput.js.map +0 -1
- package/lib/commonjs/components/PlatformList.js.map +0 -1
- package/lib/commonjs/components/TrainingModal.js +0 -717
- package/lib/commonjs/components/TrainingModal.js.map +0 -1
- package/lib/commonjs/components/UniversalOnboarding.js.map +0 -1
- package/lib/commonjs/components/UniversalOnboarding.tsx.new +0 -455
- package/lib/commonjs/components/onboarding/OAuthWebView.js.map +0 -1
- package/lib/commonjs/components/onboarding/OnboardingHeader.js.map +0 -1
- package/lib/commonjs/components/onboarding/PinInput.js.map +0 -1
- package/lib/commonjs/components/onboarding/PlatformConnector.js.map +0 -1
- package/lib/commonjs/components/screens/ConnectorScreen.js +0 -146
- package/lib/commonjs/components/screens/ConnectorScreen.js.map +0 -1
- package/lib/commonjs/components/screens/LoadingScreen.js +0 -91
- package/lib/commonjs/components/screens/LoadingScreen.js.map +0 -1
- package/lib/commonjs/components/screens/PinCreationScreen.js +0 -61
- package/lib/commonjs/components/screens/PinCreationScreen.js.map +0 -1
- package/lib/commonjs/constants/index.js.map +0 -1
- package/lib/commonjs/hooks/useConnections.js.map +0 -1
- package/lib/commonjs/hooks/useCredentials.js.map +0 -1
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/services/apiKeyService.js.map +0 -1
- package/lib/commonjs/services/oauthService.js.map +0 -1
- package/lib/commonjs/services/platformAuthService.js.map +0 -1
- package/lib/commonjs/types/ambient.d.js.map +0 -1
- package/lib/commonjs/types/declarations.d.js.map +0 -1
- package/lib/commonjs/types/index.d.js.map +0 -1
- package/lib/commonjs/types/index.js.map +0 -1
- package/lib/commonjs/types/node-fix.d.js.map +0 -1
- package/lib/commonjs/types/node-override.d.js.map +0 -1
- package/lib/commonjs/types/opacity.d.js.map +0 -1
- package/lib/commonjs/types/types.d.js.map +0 -1
- package/lib/commonjs/types.js.map +0 -1
- package/lib/commonjs/utils/Portal.js.map +0 -1
- package/lib/commonjs/utils/api.js.map +0 -1
- package/lib/commonjs/utils/auth.js.map +0 -1
- package/lib/commonjs/utils/crypto.js.map +0 -1
- package/lib/commonjs/utils/debugHelper.js.map +0 -1
- package/lib/commonjs/utils/encryption.js.map +0 -1
- package/lib/commonjs/utils/onairosApi.js.map +0 -1
- package/lib/commonjs/utils/programmaticFlow.js.map +0 -1
- package/lib/commonjs/utils/retryHelper.js.map +0 -1
- package/lib/commonjs/utils/secureStorage.js.map +0 -1
- package/lib/module/api/index.js.map +0 -1
- package/lib/module/assets/images/email.png +0 -0
- package/lib/module/assets/images/linkedin.png +0 -0
- package/lib/module/assets/images/reddit.png +0 -0
- package/lib/module/assets/images/youtube.png +0 -0
- package/lib/module/components/DataRequestModal.js +0 -220
- package/lib/module/components/DataRequestModal.js.map +0 -1
- package/lib/module/components/DataRequestScreen.js +0 -321
- package/lib/module/components/DataRequestScreen.js.map +0 -1
- package/lib/module/components/EmailVerificationModal.js +0 -311
- package/lib/module/components/EmailVerificationModal.js.map +0 -1
- package/lib/module/components/Onairos.js.map +0 -1
- package/lib/module/components/OnairosButton.js.map +0 -1
- package/lib/module/components/Overlay.js.map +0 -1
- package/lib/module/components/PinInput.js.map +0 -1
- package/lib/module/components/PlatformList.js.map +0 -1
- package/lib/module/components/TrainingModal.js +0 -708
- package/lib/module/components/TrainingModal.js.map +0 -1
- package/lib/module/components/UniversalOnboarding.js.map +0 -1
- package/lib/module/components/UniversalOnboarding.tsx.new +0 -455
- package/lib/module/components/onboarding/OAuthWebView.js.map +0 -1
- package/lib/module/components/onboarding/OnboardingHeader.js.map +0 -1
- package/lib/module/components/onboarding/PinInput.js.map +0 -1
- package/lib/module/components/onboarding/PlatformConnector.js.map +0 -1
- package/lib/module/components/screens/ConnectorScreen.js +0 -138
- package/lib/module/components/screens/ConnectorScreen.js.map +0 -1
- package/lib/module/components/screens/LoadingScreen.js +0 -83
- package/lib/module/components/screens/LoadingScreen.js.map +0 -1
- package/lib/module/components/screens/PinCreationScreen.js +0 -53
- package/lib/module/components/screens/PinCreationScreen.js.map +0 -1
- package/lib/module/constants/index.js.map +0 -1
- package/lib/module/hooks/useConnections.js.map +0 -1
- package/lib/module/hooks/useCredentials.js.map +0 -1
- package/lib/module/index.js.map +0 -1
- package/lib/module/services/apiKeyService.js.map +0 -1
- package/lib/module/services/oauthService.js.map +0 -1
- package/lib/module/services/platformAuthService.js.map +0 -1
- package/lib/module/types/ambient.d.js.map +0 -1
- package/lib/module/types/declarations.d.js.map +0 -1
- package/lib/module/types/index.d.js.map +0 -1
- package/lib/module/types/index.js.map +0 -1
- package/lib/module/types/node-fix.d.js.map +0 -1
- package/lib/module/types/node-override.d.js.map +0 -1
- package/lib/module/types/opacity.d.js.map +0 -1
- package/lib/module/types/types.d.js.map +0 -1
- package/lib/module/types.js.map +0 -1
- package/lib/module/utils/Portal.js.map +0 -1
- package/lib/module/utils/api.js.map +0 -1
- package/lib/module/utils/auth.js.map +0 -1
- package/lib/module/utils/crypto.js.map +0 -1
- package/lib/module/utils/debugHelper.js.map +0 -1
- package/lib/module/utils/encryption.js.map +0 -1
- package/lib/module/utils/onairosApi.js.map +0 -1
- package/lib/module/utils/programmaticFlow.js.map +0 -1
- package/lib/module/utils/retryHelper.js.map +0 -1
- package/lib/module/utils/secureStorage.js.map +0 -1
- package/lib/typescript/api/index.d.ts +0 -8
- package/lib/typescript/api/index.d.ts.map +0 -1
- package/lib/typescript/components/DataRequestModal.d.ts +0 -11
- package/lib/typescript/components/DataRequestModal.d.ts.map +0 -1
- package/lib/typescript/components/DataRequestScreen.d.ts +0 -11
- package/lib/typescript/components/DataRequestScreen.d.ts.map +0 -1
- package/lib/typescript/components/EmailVerificationModal.d.ts +0 -11
- package/lib/typescript/components/EmailVerificationModal.d.ts.map +0 -1
- package/lib/typescript/components/Onairos.d.ts +0 -4
- package/lib/typescript/components/Onairos.d.ts.map +0 -1
- package/lib/typescript/components/OnairosButton.d.ts +0 -12
- package/lib/typescript/components/OnairosButton.d.ts.map +0 -1
- package/lib/typescript/components/Overlay.d.ts +0 -4
- package/lib/typescript/components/Overlay.d.ts.map +0 -1
- package/lib/typescript/components/PinInput.d.ts +0 -4
- package/lib/typescript/components/PinInput.d.ts.map +0 -1
- package/lib/typescript/components/PlatformList.d.ts +0 -4
- package/lib/typescript/components/PlatformList.d.ts.map +0 -1
- package/lib/typescript/components/TrainingModal.d.ts +0 -4
- package/lib/typescript/components/TrainingModal.d.ts.map +0 -1
- package/lib/typescript/components/UniversalOnboarding.d.ts +0 -4
- package/lib/typescript/components/UniversalOnboarding.d.ts.map +0 -1
- package/lib/typescript/components/onboarding/OAuthWebView.d.ts +0 -10
- package/lib/typescript/components/onboarding/OAuthWebView.d.ts.map +0 -1
- package/lib/typescript/components/onboarding/OnboardingHeader.d.ts +0 -11
- package/lib/typescript/components/onboarding/OnboardingHeader.d.ts.map +0 -1
- package/lib/typescript/components/onboarding/PinInput.d.ts +0 -4
- package/lib/typescript/components/onboarding/PinInput.d.ts.map +0 -1
- package/lib/typescript/components/onboarding/PlatformConnector.d.ts +0 -13
- package/lib/typescript/components/onboarding/PlatformConnector.d.ts.map +0 -1
- package/lib/typescript/components/screens/ConnectorScreen.d.ts +0 -9
- package/lib/typescript/components/screens/ConnectorScreen.d.ts.map +0 -1
- package/lib/typescript/components/screens/LoadingScreen.d.ts +0 -9
- package/lib/typescript/components/screens/LoadingScreen.d.ts.map +0 -1
- package/lib/typescript/components/screens/PinCreationScreen.d.ts +0 -10
- package/lib/typescript/components/screens/PinCreationScreen.d.ts.map +0 -1
- package/lib/typescript/constants/index.d.ts +0 -53
- package/lib/typescript/constants/index.d.ts.map +0 -1
- package/lib/typescript/hooks/useConnections.d.ts +0 -9
- package/lib/typescript/hooks/useConnections.d.ts.map +0 -1
- package/lib/typescript/hooks/useCredentials.d.ts +0 -9
- package/lib/typescript/hooks/useCredentials.d.ts.map +0 -1
- package/lib/typescript/index.d.ts +0 -18
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/services/apiKeyService.d.ts +0 -132
- package/lib/typescript/services/apiKeyService.d.ts.map +0 -1
- package/lib/typescript/services/oauthService.d.ts +0 -50
- package/lib/typescript/services/oauthService.d.ts.map +0 -1
- package/lib/typescript/services/platformAuthService.d.ts +0 -144
- package/lib/typescript/services/platformAuthService.d.ts.map +0 -1
- package/lib/typescript/types/index.d.ts +0 -231
- package/lib/typescript/types/index.d.ts.map +0 -1
- package/lib/typescript/types.d.ts +0 -270
- package/lib/typescript/types.d.ts.map +0 -1
- package/lib/typescript/utils/Portal.d.ts +0 -14
- package/lib/typescript/utils/Portal.d.ts.map +0 -1
- package/lib/typescript/utils/api.d.ts +0 -6
- package/lib/typescript/utils/api.d.ts.map +0 -1
- package/lib/typescript/utils/auth.d.ts +0 -6
- package/lib/typescript/utils/auth.d.ts.map +0 -1
- package/lib/typescript/utils/crypto.d.ts +0 -4
- package/lib/typescript/utils/crypto.d.ts.map +0 -1
- package/lib/typescript/utils/debugHelper.d.ts +0 -29
- package/lib/typescript/utils/debugHelper.d.ts.map +0 -1
- package/lib/typescript/utils/encryption.d.ts +0 -19
- package/lib/typescript/utils/encryption.d.ts.map +0 -1
- package/lib/typescript/utils/onairosApi.d.ts +0 -87
- package/lib/typescript/utils/onairosApi.d.ts.map +0 -1
- package/lib/typescript/utils/programmaticFlow.d.ts +0 -23
- package/lib/typescript/utils/programmaticFlow.d.ts.map +0 -1
- package/lib/typescript/utils/retryHelper.d.ts +0 -69
- package/lib/typescript/utils/retryHelper.d.ts.map +0 -1
- package/lib/typescript/utils/secureStorage.d.ts +0 -94
- package/lib/typescript/utils/secureStorage.d.ts.map +0 -1
- package/src/api/index.ts +0 -111
- package/src/assets/images/email.png +0 -0
- package/src/assets/images/linkedin.png +0 -0
- package/src/assets/images/onairos_logo.png +0 -0
- package/src/assets/images/reddit.png +0 -0
- package/src/assets/images/youtube.png +0 -0
- package/src/components/DataRequestModal.tsx +0 -227
- package/src/components/DataRequestScreen.tsx +0 -356
- package/src/components/EmailVerificationModal.tsx +0 -364
- package/src/components/Onairos.tsx +0 -425
- package/src/components/OnairosButton.tsx +0 -359
- package/src/components/Overlay.tsx +0 -506
- package/src/components/PinInput.tsx +0 -343
- package/src/components/PlatformList.tsx +0 -145
- package/src/components/TrainingModal.tsx +0 -737
- package/src/components/UniversalOnboarding.tsx +0 -1839
- package/src/components/UniversalOnboarding.tsx.new +0 -455
- package/src/components/onboarding/OAuthWebView.tsx +0 -838
- package/src/components/onboarding/OnboardingHeader.tsx +0 -70
- package/src/components/onboarding/PinInput.tsx +0 -356
- package/src/components/onboarding/PlatformConnector.tsx +0 -302
- package/src/components/screens/ConnectorScreen.tsx +0 -153
- package/src/components/screens/LoadingScreen.tsx +0 -100
- package/src/components/screens/PinCreationScreen.tsx +0 -67
- package/src/constants/index.ts +0 -83
- package/src/hooks/useConnections.ts +0 -163
- package/src/hooks/useCredentials.ts +0 -175
- package/src/index.js +0 -14
- package/src/index.ts +0 -50
- package/src/services/SDK_API_KEY_VALIDATION.md +0 -421
- package/src/services/apiKeyService.ts +0 -984
- package/src/services/oauthService.ts +0 -412
- package/src/services/platformAuthService.ts +0 -1113
- package/src/types/ambient.d.ts +0 -29
- package/src/types/declarations.d.ts +0 -26
- package/src/types/index.d.ts +0 -274
- package/src/types/index.ts +0 -244
- package/src/types/node-fix.d.ts +0 -19
- package/src/types/node-override.d.ts +0 -24
- package/src/types/opacity.d.ts +0 -16
- package/src/types/types.d.ts +0 -18
- package/src/types.ts +0 -298
- package/src/utils/Portal.tsx +0 -83
- package/src/utils/api.js +0 -112
- package/src/utils/auth.js +0 -104
- package/src/utils/crypto.js +0 -60
- package/src/utils/debugHelper.ts +0 -53
- package/src/utils/encryption.ts +0 -69
- package/src/utils/onairosApi.ts +0 -391
- package/src/utils/programmaticFlow.ts +0 -113
- package/src/utils/retryHelper.ts +0 -275
- package/src/utils/secureStorage.ts +0 -361
- package/types/index.d.ts +0 -218
- package/types/node-env.d.ts +0 -15
- /package/{src/assets/images → lib/commonjs/assets/icons}/farcaster.png +0 -0
- /package/{src/assets/images → lib/commonjs/assets/icons}/instagram.png +0 -0
- /package/{src/assets/images → lib/commonjs/assets/icons}/pinterest.png +0 -0
- /package/{src/assets/images → lib/commonjs/assets/icons}/swerv_logo.png +0 -0
- /package/{src/assets/images → lib/commonjs/assets/icons}/twitter.jpg +0 -0
|
@@ -1,211 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* 🔄 Retry Helper Utility
|
|
3
|
-
*
|
|
4
|
-
* Provides robust retry logic with exponential backoff for network operations.
|
|
5
|
-
* Used throughout the Onairos SDK for handling transient failures gracefully.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Default retry options for the Onairos SDK
|
|
10
|
-
*/
|
|
11
|
-
export const DEFAULT_RETRY_OPTIONS = {
|
|
12
|
-
maxRetries: 3,
|
|
13
|
-
baseDelay: 1000,
|
|
14
|
-
maxDelay: 5000,
|
|
15
|
-
exponentialBackoff: true,
|
|
16
|
-
enableLogging: false,
|
|
17
|
-
shouldRetry: (error, attempt) => {
|
|
18
|
-
// Don't retry client errors (4xx) except for 408 (timeout) and 429 (rate limit)
|
|
19
|
-
if (error.status >= 400 && error.status < 500 && error.status !== 408 && error.status !== 429) {
|
|
20
|
-
return false;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
// Retry network errors, timeouts, and server errors (5xx)
|
|
24
|
-
if (error.name === 'AbortError' || error.message.includes('Network request failed') || error.message.includes('fetch') || error.message.includes('ENOTFOUND') || error.message.includes('timeout') || error.status >= 500) {
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// Retry JSON parse errors (likely server issues)
|
|
29
|
-
if (error.message.includes('JSON Parse error') || error.message.includes('Unexpected character')) {
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Execute a function with retry logic and exponential backoff
|
|
38
|
-
* @param fn Function to execute (should return a Promise)
|
|
39
|
-
* @param options Retry configuration options
|
|
40
|
-
* @returns Promise with retry result
|
|
41
|
-
*/
|
|
42
|
-
export async function withRetry(fn, options = {}) {
|
|
43
|
-
const config = {
|
|
44
|
-
...DEFAULT_RETRY_OPTIONS,
|
|
45
|
-
...options
|
|
46
|
-
};
|
|
47
|
-
const startTime = Date.now();
|
|
48
|
-
let lastError = null;
|
|
49
|
-
for (let attempt = 1; attempt <= config.maxRetries + 1; attempt++) {
|
|
50
|
-
try {
|
|
51
|
-
if (config.enableLogging && attempt > 1) {
|
|
52
|
-
console.log(`🔄 Retry attempt ${attempt}/${config.maxRetries + 1}`);
|
|
53
|
-
}
|
|
54
|
-
const result = await fn();
|
|
55
|
-
return {
|
|
56
|
-
success: true,
|
|
57
|
-
data: result,
|
|
58
|
-
attempts: attempt,
|
|
59
|
-
totalDuration: Date.now() - startTime
|
|
60
|
-
};
|
|
61
|
-
} catch (error) {
|
|
62
|
-
lastError = error;
|
|
63
|
-
|
|
64
|
-
// Check if we should retry this error
|
|
65
|
-
const shouldRetryError = config.shouldRetry ? config.shouldRetry(error, attempt) : true;
|
|
66
|
-
|
|
67
|
-
// If this is the last attempt or we shouldn't retry, throw the error
|
|
68
|
-
if (attempt > config.maxRetries || !shouldRetryError) {
|
|
69
|
-
if (config.enableLogging) {
|
|
70
|
-
console.error(`❌ All retry attempts exhausted or error not retryable: ${error.message}`);
|
|
71
|
-
}
|
|
72
|
-
break;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// Calculate delay for next attempt
|
|
76
|
-
let delay = config.baseDelay;
|
|
77
|
-
if (config.exponentialBackoff) {
|
|
78
|
-
delay = Math.min(config.baseDelay * Math.pow(2, attempt - 1), config.maxDelay);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// Add some jitter to prevent thundering herd
|
|
82
|
-
const jitter = Math.random() * 0.1 * delay;
|
|
83
|
-
delay = Math.floor(delay + jitter);
|
|
84
|
-
if (config.onRetry) {
|
|
85
|
-
config.onRetry(error, attempt, delay);
|
|
86
|
-
}
|
|
87
|
-
if (config.enableLogging) {
|
|
88
|
-
console.log(`⏳ Waiting ${delay}ms before retry (attempt ${attempt}/${config.maxRetries + 1})`);
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
// Wait before next attempt
|
|
92
|
-
await new Promise(resolve => setTimeout(() => resolve(), delay));
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
return {
|
|
96
|
-
success: false,
|
|
97
|
-
error: lastError || new Error('Unknown error'),
|
|
98
|
-
attempts: config.maxRetries + 1,
|
|
99
|
-
totalDuration: Date.now() - startTime
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Retry configuration for API calls
|
|
105
|
-
*/
|
|
106
|
-
export const API_RETRY_OPTIONS = {
|
|
107
|
-
maxRetries: 3,
|
|
108
|
-
baseDelay: 1000,
|
|
109
|
-
maxDelay: 5000,
|
|
110
|
-
exponentialBackoff: true,
|
|
111
|
-
shouldRetry: (error, attempt) => {
|
|
112
|
-
// Enhanced retry logic for API calls
|
|
113
|
-
|
|
114
|
-
// Never retry authentication errors (401) or permission errors (403)
|
|
115
|
-
if (error.status === 401 || error.status === 403) {
|
|
116
|
-
return false;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
// Never retry bad request errors (400) or not found (404) unless it's a specific case
|
|
120
|
-
if (error.status === 400 || error.status === 404 && !error.message.includes('validation endpoint')) {
|
|
121
|
-
return false;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// Retry rate limiting (429) with longer delays
|
|
125
|
-
if (error.status === 429) {
|
|
126
|
-
return attempt <= 2; // Limit retries for rate limiting
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
// Retry server errors (5xx)
|
|
130
|
-
if (error.status >= 500) {
|
|
131
|
-
return true;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
// Retry timeout and network errors
|
|
135
|
-
if (error.name === 'AbortError' || error.message.includes('timeout') || error.message.includes('Network request failed') || error.message.includes('fetch') || error.message.includes('ENOTFOUND')) {
|
|
136
|
-
return true;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// Retry JSON parse errors (server returning HTML instead of JSON)
|
|
140
|
-
if (error.message.includes('JSON Parse error') || error.message.includes('Unexpected character') || error.message.includes('HTML page instead of JSON')) {
|
|
141
|
-
return true;
|
|
142
|
-
}
|
|
143
|
-
return false;
|
|
144
|
-
},
|
|
145
|
-
onRetry: (error, attempt, delay) => {
|
|
146
|
-
console.warn(`⚠️ API call failed (attempt ${attempt}), retrying in ${delay}ms: ${error.message}`);
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Specialized retry for network/connectivity issues
|
|
152
|
-
*/
|
|
153
|
-
export const NETWORK_RETRY_OPTIONS = {
|
|
154
|
-
maxRetries: 2,
|
|
155
|
-
baseDelay: 2000,
|
|
156
|
-
maxDelay: 8000,
|
|
157
|
-
exponentialBackoff: true,
|
|
158
|
-
shouldRetry: (error, attempt) => {
|
|
159
|
-
// Only retry actual network/connectivity issues
|
|
160
|
-
return error.message.includes('Network request failed') || error.message.includes('ENOTFOUND') || error.message.includes('DNS') || error.name === 'AbortError';
|
|
161
|
-
}
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Create a retry wrapper for fetch requests
|
|
166
|
-
* @param url Request URL
|
|
167
|
-
* @param options Fetch options
|
|
168
|
-
* @param retryOptions Retry configuration
|
|
169
|
-
* @returns Promise with fetch response
|
|
170
|
-
*/
|
|
171
|
-
export async function fetchWithRetry(url, options = {}, retryOptions = API_RETRY_OPTIONS) {
|
|
172
|
-
const result = await withRetry(() => fetch(url, options), retryOptions);
|
|
173
|
-
if (!result.success) {
|
|
174
|
-
throw result.error;
|
|
175
|
-
}
|
|
176
|
-
return result.data;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Health check function with retry for testing connectivity
|
|
181
|
-
* @param url URL to check
|
|
182
|
-
* @param timeout Timeout in milliseconds
|
|
183
|
-
* @returns Promise indicating if the service is reachable
|
|
184
|
-
*/
|
|
185
|
-
export async function healthCheck(url, timeout = 5000) {
|
|
186
|
-
const startTime = Date.now();
|
|
187
|
-
try {
|
|
188
|
-
const controller = new AbortController();
|
|
189
|
-
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
190
|
-
const response = await fetch(url, {
|
|
191
|
-
method: 'GET',
|
|
192
|
-
signal: controller.signal,
|
|
193
|
-
headers: {
|
|
194
|
-
'User-Agent': 'OnairosReactNative/HealthCheck'
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
clearTimeout(timeoutId);
|
|
198
|
-
return {
|
|
199
|
-
reachable: true,
|
|
200
|
-
status: response.status,
|
|
201
|
-
duration: Date.now() - startTime
|
|
202
|
-
};
|
|
203
|
-
} catch (error) {
|
|
204
|
-
return {
|
|
205
|
-
reachable: false,
|
|
206
|
-
error: error.message,
|
|
207
|
-
duration: Date.now() - startTime
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
//# sourceMappingURL=retryHelper.js.map
|
|
1
|
+
export const DEFAULT_RETRY_OPTIONS={'maxRetries':0x3,'baseDelay':0x3e8,'maxDelay':0x1388,'exponentialBackoff':!![],'enableLogging':![],'shouldRetry':(_0x45ada6,_0x58cd70)=>{const _0x19a931={'LkuaC':function(_0x3b9612,_0x56e16c){return _0x3b9612>=_0x56e16c;},'XEshN':function(_0xfad7ee,_0x3b744f){return _0xfad7ee<_0x3b744f;},'ddmwO':function(_0x1d57a5,_0x3c2caa){return _0x1d57a5!==_0x3c2caa;},'RteZS':function(_0x99fe85,_0x2ca86e){return _0x99fe85===_0x2ca86e;},'Ivmfx':_0x5083(0x0),'Enmbz':_0x5083(0x1),'fAPwA':_0x5083(0x2),'rVuZF':_0x5083(0x3),'fufXB':_0x5083(0x4)};if(_0x19a931[_0x5083(0x5)](_0x45ada6[_0x5083(0x6)],0x190)&&_0x19a931[_0x5083(0x7)](_0x45ada6[_0x5083(0x6)],0x1f4)&&_0x19a931[_0x5083(0x8)](_0x45ada6[_0x5083(0x6)],0x198)&&_0x45ada6[_0x5083(0x6)]!==0x1ad)return![];if(_0x19a931['RteZS'](_0x45ada6[_0x5083(0x9)],_0x19a931[_0x5083(0xa)])||_0x45ada6['message'][_0x5083(0xb)](_0x19a931[_0x5083(0xc)])||_0x45ada6[_0x5083(0xd)][_0x5083(0xb)](_0x19a931[_0x5083(0xe)])||_0x45ada6[_0x5083(0xd)][_0x5083(0xb)](_0x19a931[_0x5083(0xf)])||_0x45ada6[_0x5083(0xd)]['includes'](_0x19a931[_0x5083(0x10)])||_0x45ada6[_0x5083(0x6)]>=0x1f4)return!![];if(_0x45ada6[_0x5083(0xd)][_0x5083(0xb)](_0x5083(0x11))||_0x45ada6['message'][_0x5083(0xb)](_0x5083(0x12)))return!![];return![];}};export async function withRetry(_0x58826a,_0x1e5242={}){const _0x5620bb={'YvQbj':function(_0x366823,_0x3e2737){return _0x366823+_0x3e2737;},'ftHjr':function(_0x3afd49,_0x37e568){return _0x3afd49===_0x37e568;},'jHGEZ':_0x5083(0x13),'HhDfG':_0x5083(0x14),'Eexgq':function(_0x203666){return _0x203666();},'bvHVs':function(_0x435b4c,_0x48ab01){return _0x435b4c>_0x48ab01;},'fYpMV':function(_0x483687,_0x2ce8f7){return _0x483687*_0x2ce8f7;},'bXQhx':function(_0x515d75,_0x23beb3){return _0x515d75-_0x23beb3;},'qSSvS':function(_0x5266cd,_0x36e190){return _0x5266cd*_0x36e190;},'WbSQH':function(_0x4ae6b3,_0x263cce){return _0x4ae6b3+_0x263cce;},'fXpSN':_0x5083(0x15),'OmPcv':_0x5083(0x16),'wukZo':function(_0x1cd281,_0x25fc72){return _0x1cd281+_0x25fc72;}},_0x426e41={...DEFAULT_RETRY_OPTIONS,..._0x1e5242},_0x45dce4=Date[_0x5083(0x17)]();let _0x340e1b=null;for(let _0xd9046d=0x1;_0xd9046d<=_0x5620bb[_0x5083(0x18)](_0x426e41[_0x5083(0x19)],0x1);_0xd9046d++){if(_0x5620bb['ftHjr'](_0x5620bb[_0x5083(0x1a)],_0x5620bb[_0x5083(0x1b)]))_0x5dcbf1['onRetry'](_0x313f8e,_0x486796,_0x269b1e);else try{_0x426e41[_0x5083(0x1c)]&&_0xd9046d>0x1&&console['log'](_0x5083(0x1d)+_0xd9046d+'/'+(_0x426e41[_0x5083(0x19)]+0x1));const _0x248d45=await _0x5620bb[_0x5083(0x1e)](_0x58826a);return{'success':!![],'data':_0x248d45,'attempts':_0xd9046d,'totalDuration':Date[_0x5083(0x17)]()-_0x45dce4};}catch(_0x4a13b5){_0x340e1b=_0x4a13b5;const _0x38ee3d=_0x426e41[_0x5083(0x1f)]?_0x426e41[_0x5083(0x1f)](_0x4a13b5,_0xd9046d):!![];if(_0x5620bb[_0x5083(0x20)](_0xd9046d,_0x426e41[_0x5083(0x19)])||!_0x38ee3d){_0x426e41[_0x5083(0x1c)]&&console[_0x5083(0x21)](_0x5083(0x22)+_0x4a13b5['message']);break;}let _0xdd2ec3=_0x426e41[_0x5083(0x23)];_0x426e41['exponentialBackoff']&&(_0xdd2ec3=Math[_0x5083(0x24)](_0x5620bb[_0x5083(0x25)](_0x426e41['baseDelay'],Math[_0x5083(0x26)](0x2,_0x5620bb[_0x5083(0x27)](_0xd9046d,0x1))),_0x426e41[_0x5083(0x28)]));const _0xe4bba5=_0x5620bb[_0x5083(0x29)](Math[_0x5083(0x2a)]()*0.1,_0xdd2ec3);_0xdd2ec3=Math[_0x5083(0x2b)](_0x5620bb['WbSQH'](_0xdd2ec3,_0xe4bba5)),_0x426e41['onRetry']&&(_0x5620bb[_0x5083(0x2c)]!==_0x5083(0x2d)?_0x426e41['onRetry'](_0x4a13b5,_0xd9046d,_0xdd2ec3):_0x1c8caf[_0x5083(0x2e)](_0x5083(0x2f)+_0x384037+_0x5083(0x30)+_0xe63736+_0x5083(0x31)+_0x16225f[_0x5083(0xd)])),_0x426e41['enableLogging']&&console[_0x5083(0x32)](_0x5083(0x33)+_0xdd2ec3+_0x5083(0x34)+_0xd9046d+'/'+_0x5620bb['WbSQH'](_0x426e41['maxRetries'],0x1)+')'),await new Promise(_0x1d376f=>setTimeout(()=>_0x1d376f(),_0xdd2ec3));}}return{'success':![],'error':_0x340e1b||new Error(_0x5620bb[_0x5083(0x35)]),'attempts':_0x5620bb[_0x5083(0x36)](_0x426e41[_0x5083(0x19)],0x1),'totalDuration':_0x5620bb[_0x5083(0x27)](Date[_0x5083(0x17)](),_0x45dce4)};}export const API_RETRY_OPTIONS={'maxRetries':0x3,'baseDelay':0x3e8,'maxDelay':0x1388,'exponentialBackoff':!![],'shouldRetry':(_0x720815,_0x30b3f)=>{const _0x36cc92={'jWVfR':function(_0x40cef4,_0x57823d){return _0x40cef4*_0x57823d;},'rHnrI':function(_0x207361,_0x52a9a8){return _0x207361-_0x52a9a8;},'SgbBZ':function(_0x48f5d7,_0x572ab6){return _0x48f5d7===_0x572ab6;},'dHGVh':_0x5083(0x37),'VOaTl':function(_0x209061,_0x390c7f){return _0x209061===_0x390c7f;},'VPvGy':_0x5083(0x38),'lXglG':'SFkEI','qFUhV':function(_0x5debd7,_0x408d57){return _0x5debd7>=_0x408d57;},'UdfhQ':_0x5083(0x0),'KgxCG':_0x5083(0x4),'HBuKB':_0x5083(0x1),'SErZb':'ENOTFOUND','NGHog':_0x5083(0x11),'ZdvhX':function(_0x2d0fd1,_0x405e19){return _0x2d0fd1!==_0x405e19;},'RUddC':_0x5083(0x39),'PmeJl':_0x5083(0x3a)};if(_0x36cc92[_0x5083(0x3b)](_0x720815[_0x5083(0x6)],0x191)||_0x36cc92[_0x5083(0x3b)](_0x720815[_0x5083(0x6)],0x193))return![];if(_0x720815[_0x5083(0x6)]===0x190||_0x36cc92[_0x5083(0x3b)](_0x720815[_0x5083(0x6)],0x194)&&!_0x720815['message'][_0x5083(0xb)](_0x36cc92['dHGVh']))return![];if(_0x36cc92[_0x5083(0x3c)](_0x720815[_0x5083(0x6)],0x1ad)){if(_0x36cc92[_0x5083(0x3d)]===_0x36cc92[_0x5083(0x3e)])_0x2913f2=_0x28f93a['min'](_0x36cc92[_0x5083(0x3f)](_0x526d79['baseDelay'],_0x2d92b3['pow'](0x2,_0x36cc92[_0x5083(0x40)](_0x18e567,0x1))),_0x346242[_0x5083(0x28)]);else return _0x30b3f<=0x2;}if(_0x36cc92[_0x5083(0x41)](_0x720815[_0x5083(0x6)],0x1f4))return!![];if(_0x36cc92['VOaTl'](_0x720815['name'],_0x36cc92['UdfhQ'])||_0x720815[_0x5083(0xd)][_0x5083(0xb)](_0x36cc92[_0x5083(0x42)])||_0x720815[_0x5083(0xd)][_0x5083(0xb)](_0x36cc92[_0x5083(0x43)])||_0x720815['message']['includes'](_0x5083(0x2))||_0x720815[_0x5083(0xd)]['includes'](_0x36cc92[_0x5083(0x44)]))return!![];if(_0x720815['message']['includes'](_0x36cc92[_0x5083(0x45)])||_0x720815[_0x5083(0xd)][_0x5083(0xb)](_0x5083(0x12))||_0x720815[_0x5083(0xd)][_0x5083(0xb)](_0x5083(0x46)))return _0x36cc92[_0x5083(0x47)](_0x36cc92[_0x5083(0x48)],_0x36cc92[_0x5083(0x49)])?!![]:!![];return![];},'onRetry':(_0x23d56b,_0x119f96,_0x1ad09b)=>{console[_0x5083(0x2e)](_0x5083(0x2f)+_0x119f96+'),\x20retrying\x20in\x20'+_0x1ad09b+_0x5083(0x31)+_0x23d56b[_0x5083(0xd)]);}};function _0x45bd(){const _0x5c880f=['AbortError','Network\x20request\x20failed','fetch','ENOTFOUND','timeout','LkuaC','status','XEshN','ddmwO','name','Ivmfx','includes','Enmbz','message','fAPwA','rVuZF','fufXB','JSON\x20Parse\x20error','Unexpected\x20character','bekag','DgWSf','Pwzan','Unknown\x20error','now','YvQbj','maxRetries','jHGEZ','HhDfG','enableLogging','🔄\x20Retry\x20attempt\x20','Eexgq','shouldRetry','bvHVs','error','❌\x20All\x20retry\x20attempts\x20exhausted\x20or\x20error\x20not\x20retryable:\x20','baseDelay','min','fYpMV','pow','bXQhx','maxDelay','qSSvS','random','floor','fXpSN','adxAc','warn','⚠️\x20API\x20call\x20failed\x20(attempt\x20','),\x20retrying\x20in\x20','ms:\x20','log','⏳\x20Waiting\x20','ms\x20before\x20retry\x20(attempt\x20','OmPcv','wukZo','validation\x20endpoint','LxFKK','NHEdk','jjRTe','SgbBZ','VOaTl','VPvGy','lXglG','jWVfR','rHnrI','qFUhV','KgxCG','HBuKB','SErZb','NGHog','HTML\x20page\x20instead\x20of\x20JSON','ZdvhX','RUddC','PmeJl','MVVed','DNS','uxoUK','tPbhV','isuoR','data','lkBKZ','OnairosReactNative/HealthCheck','gOXDi','QeZBy','YglgH','abort','signal','DerPq','IGzqc','rEPxJ','Fbeba'];_0x45bd=function(){return _0x5c880f;};return _0x45bd();}export const NETWORK_RETRY_OPTIONS={'maxRetries':0x2,'baseDelay':0x7d0,'maxDelay':0x1f40,'exponentialBackoff':!![],'shouldRetry':(_0x11bd5b,_0x33436b)=>{const _0x43f000={'PzQEx':_0x5083(0x1),'MVVed':_0x5083(0x3),'uxoUK':function(_0x5d49f6,_0x2aa283){return _0x5d49f6===_0x2aa283;},'tPbhV':'AbortError'};return _0x11bd5b[_0x5083(0xd)][_0x5083(0xb)](_0x43f000['PzQEx'])||_0x11bd5b[_0x5083(0xd)][_0x5083(0xb)](_0x43f000[_0x5083(0x4a)])||_0x11bd5b['message'][_0x5083(0xb)](_0x5083(0x4b))||_0x43f000[_0x5083(0x4c)](_0x11bd5b['name'],_0x43f000[_0x5083(0x4d)]);}};function _0x5083(_0x45bda2,_0x508355){_0x45bda2=_0x45bda2-0x0;const _0x2e268e=_0x45bd();let _0x4d4ce8=_0x2e268e[_0x45bda2];return _0x4d4ce8;}export async function fetchWithRetry(_0x951ed6,_0x5c3efb={},_0x22480a=API_RETRY_OPTIONS){const _0x134872={'isuoR':function(_0x431d28,_0x35d42d,_0x18b5d5){return _0x431d28(_0x35d42d,_0x18b5d5);}},_0x315a15=await _0x134872[_0x5083(0x4e)](withRetry,()=>fetch(_0x951ed6,_0x5c3efb),_0x22480a);if(!_0x315a15['success'])throw _0x315a15[_0x5083(0x21)];return _0x315a15[_0x5083(0x4f)];}export async function healthCheck(_0x1753b0,_0x1f28b0=0x1388){const _0x273bf6={'gOXDi':function(_0x6d056,_0x21538b){return _0x6d056===_0x21538b;},'QeZBy':_0x5083(0x50),'YglgH':function(_0x3057a9,_0x662ca2,_0x23f346){return _0x3057a9(_0x662ca2,_0x23f346);},'DerPq':_0x5083(0x51),'IGzqc':function(_0x446aef,_0x4cf08b){return _0x446aef(_0x4cf08b);},'rEPxJ':function(_0x3ba8a4,_0x2c9d0f){return _0x3ba8a4-_0x2c9d0f;},'Fbeba':function(_0x398c2a,_0xe6d82f){return _0x398c2a-_0xe6d82f;}},_0x309fe9=Date[_0x5083(0x17)]();try{if(_0x273bf6[_0x5083(0x52)](_0x273bf6['QeZBy'],_0x273bf6[_0x5083(0x53)])){const _0x3078b5=new AbortController(),_0x5d0498=_0x273bf6[_0x5083(0x54)](setTimeout,()=>_0x3078b5[_0x5083(0x55)](),_0x1f28b0),_0x288542=await _0x273bf6['YglgH'](fetch,_0x1753b0,{'method':'GET','signal':_0x3078b5[_0x5083(0x56)],'headers':{'User-Agent':_0x273bf6[_0x5083(0x57)]}});return _0x273bf6[_0x5083(0x58)](clearTimeout,_0x5d0498),{'reachable':!![],'status':_0x288542[_0x5083(0x6)],'duration':_0x273bf6[_0x5083(0x59)](Date[_0x5083(0x17)](),_0x309fe9)};}else _0x1125bf[_0x5083(0x32)](_0x5083(0x33)+_0x498d37+_0x5083(0x34)+_0x5ad18f+'/'+(_0x3d1bd5[_0x5083(0x19)]+0x1)+')');}catch(_0x222c8c){return{'reachable':![],'error':_0x222c8c[_0x5083(0xd)],'duration':_0x273bf6[_0x5083(0x5a)](Date[_0x5083(0x17)](),_0x309fe9)};}}
|
|
@@ -1,331 +1,7 @@
|
|
|
1
|
-
import { Platform } from 'react-native';
|
|
2
|
-
import { STORAGE_KEYS } from '../constants';
|
|
3
|
-
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
4
1
|
|
|
5
|
-
//
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|
|
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';function _0x102a(_0x5baebb,_0x102a09){_0x5baebb=_0x5baebb-0x0;const _0x3c6955=_0x5bae();let _0x410d76=_0x3c6955[_0x5baebb];return _0x410d76;}function _0x5bae(){const _0x2589ac=['onairos_jwt_token','warn','mock','default','xUPZi','bWzHg','nEcCW','function','tOgOV','FLGKi','czXoa','service','mvbXb','getGenericPassword','bdNIV','XPQYK','Keychain\x20access\x20failed,\x20using\x20mock\x20storage','lzsqT','AZIuR','Qtpud','ZqdlD','YtZuP','UqaVM','MGMIh','random','toString','substring','dev_','seFdV','gyIfI','yQKsH','GHmFy','Error\x20deleting\x20credentials:','kMvCj','NTDyJ','YRFbt','SmYrO','MZJbL','ifJJP','eOrqV','error','eJgns','BYrVy','ZauAm','DEwLg','length','ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/','ySbCy','charAt','indexOf','yzvYr','wKzxc','GJaXb','KYzVV','fromCharCode','rgZeZ','mYHQd','yDnlR','UJarX','hOuso','wtQaa','ximyJ','GtiJK','dZHho','Error\x20storing\x20credentials:','HKyCW','ThfOB','createdAt','now','xDjRl','accessControl','ACCESS_CONTROL','BIOMETRY_ANY_OR_DEVICE_PASSCODE','accessible','ACCESSIBLE','WHEN_UNLOCKED','web','ECflH','rtwBD','❌\x20Failed\x20to\x20clear\x20JWT\x20token:','cTgIL','stringify','qmoiy','fNhfE','cAxXt','PQxTQ','kPlul','mgTck','lOoVQ','lJQnq','axYyA','WtzDS','JWBce','HPRxB','YmWXy','parse','BwSDL','rmzpw','Error\x20getting\x20credentials:','bYkdy','YPkkt','Error\x20checking\x20credentials:','ppodA','CLYgT','XhTOu','❌\x20Failed\x20to\x20retrieve\x20JWT\x20token:','eiCJp','cwLxj','cZWoB','credentials','PcjCj','NRimd','lIPYx','ItLnF','BmZGe','AKvIK','vBPXp','aNjYu','❌\x20Failed\x20to\x20check\x20JWT\x20token:','getItem','fVuWS','numHl','RirVy','tQNtG','removeItem','log','UjOaH','kMTeH','jJyPT','rSici','viqqY','Diblr','KFKOM','ACeey','PdLVk','pMlAR','paYOi','VrQbx','LatVX','❌\x20Failed\x20to\x20decode\x20JWT\x20payload:','cPkBs','split','pBcKt','kNOUd','KuQoJ','❌\x20Failed\x20to\x20check\x20JWT\x20expiration:','RIIVT','sLIoJ','BXBlW','exp','floor','FuyjF','BlReN'];_0x5bae=function(){return _0x2589ac;};return _0x5bae();}import AsyncStorage from'@react-native-async-storage/async-storage';const JWT_TOKEN_KEY=_0x102a(0x0),mockStorage={};let Keychain=null;try{Keychain=__ONAIROS_REQ_FUNC__(0x0);}catch(_0x1675d5){console[_0x102a(0x1)]('react-native-keychain module not available, using mock storage'),Keychain={'ACCESS_CONTROL':{'BIOMETRY_ANY_OR_DEVICE_PASSCODE':_0x102a(0x2)},'ACCESSIBLE':{'WHEN_UNLOCKED':'mock'},'getGenericPassword':async()=>null,'setGenericPassword':async()=>!![],'resetGenericPassword':async()=>!![]};}const isKeychainAvailable=()=>{const _0x46efe3={'FLGKi':function(_0xf62df5,_0x1b6072){return _0xf62df5===_0x1b6072;},'czXoa':function(_0x4a144f,_0x4692e8){return _0x4a144f===_0x4692e8;},'mvbXb':_0x102a(0x3),'nEcCW':function(_0x546812,_0x52b9b9){return _0x546812===_0x52b9b9;},'tOgOV':_0x102a(0x4),'DQdCO':_0x102a(0x5)};try{return Keychain&&_0x46efe3[_0x102a(0x6)](typeof Keychain['getGenericPassword'],_0x102a(0x7));}catch(_0x4ef598){if(_0x46efe3[_0x102a(0x6)](_0x46efe3[_0x102a(0x8)],_0x46efe3['DQdCO'])){const _0x1ed037=(_0x46efe3[_0x102a(0x9)](_0x1ab855,null)||_0x46efe3[_0x102a(0xa)](_0x392c4f,void 0x0)?void 0x0:_0x8c9e89[_0x102a(0xb)])||_0x46efe3[_0x102a(0xc)];return _0x4b6ade[_0x1ed037]||null;}else return![];}},safeGetGenericPassword=async _0x5b4f6c=>{const _0x1cc1d3={'bdNIV':function(_0x3ddc0e,_0x32f89e){return _0x3ddc0e===_0x32f89e;},'OwieJ':function(_0x103f47,_0x59e050){return _0x103f47===_0x59e050;},'XPQYK':_0x102a(0x3)};try{if(isKeychainAvailable())return await Keychain[_0x102a(0xd)](_0x5b4f6c);else{const _0xe130bd=(_0x1cc1d3[_0x102a(0xe)](_0x5b4f6c,null)||_0x1cc1d3['OwieJ'](_0x5b4f6c,void 0x0)?void 0x0:_0x5b4f6c[_0x102a(0xb)])||_0x1cc1d3[_0x102a(0xf)];return mockStorage[_0xe130bd]||null;}}catch(_0x55270b){console['warn'](_0x102a(0x10),_0x55270b);const _0x5a7016=(_0x5b4f6c===null||_0x1cc1d3['bdNIV'](_0x5b4f6c,void 0x0)?void 0x0:_0x5b4f6c['service'])||_0x1cc1d3[_0x102a(0xf)];return mockStorage[_0x5a7016]||null;}},safeSetGenericPassword=async(_0x3e1e9b,_0x1ac0b6,_0x4f465e)=>{const _0x353431={'YtZuP':_0x102a(0x3),'QHqju':function(_0x48cd66){return _0x48cd66();},'nqsoI':function(_0x896213,_0x4926d1){return _0x896213===_0x4926d1;},'Qtpud':_0x102a(0x11),'UqaVM':function(_0xbb93f8,_0x29f3c4){return _0xbb93f8===_0x29f3c4;},'MGMIh':_0x102a(0x12),'ngFDT':function(_0x184095,_0x3329e2){return _0x184095===_0x3329e2;},'seFdV':function(_0x3a0b3b,_0x542d0f){return _0x3a0b3b!==_0x542d0f;},'gyIfI':'yQKsH','GHmFy':_0x102a(0x10),'cLvKW':function(_0x247346,_0x45b21c){return _0x247346===_0x45b21c;}};try{if(_0x353431['QHqju'](isKeychainAvailable)){if(_0x353431['nqsoI'](_0x353431[_0x102a(0x13)],_0x102a(0x14))){const _0x337efc=(_0x5635bc===null||_0x27443c===void 0x0?void 0x0:_0x12d3e5[_0x102a(0xb)])||_0x353431[_0x102a(0x15)];return delete _0x4ec3bc[_0x337efc],!![];}else return await Keychain['setGenericPassword'](_0x3e1e9b,_0x1ac0b6,_0x4f465e);}else{if(_0x353431[_0x102a(0x16)](_0x353431['MGMIh'],_0x353431[_0x102a(0x17)])){const _0x1a9dbd=(_0x4f465e===null||_0x353431['ngFDT'](_0x4f465e,void 0x0)?void 0x0:_0x4f465e['service'])||_0x102a(0x3);return mockStorage[_0x1a9dbd]={'username':_0x3e1e9b,'password':_0x1ac0b6},!![];}else{const _0x2e9f9f=_0x153bdd[_0x102a(0x18)]()[_0x102a(0x19)](0x24)[_0x102a(0x1a)](0x2,0xa);return _0x102a(0x1b)+_0x2e9f9f;}}}catch(_0x10972b){if(_0x353431[_0x102a(0x1c)](_0x353431[_0x102a(0x1d)],_0x102a(0x1e)))return _0x8bb0f(_0x4941e4);else{console[_0x102a(0x1)](_0x353431[_0x102a(0x1f)],_0x10972b);const _0x312aee=(_0x353431['cLvKW'](_0x4f465e,null)||_0x4f465e===void 0x0?void 0x0:_0x4f465e['service'])||_0x102a(0x3);return mockStorage[_0x312aee]={'username':_0x3e1e9b,'password':_0x1ac0b6},!![];}}},safeResetGenericPassword=async _0x32a95c=>{const _0xa92938={'eJgns':_0x102a(0x20),'DEwLg':function(_0x3f8c75,_0x49092a){return _0x3f8c75%_0x49092a;},'ySbCy':function(_0x32478e,_0x8011e4){return _0x32478e<_0x8011e4;},'yzvYr':function(_0x1dc1a4,_0x3c515a){return _0x1dc1a4+_0x3c515a;},'wKzxc':function(_0x2aa8c6,_0x462640){return _0x2aa8c6|_0x462640;},'GJaXb':function(_0x3434de,_0x1405d9){return _0x3434de|_0x1405d9;},'KYzVV':function(_0x4f5f4e,_0x3b5cf6){return _0x4f5f4e<<_0x3b5cf6;},'rgZeZ':function(_0x460e67,_0x50e0ab){return _0x460e67&_0x50e0ab;},'mYHQd':function(_0x2e09ef,_0xcad491){return _0x2e09ef>>_0xcad491;},'yDnlR':function(_0x5f14e5,_0x4c65d5){return _0x5f14e5!==_0x4c65d5;},'yTHXj':function(_0x2475e6,_0x175991){return _0x2475e6>>_0x175991;},'UJarX':function(_0x53408,_0x1b3f80){return _0x53408&_0x1b3f80;},'MZJbL':function(_0x5d99cc,_0x126aa8){return _0x5d99cc===_0x126aa8;},'ifJJP':_0x102a(0x21),'eOrqV':_0x102a(0x22),'BYrVy':function(_0x8f85e8){return _0x8f85e8();},'DnKfz':function(_0x3dacb6,_0x5e6705){return _0x3dacb6===_0x5e6705;},'ZauAm':_0x102a(0x23),'RUMpP':_0x102a(0x24),'AUyPv':function(_0x52a249,_0x39ed30){return _0x52a249===_0x39ed30;},'hOuso':'default','wtQaa':_0x102a(0x10),'ximyJ':function(_0x3ed6cf,_0x7d91ea){return _0x3ed6cf===_0x7d91ea;}};try{if(_0xa92938[_0x102a(0x25)](_0xa92938[_0x102a(0x26)],_0xa92938[_0x102a(0x27)]))return _0x15e261[_0x102a(0x28)](_0xa92938[_0x102a(0x29)],_0x3ca461),![];else{if(_0xa92938[_0x102a(0x2a)](isKeychainAvailable))return await Keychain['resetGenericPassword'](_0x32a95c);else{if(_0xa92938['DnKfz'](_0xa92938[_0x102a(0x2b)],_0xa92938['RUMpP'])){while(_0xa92938[_0x102a(0x2c)](_0x244c61[_0x102a(0x2d)],0x4)){_0x144e6a+='=';}const _0x3ff91d=_0x102a(0x2e);let _0x5ebbee='';for(let _0x17e4be=0x0;_0xa92938[_0x102a(0x2f)](_0x17e4be,_0x1aecaa[_0x102a(0x2d)]);_0x17e4be+=0x4){const _0x5ec75f=_0x3ff91d['indexOf'](_0x47c33d[_0x102a(0x30)](_0x17e4be)),_0x1f2eb8=_0x3ff91d[_0x102a(0x31)](_0x334499['charAt'](_0xa92938[_0x102a(0x32)](_0x17e4be,0x1))),_0x451d14=_0x3ff91d[_0x102a(0x31)](_0x4d641a[_0x102a(0x30)](_0xa92938['yzvYr'](_0x17e4be,0x2))),_0x325801=_0x3ff91d[_0x102a(0x31)](_0x59c6ea['charAt'](_0xa92938[_0x102a(0x32)](_0x17e4be,0x3))),_0x103e5f=_0xa92938[_0x102a(0x33)](_0xa92938[_0x102a(0x34)](_0x5ec75f<<0x12,_0xa92938['KYzVV'](_0x1f2eb8,0xc))|_0xa92938[_0x102a(0x35)](_0x451d14,0x6),_0x325801);_0x5ebbee+=_0x3c83e8[_0x102a(0x36)](_0xa92938[_0x102a(0x37)](_0xa92938[_0x102a(0x38)](_0x103e5f,0x10),0xff));if(_0xa92938[_0x102a(0x39)](_0x451d14,0x40))_0x5ebbee+=_0x20cc9c[_0x102a(0x36)](_0xa92938['yTHXj'](_0x103e5f,0x8)&0xff);if(_0xa92938[_0x102a(0x39)](_0x325801,0x40))_0x5ebbee+=_0x1c254c['fromCharCode'](_0xa92938[_0x102a(0x3a)](_0x103e5f,0xff));}return _0x5ebbee;}else{const _0x20466f=(_0xa92938['AUyPv'](_0x32a95c,null)||_0x32a95c===void 0x0?void 0x0:_0x32a95c[_0x102a(0xb)])||_0xa92938[_0x102a(0x3b)];return delete mockStorage[_0x20466f],!![];}}}}catch(_0x206790){console[_0x102a(0x1)](_0xa92938[_0x102a(0x3c)],_0x206790);const _0x3b6452=(_0xa92938[_0x102a(0x3d)](_0x32a95c,null)||_0x32a95c===void 0x0?void 0x0:_0x32a95c[_0x102a(0xb)])||_0xa92938['hOuso'];return delete mockStorage[_0x3b6452],!![];}};export const storeCredentials=async _0x501239=>{const _0xc535fc={'cAxXt':function(_0x5720b7,_0x2cbf11){return _0x5720b7+_0x2cbf11;},'PQxTQ':function(_0x5084a8,_0x3bc86f){return _0x5084a8+_0x3bc86f;},'kPlul':function(_0x56403b,_0x22503b){return _0x56403b|_0x22503b;},'mgTck':function(_0x536d97,_0x7fce2f){return _0x536d97<<_0x7fce2f;},'lOoVQ':function(_0x30879e,_0x422afd){return _0x30879e&_0x422afd;},'lJQnq':function(_0x14125f,_0x3d77d2){return _0x14125f>>_0x3d77d2;},'axYyA':function(_0x1f7255,_0x2e158b){return _0x1f7255!==_0x2e158b;},'HKyCW':function(_0x6507be){return _0x6507be();},'ThfOB':function(_0x4d2ade,_0x416397){return _0x4d2ade===_0x416397;},'rtwBD':_0x102a(0x3e),'cTgIL':function(_0xe8d5f5,_0x1cf187,_0x53aaec,_0x13254b){return _0xe8d5f5(_0x1cf187,_0x53aaec,_0x13254b);},'qmoiy':'oWmiN','XGDwD':_0x102a(0x3f),'fNhfE':_0x102a(0x40)};try{const _0x474021=await _0xc535fc[_0x102a(0x41)](getCredentials),_0x451662={..._0x474021,..._0x501239,'createdAt':(_0x474021===null||_0xc535fc[_0x102a(0x42)](_0x474021,void 0x0)?void 0x0:_0x474021[_0x102a(0x43)])||Date[_0x102a(0x44)]()},_0x4b3050=_0x451662['username'];if(!_0x4b3050){if('xDjRl'===_0x102a(0x45))throw new Error('Username\x20is\x20required\x20for\x20storing\x20credentials');else _0x3dd046[_0x102a(0x46)]=Keychain[_0x102a(0x47)][_0x102a(0x48)],_0x16fc86[_0x102a(0x49)]=Keychain[_0x102a(0x4a)][_0x102a(0x4b)];}const _0x52dcc4={'service':STORAGE_KEYS['credentials']};if(Platform['OS']!==_0x102a(0x4c)&&_0xc535fc[_0x102a(0x41)](isKeychainAvailable)){if(_0x102a(0x4d)===_0xc535fc[_0x102a(0x4e)])return _0x4a380b[_0x102a(0x28)](_0x102a(0x4f),_0x48aa85),![];else _0x52dcc4['accessControl']=Keychain['ACCESS_CONTROL'][_0x102a(0x48)],_0x52dcc4[_0x102a(0x49)]=Keychain[_0x102a(0x4a)][_0x102a(0x4b)];}return await _0xc535fc[_0x102a(0x50)](safeSetGenericPassword,_0x4b3050,JSON[_0x102a(0x51)](_0x451662),_0x52dcc4),!![];}catch(_0x2a49d3){if(_0xc535fc[_0x102a(0x52)]!==_0xc535fc['XGDwD'])return console[_0x102a(0x28)](_0xc535fc[_0x102a(0x53)],_0x2a49d3),![];else{const _0x133927=_0x6523b2[_0x102a(0x31)](_0x51f6cb['charAt'](_0x2fb0e5)),_0x2cbcd2=_0x24ad7f[_0x102a(0x31)](_0x194066[_0x102a(0x30)](_0xc535fc['cAxXt'](_0x1d13e2,0x1))),_0x53a96d=_0x220dd3[_0x102a(0x31)](_0x19c2b8['charAt'](_0xc535fc[_0x102a(0x54)](_0x27b137,0x2))),_0x1d8b7f=_0x1c7ed5[_0x102a(0x31)](_0x299c24[_0x102a(0x30)](_0xc535fc[_0x102a(0x55)](_0x2d55e8,0x3))),_0x1a2db4=_0xc535fc[_0x102a(0x56)](_0x133927<<0x12|_0x2cbcd2<<0xc|_0xc535fc[_0x102a(0x57)](_0x53a96d,0x6),_0x1d8b7f);_0x1fb532+=_0x133905[_0x102a(0x36)](_0xc535fc[_0x102a(0x58)](_0xc535fc[_0x102a(0x59)](_0x1a2db4,0x10),0xff));if(_0xc535fc[_0x102a(0x5a)](_0x53a96d,0x40))_0x5eaeb0+=_0x3f8b1f[_0x102a(0x36)](_0x1a2db4>>0x8&0xff);if(_0x1d8b7f!==0x40)_0x41ed4a+=_0x393792[_0x102a(0x36)](_0xc535fc[_0x102a(0x58)](_0x1a2db4,0xff));}}};export const getCredentials=async()=>{const _0xdabc83={'bYkdy':_0x102a(0x10),'CvjTo':function(_0x2819e3,_0x4f7479){return _0x2819e3===_0x4f7479;},'YPkkt':function(_0x13be5a,_0x593fc6){return _0x13be5a===_0x593fc6;},'HPRxB':function(_0x33ce07,_0x47b221){return _0x33ce07(_0x47b221);},'YmWXy':function(_0x34a708,_0x58cac2){return _0x34a708!==_0x58cac2;},'UZfrs':_0x102a(0x5b),'BwSDL':'xyeQR','rmzpw':_0x102a(0x5c)};try{const _0x12a59b=await _0xdabc83[_0x102a(0x5d)](safeGetGenericPassword,{'service':STORAGE_KEYS['credentials']});if(_0x12a59b){if(_0xdabc83[_0x102a(0x5e)](_0xdabc83['UZfrs'],_0xdabc83['UZfrs']))_0x52499b+='=';else return JSON[_0x102a(0x5f)](_0x12a59b['password']);}return null;}catch(_0x237304){if(_0xdabc83[_0x102a(0x5e)](_0xdabc83[_0x102a(0x60)],_0xdabc83[_0x102a(0x61)]))return console[_0x102a(0x28)](_0x102a(0x62),_0x237304),null;else{_0x4ddeaa[_0x102a(0x1)](_0xdabc83[_0x102a(0x63)],_0x2a667b);const _0xc54348=(_0xdabc83['CvjTo'](_0x813235,null)||_0xdabc83[_0x102a(0x64)](_0x2123c4,void 0x0)?void 0x0:_0x2cdc7f[_0x102a(0xb)])||_0x102a(0x3);return _0x26d05f[_0xc54348]={'username':_0x59f2af,'password':_0x2bf6bc},!![];}}};export const hasCredentials=async()=>{const _0x57603a={'ppodA':'Error\x20verifying\x20credentials:','NUeey':'JXYge','CLYgT':function(_0x17c270,_0x56018b){return _0x17c270(_0x56018b);},'XhTOu':_0x102a(0x65)};try{if(_0x57603a['NUeey']!==_0x57603a['NUeey'])try{if(!_0x3d5fe6())return!![];return!![];}catch(_0x1c8afc){return _0x590fcb[_0x102a(0x28)](_0x57603a[_0x102a(0x66)],_0x1c8afc),![];}else{const _0x57b91b=await _0x57603a[_0x102a(0x67)](safeGetGenericPassword,{'service':STORAGE_KEYS['credentials']});return!!_0x57b91b;}}catch(_0x334417){return console['error'](_0x57603a[_0x102a(0x68)],_0x334417),![];}};export const deleteCredentials=async()=>{const _0x51868f={'cZWoB':_0x102a(0x69),'Nmlqm':function(_0x1beb7d,_0x52593b){return _0x1beb7d===_0x52593b;},'tTOxG':_0x102a(0x6a),'fHYBv':_0x102a(0x6b),'PcjCj':_0x102a(0x20)};try{return _0x51868f['Nmlqm'](_0x51868f['tTOxG'],_0x51868f['fHYBv'])?(_0x41b825[_0x102a(0x28)](_0x51868f[_0x102a(0x6c)],_0x374c6d),null):(await safeResetGenericPassword({'service':STORAGE_KEYS[_0x102a(0x6d)]}),!![]);}catch(_0x165fed){return console['error'](_0x51868f[_0x102a(0x6e)],_0x165fed),![];}};export const updateCredentials=async _0x5d15a0=>{const _0x450bb5={'NRimd':function(_0x28557f,_0x4b2d37){return _0x28557f(_0x4b2d37);}};return _0x450bb5[_0x102a(0x6f)](storeCredentials,_0x5d15a0);};export const generateDeviceUsername=()=>{const _0x3964c2=Math[_0x102a(0x18)]()[_0x102a(0x19)](0x24)[_0x102a(0x1a)](0x2,0xa);return _0x102a(0x1b)+_0x3964c2;};export const verifyCredentials=async _0x3165b8=>{const _0x281907={'ItLnF':function(_0x2b11be,_0x5b6115){return _0x2b11be===_0x5b6115;},'BmZGe':'default','WMQJg':_0x102a(0x10),'ZJFkA':function(_0x4d9413,_0x4db6dd){return _0x4d9413===_0x4db6dd;},'VKNLo':_0x102a(0x70),'MDWZA':function(_0x2a9608){return _0x2a9608();},'AKvIK':function(_0x2fb2d7,_0x28f963){return _0x2fb2d7!==_0x28f963;}};try{if(_0x281907[_0x102a(0x71)](_0x281907['VKNLo'],_0x281907['VKNLo'])){if(!_0x281907['MDWZA'](isKeychainAvailable))return!![];return!![];}else{const _0x3f7b66=(_0x281907[_0x102a(0x71)](_0xcd9e38,null)||_0x281907[_0x102a(0x71)](_0x1562a8,void 0x0)?void 0x0:_0x30b9fa[_0x102a(0xb)])||_0x281907[_0x102a(0x72)];return _0x3e945d[_0x3f7b66]={'username':_0x23ff30,'password':_0x363c0f},!![];}}catch(_0x283bb0){if(_0x281907[_0x102a(0x73)](_0x102a(0x74),_0x102a(0x74))){_0x3933ba[_0x102a(0x1)](_0x281907['WMQJg'],_0x43fcfe);const _0x34856d=(_0x281907['ZJFkA'](_0x48a2d6,null)||_0xba795a===void 0x0?void 0x0:_0xa8db58[_0x102a(0xb)])||_0x102a(0x3);return delete _0x5084e2[_0x34856d],!![];}else return console[_0x102a(0x28)]('Error\x20verifying\x20credentials:',_0x283bb0),![];}};export const getJWT=async()=>{const _0x38ac60={'aNjYu':'❌\x20Failed\x20to\x20retrieve\x20JWT\x20token:'};try{const _0x2b322e=await AsyncStorage['getItem'](JWT_TOKEN_KEY);return _0x2b322e;}catch(_0x16cd63){return console[_0x102a(0x28)](_0x38ac60[_0x102a(0x75)],_0x16cd63),null;}};export const hasJWT=async()=>{const _0x1c09b3={'TACbU':_0x102a(0x2),'fVuWS':function(_0x3043ba,_0x36eac4){return _0x3043ba===_0x36eac4;},'ZUtgp':'axhyO','numHl':_0x102a(0x76)};try{const _0x422360=await AsyncStorage[_0x102a(0x77)](JWT_TOKEN_KEY);return!!_0x422360;}catch(_0x7092a0){if(_0x1c09b3[_0x102a(0x78)](_0x1c09b3['ZUtgp'],_0x1c09b3['ZUtgp']))return console[_0x102a(0x28)](_0x1c09b3[_0x102a(0x79)],_0x7092a0),![];else _0x596314[_0x102a(0x1)]('react-native-keychain module not available, using mock storage'),Keychain={'ACCESS_CONTROL':{'BIOMETRY_ANY_OR_DEVICE_PASSCODE':_0x1c09b3['TACbU']},'ACCESSIBLE':{'WHEN_UNLOCKED':_0x1c09b3['TACbU']},'getGenericPassword':async()=>null,'setGenericPassword':async()=>!![],'resetGenericPassword':async()=>!![]};}};export const clearJWT=async()=>{const _0x4b4128={'kMTeH':'Error\x20storing\x20credentials:','FoOGO':function(_0x495331,_0x217dcc){return _0x495331!==_0x217dcc;},'WVnGa':_0x102a(0x7a),'tQNtG':'mGrQo','UjOaH':'🗑️\x20JWT\x20token\x20cleared','jJyPT':_0x102a(0x4f)};try{return _0x4b4128['FoOGO'](_0x4b4128['WVnGa'],_0x4b4128[_0x102a(0x7b)])?(await AsyncStorage[_0x102a(0x7c)](JWT_TOKEN_KEY),console[_0x102a(0x7d)](_0x4b4128[_0x102a(0x7e)]),!![]):(_0x553809[_0x102a(0x28)](_0x4b4128[_0x102a(0x7f)],_0x4137c6),![]);}catch(_0x3791a7){return console[_0x102a(0x28)](_0x4b4128[_0x102a(0x80)],_0x3791a7),![];}};const base64Decode=_0x29c168=>{const _0x40ab80={'KFKOM':_0x102a(0x65),'viqqY':function(_0x912deb,_0x570c52){return _0x912deb%_0x570c52;},'oOnLP':_0x102a(0x81),'ACeey':function(_0x382404,_0x7feb9c){return _0x382404<_0x7feb9c;},'PdLVk':function(_0x5de2cd,_0x512300){return _0x5de2cd+_0x512300;},'ZhbgC':function(_0x3d3816,_0x2a2499){return _0x3d3816+_0x2a2499;},'GHaKJ':function(_0x2800c4,_0x1b8e95){return _0x2800c4+_0x1b8e95;},'WtvLL':function(_0x31a6b6,_0x2b1024){return _0x31a6b6|_0x2b1024;},'qQehz':function(_0x322280,_0x5c7cb4){return _0x322280<<_0x5c7cb4;},'pMlAR':function(_0x339ae9,_0x36c71f){return _0x339ae9&_0x36c71f;},'paYOi':function(_0x2e918b,_0x3f97cd){return _0x2e918b>>_0x3f97cd;},'VrQbx':function(_0xabde92,_0x37d9d0){return _0xabde92!==_0x37d9d0;},'LatVX':function(_0x47cf04,_0xfe8a6c){return _0x47cf04&_0xfe8a6c;}};while(_0x40ab80[_0x102a(0x82)](_0x29c168[_0x102a(0x2d)],0x4)){if(_0x40ab80['oOnLP']===_0x102a(0x83))return _0x35b61a[_0x102a(0x28)](_0x40ab80[_0x102a(0x84)],_0x29cc04),![];else _0x29c168+='=';}const _0x59f0b1=_0x102a(0x2e);let _0x44a41c='';for(let _0x5e9723=0x0;_0x40ab80[_0x102a(0x85)](_0x5e9723,_0x29c168[_0x102a(0x2d)]);_0x5e9723+=0x4){const _0x3e2288=_0x59f0b1[_0x102a(0x31)](_0x29c168[_0x102a(0x30)](_0x5e9723)),_0x32fd05=_0x59f0b1[_0x102a(0x31)](_0x29c168[_0x102a(0x30)](_0x40ab80[_0x102a(0x86)](_0x5e9723,0x1))),_0x5e9be8=_0x59f0b1['indexOf'](_0x29c168[_0x102a(0x30)](_0x40ab80['ZhbgC'](_0x5e9723,0x2))),_0x440353=_0x59f0b1[_0x102a(0x31)](_0x29c168[_0x102a(0x30)](_0x40ab80['GHaKJ'](_0x5e9723,0x3))),_0x1d106c=_0x40ab80['WtvLL'](_0x40ab80['WtvLL'](_0x40ab80['qQehz'](_0x3e2288,0x12),_0x32fd05<<0xc)|_0x5e9be8<<0x6,_0x440353);_0x44a41c+=String[_0x102a(0x36)](_0x40ab80[_0x102a(0x87)](_0x40ab80[_0x102a(0x88)](_0x1d106c,0x10),0xff));if(_0x5e9be8!==0x40)_0x44a41c+=String[_0x102a(0x36)](_0x40ab80['paYOi'](_0x1d106c,0x8)&0xff);if(_0x40ab80[_0x102a(0x89)](_0x440353,0x40))_0x44a41c+=String[_0x102a(0x36)](_0x40ab80[_0x102a(0x8a)](_0x1d106c,0xff));}return _0x44a41c;};export const getJWTPayload=async()=>{const _0x3a6a48={'cPkBs':function(_0x1db045){return _0x1db045();},'pBcKt':function(_0x5c66ca,_0x3cbb49){return _0x5c66ca!==_0x3cbb49;},'kNOUd':_0x102a(0x8b)};try{const _0x20850a=await _0x3a6a48[_0x102a(0x8c)](getJWT);if(!_0x20850a)return null;const _0x56dffe=_0x20850a[_0x102a(0x8d)]('.');if(_0x3a6a48[_0x102a(0x8e)](_0x56dffe[_0x102a(0x2d)],0x3))return null;const _0x4da2af=base64Decode(_0x56dffe[0x1]),_0x30d08a=JSON[_0x102a(0x5f)](_0x4da2af);return _0x30d08a;}catch(_0x32769f){return console[_0x102a(0x28)](_0x3a6a48[_0x102a(0x8f)],_0x32769f),null;}};export const isJWTExpired=async()=>{const _0x50b42f={'RIIVT':'MXgEC','sLIoJ':_0x102a(0x90),'BXBlW':function(_0x2042e8){return _0x2042e8();},'FuyjF':function(_0x556573,_0x136c52){return _0x556573/_0x136c52;},'BlReN':_0x102a(0x91)};try{if(_0x50b42f[_0x102a(0x92)]===_0x50b42f[_0x102a(0x93)])return![];else{const _0xa2fc12=await _0x50b42f[_0x102a(0x94)](getJWTPayload);if(!_0xa2fc12||!_0xa2fc12[_0x102a(0x95)])return!![];const _0x3af581=Math[_0x102a(0x96)](_0x50b42f[_0x102a(0x97)](Date[_0x102a(0x44)](),0x3e8));return _0xa2fc12['exp']<_0x3af581;}}catch(_0x41a697){return console[_0x102a(0x28)](_0x50b42f[_0x102a(0x98)],_0x41a697),!![];}};
|