@oxyhq/services 26.0.1 → 26.0.4
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 +2 -2
- package/android/src/main/java/so/oxy/identity/OxyIdentityStore.kt +21 -127
- package/android/src/main/java/so/oxy/session/OxyBackgroundSession.kt +184 -0
- package/android/src/main/java/so/oxy/session/OxyBackgroundSessionApi.kt +162 -0
- package/android/src/main/java/so/oxy/session/OxyBackgroundSessionModule.kt +116 -0
- package/android/src/main/java/so/oxy/session/OxyBackgroundSessionStore.kt +179 -0
- package/android/src/main/java/so/oxy/session/OxyBackgroundToken.kt +61 -0
- package/android/src/main/java/so/oxy/storage/OxyEncryptedPrefs.kt +241 -0
- package/expo-module.config.json +4 -1
- package/lib/commonjs/index.js +18 -49
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/notifications/deviceNotifications.js +63 -0
- package/lib/commonjs/notifications/deviceNotifications.js.map +1 -1
- package/lib/commonjs/ui/boot/runProviderColdBoot.js +20 -64
- package/lib/commonjs/ui/boot/runProviderColdBoot.js.map +1 -1
- package/lib/commonjs/ui/components/AvatarCameraBadge.js +2 -2
- package/lib/commonjs/ui/components/AvatarCameraBadge.js.map +1 -1
- package/lib/commonjs/ui/components/FollowButton.js +4 -4
- package/lib/commonjs/ui/components/FollowButton.js.map +1 -1
- package/lib/commonjs/ui/components/OxyAccountDialogScreen.js +13 -1
- package/lib/commonjs/ui/components/OxyAccountDialogScreen.js.map +1 -1
- package/lib/commonjs/ui/components/OxyAuthChooser.js +29 -24
- package/lib/commonjs/ui/components/OxyAuthChooser.js.map +1 -1
- package/lib/commonjs/ui/components/OxyProvider.js +8 -7
- package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
- package/lib/commonjs/ui/components/OxySignInButton.js.map +1 -1
- package/lib/commonjs/ui/components/ProfileButton.js +20 -26
- package/lib/commonjs/ui/components/ProfileButton.js.map +1 -1
- package/lib/commonjs/ui/components/authChooser/AccountsMenuView.js +68 -58
- package/lib/commonjs/ui/components/authChooser/AccountsMenuView.js.map +1 -1
- package/lib/commonjs/ui/components/authChooser/types.js.map +1 -1
- package/lib/commonjs/ui/components/authChooser/useUsernameAvailability.js +2 -2
- package/lib/commonjs/ui/components/authChooser/useUsernameAvailability.js.map +1 -1
- package/lib/commonjs/ui/components/fileManagement/UploadPreview.js +2 -2
- package/lib/commonjs/ui/components/fileManagement/UploadPreview.js.map +1 -1
- package/lib/commonjs/ui/components/internal/PinInput.js +3 -1
- package/lib/commonjs/ui/components/internal/PinInput.js.map +1 -1
- package/lib/commonjs/ui/components/logo/LogoText.js +4 -4
- package/lib/commonjs/ui/components/logo/LogoText.js.map +1 -1
- package/lib/commonjs/ui/components/payment/PaymentDetailsStep.js +2 -2
- package/lib/commonjs/ui/components/payment/PaymentDetailsStep.js.map +1 -1
- package/lib/commonjs/ui/components/payment/PaymentSummaryStep.js +2 -2
- package/lib/commonjs/ui/components/payment/PaymentSummaryStep.js.map +1 -1
- package/lib/commonjs/ui/components/styles/shadow.js.map +1 -1
- package/lib/commonjs/ui/context/OxyContext.js +32 -46
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/context/commitSessionFlow.js +3 -43
- package/lib/commonjs/ui/context/commitSessionFlow.js.map +1 -1
- package/lib/commonjs/ui/context/hooks/useAuthOperations.js +15 -2
- package/lib/commonjs/ui/context/hooks/useAuthOperations.js.map +1 -1
- package/lib/commonjs/ui/context/useOxyAccountGraph.js +3 -4
- package/lib/commonjs/ui/context/useOxyAccountGraph.js.map +1 -1
- package/lib/commonjs/ui/hooks/mutations/mutationFactory.js +5 -5
- package/lib/commonjs/ui/hooks/mutations/mutationFactory.js.map +1 -1
- package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js +11 -11
- package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js.map +1 -1
- package/lib/commonjs/ui/hooks/mutations/useServicesMutations.js +9 -9
- package/lib/commonjs/ui/hooks/mutations/useServicesMutations.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/usePaymentQueries.js +3 -2
- package/lib/commonjs/ui/hooks/queries/usePaymentQueries.js.map +1 -1
- package/lib/commonjs/ui/hooks/queries/userCache.js +17 -17
- package/lib/commonjs/ui/hooks/queries/userCache.js.map +1 -1
- package/lib/commonjs/ui/hooks/useAssets.js.map +1 -1
- package/lib/commonjs/ui/hooks/useAsyncAction.js +7 -7
- package/lib/commonjs/ui/hooks/useAsyncAction.js.map +1 -1
- package/lib/commonjs/ui/hooks/useAuth.js +8 -4
- package/lib/commonjs/ui/hooks/useAuth.js.map +1 -1
- package/lib/commonjs/ui/hooks/useAvatarPicker.js +5 -5
- package/lib/commonjs/ui/hooks/useAvatarPicker.js.map +1 -1
- package/lib/commonjs/ui/hooks/useOnlineStatus.js +3 -2
- package/lib/commonjs/ui/hooks/useOnlineStatus.js.map +1 -1
- package/lib/commonjs/ui/hooks/useSessionManagement.js +0 -2
- package/lib/commonjs/ui/hooks/useSessionManagement.js.map +1 -1
- package/lib/commonjs/ui/hooks/useSettingToggle.js +4 -4
- package/lib/commonjs/ui/hooks/useSettingToggle.js.map +1 -1
- package/lib/commonjs/ui/hooks/useSurfaceHeader.js +68 -11
- package/lib/commonjs/ui/hooks/useSurfaceHeader.js.map +1 -1
- package/lib/commonjs/ui/navigation/accountDialogManager.js +2 -0
- package/lib/commonjs/ui/navigation/accountDialogManager.js.map +1 -1
- package/lib/commonjs/ui/oauth/browserAuthTransport.js +66 -64
- package/lib/commonjs/ui/oauth/browserAuthTransport.js.map +1 -1
- package/lib/commonjs/ui/oauth/oauthPopup.js +47 -0
- package/lib/commonjs/ui/oauth/oauthPopup.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountMembersScreen.js +10 -10
- package/lib/commonjs/ui/screens/AccountMembersScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js +41 -19
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountVerificationScreen.js +4 -4
- package/lib/commonjs/ui/screens/AccountVerificationScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AppInfoScreen.js +9 -9
- package/lib/commonjs/ui/screens/AppInfoScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AvatarCropScreen.js +3 -3
- package/lib/commonjs/ui/screens/AvatarCropScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ChangeAvatarScreen.js +6 -7
- package/lib/commonjs/ui/screens/ChangeAvatarScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ConnectedAppsScreen.js +4 -4
- package/lib/commonjs/ui/screens/ConnectedAppsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/CreateAccountScreen.js +46 -14
- package/lib/commonjs/ui/screens/CreateAccountScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/EditProfileFieldScreen.js +5 -5
- package/lib/commonjs/ui/screens/EditProfileFieldScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/EditProfileScreen.js +2 -3
- package/lib/commonjs/ui/screens/EditProfileScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FAQScreen.js +2 -2
- package/lib/commonjs/ui/screens/FAQScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FeedbackScreen.js +90 -89
- package/lib/commonjs/ui/screens/FeedbackScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FileManagementScreen.js +20 -20
- package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FollowersListScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FollowingListScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/HelpSupportScreen.js +7 -7
- package/lib/commonjs/ui/screens/HelpSupportScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/HistoryViewScreen.js +9 -34
- package/lib/commonjs/ui/screens/HistoryViewScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/LanguageSelectorScreen.js +3 -3
- package/lib/commonjs/ui/screens/LanguageSelectorScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/LegalDocumentsScreen.js +3 -3
- package/lib/commonjs/ui/screens/LegalDocumentsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ManageAccountScreen.js +15 -15
- package/lib/commonjs/ui/screens/ManageAccountScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js +19 -19
- package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PrivacySettingsScreen.js +15 -15
- package/lib/commonjs/ui/screens/PrivacySettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ProfileScreen.js +17 -7
- package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/SavesCollectionsScreen.js +2 -2
- package/lib/commonjs/ui/screens/SavesCollectionsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/UserListScreen.js +13 -7
- package/lib/commonjs/ui/screens/UserListScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/WelcomeNewUserScreen.js +5 -6
- package/lib/commonjs/ui/screens/WelcomeNewUserScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/fileManagement/PhotoPickerSection.js +1 -4
- package/lib/commonjs/ui/screens/fileManagement/PhotoPickerSection.js.map +1 -1
- package/lib/commonjs/ui/screens/fileManagement/hooks/useFileUploadState.js +34 -24
- package/lib/commonjs/ui/screens/fileManagement/hooks/useFileUploadState.js.map +1 -1
- package/lib/commonjs/ui/screens/trust/TrustCenterScreen.js +1 -1
- package/lib/commonjs/ui/screens/trust/TrustCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/trust/TrustLeaderboardScreen.js +3 -4
- package/lib/commonjs/ui/screens/trust/TrustLeaderboardScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/trust/TrustRewardsScreen.js +1 -1
- package/lib/commonjs/ui/screens/trust/TrustRewardsScreen.js.map +1 -1
- package/lib/commonjs/ui/session/backgroundSession.js +258 -0
- package/lib/commonjs/ui/session/backgroundSession.js.map +1 -0
- package/lib/commonjs/ui/session/index.js +7 -0
- package/lib/commonjs/ui/session/index.js.map +1 -1
- package/lib/commonjs/ui/session/useBackgroundSessionSync.js +81 -0
- package/lib/commonjs/ui/session/useBackgroundSessionSync.js.map +1 -0
- package/lib/commonjs/ui/utils/fileManagement.js +24 -24
- package/lib/commonjs/ui/utils/fileManagement.js.map +1 -1
- package/lib/commonjs/ui/utils/netConnectivity.js +28 -0
- package/lib/commonjs/ui/utils/netConnectivity.js.map +1 -0
- package/lib/commonjs/ui/utils/oauthReturn.js +19 -30
- package/lib/commonjs/ui/utils/oauthReturn.js.map +1 -1
- package/lib/commonjs/ui/utils/userUtils.js +27 -28
- package/lib/commonjs/ui/utils/userUtils.js.map +1 -1
- package/lib/module/index.js +20 -8
- package/lib/module/index.js.map +1 -1
- package/lib/module/notifications/deviceNotifications.js +62 -0
- package/lib/module/notifications/deviceNotifications.js.map +1 -1
- package/lib/module/ui/boot/runProviderColdBoot.js +21 -65
- package/lib/module/ui/boot/runProviderColdBoot.js.map +1 -1
- package/lib/module/ui/components/AvatarCameraBadge.js +1 -1
- package/lib/module/ui/components/AvatarCameraBadge.js.map +1 -1
- package/lib/module/ui/components/FollowButton.js +1 -1
- package/lib/module/ui/components/FollowButton.js.map +1 -1
- package/lib/module/ui/components/OxyAccountDialogScreen.js +13 -1
- package/lib/module/ui/components/OxyAccountDialogScreen.js.map +1 -1
- package/lib/module/ui/components/OxyAuthChooser.js +25 -20
- package/lib/module/ui/components/OxyAuthChooser.js.map +1 -1
- package/lib/module/ui/components/OxyProvider.js +7 -6
- package/lib/module/ui/components/OxyProvider.js.map +1 -1
- package/lib/module/ui/components/OxySignInButton.js.map +1 -1
- package/lib/module/ui/components/ProfileButton.js +12 -18
- package/lib/module/ui/components/ProfileButton.js.map +1 -1
- package/lib/module/ui/components/authChooser/AccountsMenuView.js +68 -58
- package/lib/module/ui/components/authChooser/AccountsMenuView.js.map +1 -1
- package/lib/module/ui/components/authChooser/types.js.map +1 -1
- package/lib/module/ui/components/authChooser/useUsernameAvailability.js +1 -1
- package/lib/module/ui/components/authChooser/useUsernameAvailability.js.map +1 -1
- package/lib/module/ui/components/fileManagement/UploadPreview.js +1 -1
- package/lib/module/ui/components/fileManagement/UploadPreview.js.map +1 -1
- package/lib/module/ui/components/internal/PinInput.js +3 -1
- package/lib/module/ui/components/internal/PinInput.js.map +1 -1
- package/lib/module/ui/components/logo/LogoText.js +4 -4
- package/lib/module/ui/components/logo/LogoText.js.map +1 -1
- package/lib/module/ui/components/payment/PaymentDetailsStep.js +1 -1
- package/lib/module/ui/components/payment/PaymentDetailsStep.js.map +1 -1
- package/lib/module/ui/components/payment/PaymentSummaryStep.js +2 -2
- package/lib/module/ui/components/payment/PaymentSummaryStep.js.map +1 -1
- package/lib/module/ui/components/styles/shadow.js.map +1 -1
- package/lib/module/ui/context/OxyContext.js +35 -49
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/context/commitSessionFlow.js +3 -42
- package/lib/module/ui/context/commitSessionFlow.js.map +1 -1
- package/lib/module/ui/context/hooks/useAuthOperations.js +15 -2
- package/lib/module/ui/context/hooks/useAuthOperations.js.map +1 -1
- package/lib/module/ui/context/useOxyAccountGraph.js +3 -4
- package/lib/module/ui/context/useOxyAccountGraph.js.map +1 -1
- package/lib/module/ui/hooks/mutations/mutationFactory.js +1 -1
- package/lib/module/ui/hooks/mutations/mutationFactory.js.map +1 -1
- package/lib/module/ui/hooks/mutations/useAccountMutations.js +1 -1
- package/lib/module/ui/hooks/mutations/useAccountMutations.js.map +1 -1
- package/lib/module/ui/hooks/mutations/useServicesMutations.js +1 -1
- package/lib/module/ui/hooks/mutations/useServicesMutations.js.map +1 -1
- package/lib/module/ui/hooks/queries/usePaymentQueries.js +3 -2
- package/lib/module/ui/hooks/queries/usePaymentQueries.js.map +1 -1
- package/lib/module/ui/hooks/queries/userCache.js +17 -17
- package/lib/module/ui/hooks/queries/userCache.js.map +1 -1
- package/lib/module/ui/hooks/useAssets.js.map +1 -1
- package/lib/module/ui/hooks/useAsyncAction.js +1 -1
- package/lib/module/ui/hooks/useAsyncAction.js.map +1 -1
- package/lib/module/ui/hooks/useAuth.js +8 -4
- package/lib/module/ui/hooks/useAuth.js.map +1 -1
- package/lib/module/ui/hooks/useAvatarPicker.js +1 -1
- package/lib/module/ui/hooks/useAvatarPicker.js.map +1 -1
- package/lib/module/ui/hooks/useOnlineStatus.js +3 -2
- package/lib/module/ui/hooks/useOnlineStatus.js.map +1 -1
- package/lib/module/ui/hooks/useSessionManagement.js +0 -2
- package/lib/module/ui/hooks/useSessionManagement.js.map +1 -1
- package/lib/module/ui/hooks/useSettingToggle.js +1 -1
- package/lib/module/ui/hooks/useSettingToggle.js.map +1 -1
- package/lib/module/ui/hooks/useSurfaceHeader.js +68 -11
- package/lib/module/ui/hooks/useSurfaceHeader.js.map +1 -1
- package/lib/module/ui/navigation/accountDialogManager.js +2 -0
- package/lib/module/ui/navigation/accountDialogManager.js.map +1 -1
- package/lib/module/ui/oauth/browserAuthTransport.js +66 -64
- package/lib/module/ui/oauth/browserAuthTransport.js.map +1 -1
- package/lib/module/ui/oauth/oauthPopup.js +48 -1
- package/lib/module/ui/oauth/oauthPopup.js.map +1 -1
- package/lib/module/ui/screens/AccountMembersScreen.js +1 -1
- package/lib/module/ui/screens/AccountMembersScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountSettingsScreen.js +37 -15
- package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/AccountVerificationScreen.js +1 -1
- package/lib/module/ui/screens/AccountVerificationScreen.js.map +1 -1
- package/lib/module/ui/screens/AppInfoScreen.js +1 -1
- package/lib/module/ui/screens/AppInfoScreen.js.map +1 -1
- package/lib/module/ui/screens/AvatarCropScreen.js +1 -1
- package/lib/module/ui/screens/AvatarCropScreen.js.map +1 -1
- package/lib/module/ui/screens/ChangeAvatarScreen.js +4 -5
- package/lib/module/ui/screens/ChangeAvatarScreen.js.map +1 -1
- package/lib/module/ui/screens/ConnectedAppsScreen.js +2 -2
- package/lib/module/ui/screens/ConnectedAppsScreen.js.map +1 -1
- package/lib/module/ui/screens/CreateAccountScreen.js +45 -13
- package/lib/module/ui/screens/CreateAccountScreen.js.map +1 -1
- package/lib/module/ui/screens/EditProfileFieldScreen.js +4 -4
- package/lib/module/ui/screens/EditProfileFieldScreen.js.map +1 -1
- package/lib/module/ui/screens/EditProfileScreen.js +3 -4
- package/lib/module/ui/screens/EditProfileScreen.js.map +1 -1
- package/lib/module/ui/screens/FAQScreen.js +1 -1
- package/lib/module/ui/screens/FAQScreen.js.map +1 -1
- package/lib/module/ui/screens/FeedbackScreen.js +94 -91
- package/lib/module/ui/screens/FeedbackScreen.js.map +1 -1
- package/lib/module/ui/screens/FileManagementScreen.js +1 -1
- package/lib/module/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/module/ui/screens/FollowersListScreen.js.map +1 -1
- package/lib/module/ui/screens/FollowingListScreen.js.map +1 -1
- package/lib/module/ui/screens/HelpSupportScreen.js +1 -1
- package/lib/module/ui/screens/HelpSupportScreen.js.map +1 -1
- package/lib/module/ui/screens/HistoryViewScreen.js +5 -30
- package/lib/module/ui/screens/HistoryViewScreen.js.map +1 -1
- package/lib/module/ui/screens/LanguageSelectorScreen.js +1 -1
- package/lib/module/ui/screens/LanguageSelectorScreen.js.map +1 -1
- package/lib/module/ui/screens/LegalDocumentsScreen.js +1 -1
- package/lib/module/ui/screens/LegalDocumentsScreen.js.map +1 -1
- package/lib/module/ui/screens/ManageAccountScreen.js +3 -3
- package/lib/module/ui/screens/ManageAccountScreen.js.map +1 -1
- package/lib/module/ui/screens/PremiumSubscriptionScreen.js +4 -4
- package/lib/module/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
- package/lib/module/ui/screens/PrivacySettingsScreen.js +11 -11
- package/lib/module/ui/screens/PrivacySettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/ProfileScreen.js +18 -8
- package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/module/ui/screens/SavesCollectionsScreen.js +1 -1
- package/lib/module/ui/screens/SavesCollectionsScreen.js.map +1 -1
- package/lib/module/ui/screens/UserListScreen.js +14 -8
- package/lib/module/ui/screens/UserListScreen.js.map +1 -1
- package/lib/module/ui/screens/WelcomeNewUserScreen.js +5 -6
- package/lib/module/ui/screens/WelcomeNewUserScreen.js.map +1 -1
- package/lib/module/ui/screens/fileManagement/PhotoPickerSection.js +1 -4
- package/lib/module/ui/screens/fileManagement/PhotoPickerSection.js.map +1 -1
- package/lib/module/ui/screens/fileManagement/hooks/useFileUploadState.js +15 -5
- package/lib/module/ui/screens/fileManagement/hooks/useFileUploadState.js.map +1 -1
- package/lib/module/ui/screens/trust/TrustCenterScreen.js +1 -1
- package/lib/module/ui/screens/trust/TrustCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/trust/TrustLeaderboardScreen.js +4 -5
- package/lib/module/ui/screens/trust/TrustLeaderboardScreen.js.map +1 -1
- package/lib/module/ui/screens/trust/TrustRewardsScreen.js +1 -1
- package/lib/module/ui/screens/trust/TrustRewardsScreen.js.map +1 -1
- package/lib/module/ui/session/backgroundSession.js +252 -0
- package/lib/module/ui/session/backgroundSession.js.map +1 -0
- package/lib/module/ui/session/index.js +1 -0
- package/lib/module/ui/session/index.js.map +1 -1
- package/lib/module/ui/session/useBackgroundSessionSync.js +76 -0
- package/lib/module/ui/session/useBackgroundSessionSync.js.map +1 -0
- package/lib/module/ui/utils/fileManagement.js +25 -25
- package/lib/module/ui/utils/fileManagement.js.map +1 -1
- package/lib/module/ui/utils/netConnectivity.js +23 -0
- package/lib/module/ui/utils/netConnectivity.js.map +1 -0
- package/lib/module/ui/utils/oauthReturn.js +20 -30
- package/lib/module/ui/utils/oauthReturn.js.map +1 -1
- package/lib/module/ui/utils/userUtils.js +27 -28
- package/lib/module/ui/utils/userUtils.js.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +1 -2
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/notifications/deviceNotifications.d.ts +51 -0
- package/lib/typescript/commonjs/notifications/deviceNotifications.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/boot/runProviderColdBoot.d.ts +11 -30
- package/lib/typescript/commonjs/ui/boot/runProviderColdBoot.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/AvatarCameraBadge.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/OxyAccountDialogScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/OxyAuthChooser.d.ts +7 -0
- package/lib/typescript/commonjs/ui/components/OxyAuthChooser.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/OxyProvider.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/OxySignInButton.d.ts +2 -1
- package/lib/typescript/commonjs/ui/components/OxySignInButton.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/ProfileButton.d.ts +3 -0
- package/lib/typescript/commonjs/ui/components/ProfileButton.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/authChooser/AccountsMenuView.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/authChooser/types.d.ts +6 -0
- package/lib/typescript/commonjs/ui/components/authChooser/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/fileManagement/UploadPreview.d.ts +1 -1
- package/lib/typescript/commonjs/ui/components/fileManagement/UploadPreview.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/internal/PinInput.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/payment/types.d.ts +6 -6
- package/lib/typescript/commonjs/ui/components/payment/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/commitSessionFlow.d.ts +0 -40
- package/lib/typescript/commonjs/ui/context/commitSessionFlow.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/hooks/useAuthOperations.d.ts +11 -2
- package/lib/typescript/commonjs/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/oxyContextTypes.d.ts +26 -7
- package/lib/typescript/commonjs/ui/context/oxyContextTypes.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/useOxyAccountGraph.d.ts +0 -1
- package/lib/typescript/commonjs/ui/context/useOxyAccountGraph.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/paymentTypes.d.ts +3 -2
- package/lib/typescript/commonjs/ui/hooks/queries/paymentTypes.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/usePaymentQueries.d.ts +3 -2
- package/lib/typescript/commonjs/ui/hooks/queries/usePaymentQueries.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/queries/userCache.d.ts +2 -2
- package/lib/typescript/commonjs/ui/hooks/queries/userCache.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useAssets.d.ts +1 -1
- package/lib/typescript/commonjs/ui/hooks/useAssets.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useAsyncAction.d.ts +2 -2
- package/lib/typescript/commonjs/ui/hooks/useAsyncAction.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useAuth.d.ts +10 -6
- package/lib/typescript/commonjs/ui/hooks/useAuth.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useOnlineStatus.d.ts +3 -2
- package/lib/typescript/commonjs/ui/hooks/useOnlineStatus.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useSessionManagement.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useSurfaceHeader.d.ts +7 -2
- package/lib/typescript/commonjs/ui/hooks/useSurfaceHeader.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/navigation/accountDialogManager.d.ts +8 -0
- package/lib/typescript/commonjs/ui/navigation/accountDialogManager.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/oauth/browserAuthTransport.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/oauth/oauthPopup.d.ts +6 -0
- package/lib/typescript/commonjs/ui/oauth/oauthPopup.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/ChangeAvatarScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/CreateAccountScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/EditProfileScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/FeedbackScreen.d.ts +2 -2
- package/lib/typescript/commonjs/ui/screens/FeedbackScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/FollowersListScreen.d.ts +3 -0
- package/lib/typescript/commonjs/ui/screens/FollowersListScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/FollowingListScreen.d.ts +3 -0
- package/lib/typescript/commonjs/ui/screens/FollowingListScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/HistoryViewScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/ManageAccountScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/PrivacySettingsScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/ProfileScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/UserListScreen.d.ts +7 -0
- package/lib/typescript/commonjs/ui/screens/UserListScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/WelcomeNewUserScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/fileManagement/hooks/useFileUploadState.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/trust/TrustLeaderboardScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/trust/trustTier.d.ts +1 -1
- package/lib/typescript/commonjs/ui/screens/trust/trustTier.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/session/backgroundSession.d.ts +42 -0
- package/lib/typescript/commonjs/ui/session/backgroundSession.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/session/index.d.ts +1 -0
- package/lib/typescript/commonjs/ui/session/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/session/useBackgroundSessionSync.d.ts +23 -0
- package/lib/typescript/commonjs/ui/session/useBackgroundSessionSync.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/types/navigation.d.ts +27 -19
- package/lib/typescript/commonjs/ui/types/navigation.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/fileManagement.d.ts +5 -5
- package/lib/typescript/commonjs/ui/utils/fileManagement.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/netConnectivity.d.ts +17 -0
- package/lib/typescript/commonjs/ui/utils/netConnectivity.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/utils/oauthReturn.d.ts +15 -12
- package/lib/typescript/commonjs/ui/utils/oauthReturn.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/userUtils.d.ts +7 -14
- package/lib/typescript/commonjs/ui/utils/userUtils.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +1 -2
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/notifications/deviceNotifications.d.ts +51 -0
- package/lib/typescript/module/notifications/deviceNotifications.d.ts.map +1 -1
- package/lib/typescript/module/ui/boot/runProviderColdBoot.d.ts +11 -30
- package/lib/typescript/module/ui/boot/runProviderColdBoot.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/AvatarCameraBadge.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/OxyAccountDialogScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/OxyAuthChooser.d.ts +7 -0
- package/lib/typescript/module/ui/components/OxyAuthChooser.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/OxyProvider.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/OxySignInButton.d.ts +2 -1
- package/lib/typescript/module/ui/components/OxySignInButton.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/ProfileButton.d.ts +3 -0
- package/lib/typescript/module/ui/components/ProfileButton.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/authChooser/AccountsMenuView.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/authChooser/types.d.ts +6 -0
- package/lib/typescript/module/ui/components/authChooser/types.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/fileManagement/UploadPreview.d.ts +1 -1
- package/lib/typescript/module/ui/components/fileManagement/UploadPreview.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/internal/PinInput.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/payment/types.d.ts +6 -6
- package/lib/typescript/module/ui/components/payment/types.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/commitSessionFlow.d.ts +0 -40
- package/lib/typescript/module/ui/context/commitSessionFlow.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/hooks/useAuthOperations.d.ts +11 -2
- package/lib/typescript/module/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/oxyContextTypes.d.ts +26 -7
- package/lib/typescript/module/ui/context/oxyContextTypes.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/useOxyAccountGraph.d.ts +0 -1
- package/lib/typescript/module/ui/context/useOxyAccountGraph.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/paymentTypes.d.ts +3 -2
- package/lib/typescript/module/ui/hooks/queries/paymentTypes.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/usePaymentQueries.d.ts +3 -2
- package/lib/typescript/module/ui/hooks/queries/usePaymentQueries.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/queries/userCache.d.ts +2 -2
- package/lib/typescript/module/ui/hooks/queries/userCache.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useAssets.d.ts +1 -1
- package/lib/typescript/module/ui/hooks/useAssets.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useAsyncAction.d.ts +2 -2
- package/lib/typescript/module/ui/hooks/useAsyncAction.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useAuth.d.ts +10 -6
- package/lib/typescript/module/ui/hooks/useAuth.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useOnlineStatus.d.ts +3 -2
- package/lib/typescript/module/ui/hooks/useOnlineStatus.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useSessionManagement.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useSurfaceHeader.d.ts +7 -2
- package/lib/typescript/module/ui/hooks/useSurfaceHeader.d.ts.map +1 -1
- package/lib/typescript/module/ui/navigation/accountDialogManager.d.ts +8 -0
- package/lib/typescript/module/ui/navigation/accountDialogManager.d.ts.map +1 -1
- package/lib/typescript/module/ui/oauth/browserAuthTransport.d.ts.map +1 -1
- package/lib/typescript/module/ui/oauth/oauthPopup.d.ts +6 -0
- package/lib/typescript/module/ui/oauth/oauthPopup.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/ChangeAvatarScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/CreateAccountScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/EditProfileScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/FeedbackScreen.d.ts +2 -2
- package/lib/typescript/module/ui/screens/FeedbackScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/FollowersListScreen.d.ts +3 -0
- package/lib/typescript/module/ui/screens/FollowersListScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/FollowingListScreen.d.ts +3 -0
- package/lib/typescript/module/ui/screens/FollowingListScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/HistoryViewScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/ManageAccountScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/PrivacySettingsScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/ProfileScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/UserListScreen.d.ts +7 -0
- package/lib/typescript/module/ui/screens/UserListScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/WelcomeNewUserScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/fileManagement/hooks/useFileUploadState.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/trust/TrustLeaderboardScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/trust/trustTier.d.ts +1 -1
- package/lib/typescript/module/ui/screens/trust/trustTier.d.ts.map +1 -1
- package/lib/typescript/module/ui/session/backgroundSession.d.ts +42 -0
- package/lib/typescript/module/ui/session/backgroundSession.d.ts.map +1 -0
- package/lib/typescript/module/ui/session/index.d.ts +1 -0
- package/lib/typescript/module/ui/session/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/session/useBackgroundSessionSync.d.ts +23 -0
- package/lib/typescript/module/ui/session/useBackgroundSessionSync.d.ts.map +1 -0
- package/lib/typescript/module/ui/types/navigation.d.ts +27 -19
- package/lib/typescript/module/ui/types/navigation.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/fileManagement.d.ts +5 -5
- package/lib/typescript/module/ui/utils/fileManagement.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/netConnectivity.d.ts +17 -0
- package/lib/typescript/module/ui/utils/netConnectivity.d.ts.map +1 -0
- package/lib/typescript/module/ui/utils/oauthReturn.d.ts +15 -12
- package/lib/typescript/module/ui/utils/oauthReturn.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/userUtils.d.ts +7 -14
- package/lib/typescript/module/ui/utils/userUtils.d.ts.map +1 -1
- package/lib/typescript/types/expo-image-picker.d.ts +35 -0
- package/package.json +32 -12
- package/src/index.ts +19 -16
- package/src/notifications/deviceNotifications.ts +82 -0
- package/src/types/expo-image-picker.d.ts +35 -0
- package/src/ui/boot/__tests__/coldBootNoIdpRedirect.test.ts +215 -0
- package/src/ui/boot/runProviderColdBoot.ts +24 -101
- package/src/ui/components/AvatarCameraBadge.tsx +2 -1
- package/src/ui/components/FollowButton.tsx +1 -1
- package/src/ui/components/OxyAccountDialogScreen.tsx +13 -1
- package/src/ui/components/OxyAuthChooser.tsx +31 -20
- package/src/ui/components/OxyProvider.tsx +8 -7
- package/src/ui/components/OxySignInButton.tsx +2 -1
- package/src/ui/components/ProfileButton.tsx +15 -20
- package/src/ui/components/authChooser/AccountsMenuView.tsx +66 -57
- package/src/ui/components/authChooser/types.ts +6 -0
- package/src/ui/components/authChooser/useUsernameAvailability.ts +1 -1
- package/src/ui/components/fileManagement/UploadPreview.tsx +1 -1
- package/src/ui/components/internal/PinInput.tsx +1 -0
- package/src/ui/components/logo/LogoText.tsx +4 -4
- package/src/ui/components/payment/PaymentDetailsStep.tsx +1 -1
- package/src/ui/components/payment/PaymentSummaryStep.tsx +2 -2
- package/src/ui/components/payment/types.ts +24 -24
- package/src/ui/components/styles/shadow.tsx +2 -2
- package/src/ui/context/OxyContext.tsx +35 -46
- package/src/ui/context/__tests__/commitSessionFlow.test.ts +13 -89
- package/src/ui/context/commitSessionFlow.ts +3 -61
- package/src/ui/context/hooks/useAuthOperations.ts +26 -1
- package/src/ui/context/oxyContextTypes.ts +26 -7
- package/src/ui/context/useOxyAccountGraph.ts +4 -4
- package/src/ui/hooks/mutations/mutationFactory.ts +1 -1
- package/src/ui/hooks/mutations/useAccountMutations.ts +1 -1
- package/src/ui/hooks/mutations/useServicesMutations.ts +1 -1
- package/src/ui/hooks/queries/paymentTypes.ts +3 -2
- package/src/ui/hooks/queries/usePaymentQueries.ts +3 -2
- package/src/ui/hooks/queries/userCache.ts +169 -148
- package/src/ui/hooks/useAssets.ts +1 -1
- package/src/ui/hooks/useAsyncAction.ts +3 -3
- package/src/ui/hooks/useAuth.ts +12 -6
- package/src/ui/hooks/useAvatarPicker.ts +1 -1
- package/src/ui/hooks/useOnlineStatus.ts +3 -2
- package/src/ui/hooks/useSessionManagement.ts +0 -2
- package/src/ui/hooks/useSettingToggle.ts +1 -1
- package/src/ui/hooks/useSurfaceHeader.ts +90 -15
- package/src/ui/navigation/accountDialogManager.ts +9 -0
- package/src/ui/oauth/__tests__/oauthPopup.test.ts +26 -0
- package/src/ui/oauth/browserAuthTransport.ts +55 -49
- package/src/ui/oauth/oauthPopup.ts +61 -3
- package/src/ui/screens/AccountMembersScreen.tsx +1 -1
- package/src/ui/screens/AccountSettingsScreen.tsx +45 -17
- package/src/ui/screens/AccountVerificationScreen.tsx +1 -1
- package/src/ui/screens/AppInfoScreen.tsx +1 -1
- package/src/ui/screens/AvatarCropScreen.tsx +1 -1
- package/src/ui/screens/ChangeAvatarScreen.tsx +7 -4
- package/src/ui/screens/ConnectedAppsScreen.tsx +2 -2
- package/src/ui/screens/CreateAccountScreen.tsx +55 -15
- package/src/ui/screens/EditProfileFieldScreen.tsx +4 -4
- package/src/ui/screens/EditProfileScreen.tsx +6 -3
- package/src/ui/screens/FAQScreen.tsx +1 -1
- package/src/ui/screens/FeedbackScreen.tsx +741 -575
- package/src/ui/screens/FileManagementScreen.tsx +1 -1
- package/src/ui/screens/FollowersListScreen.tsx +3 -0
- package/src/ui/screens/FollowingListScreen.tsx +3 -0
- package/src/ui/screens/HelpSupportScreen.tsx +1 -1
- package/src/ui/screens/HistoryViewScreen.tsx +5 -20
- package/src/ui/screens/LanguageSelectorScreen.tsx +1 -1
- package/src/ui/screens/LegalDocumentsScreen.tsx +1 -1
- package/src/ui/screens/ManageAccountScreen.tsx +9 -2
- package/src/ui/screens/PremiumSubscriptionScreen.tsx +4 -4
- package/src/ui/screens/PrivacySettingsScreen.tsx +15 -12
- package/src/ui/screens/ProfileScreen.tsx +24 -6
- package/src/ui/screens/SavesCollectionsScreen.tsx +1 -1
- package/src/ui/screens/UserListScreen.tsx +18 -8
- package/src/ui/screens/WelcomeNewUserScreen.tsx +6 -6
- package/src/ui/screens/fileManagement/PhotoPickerSection.tsx +1 -1
- package/src/ui/screens/fileManagement/hooks/useFileUploadState.ts +14 -5
- package/src/ui/screens/trust/TrustCenterScreen.tsx +2 -2
- package/src/ui/screens/trust/TrustLeaderboardScreen.tsx +6 -5
- package/src/ui/screens/trust/TrustRewardsScreen.tsx +1 -1
- package/src/ui/screens/trust/TrustRulesScreen.tsx +1 -1
- package/src/ui/screens/trust/trustTier.ts +1 -1
- package/src/ui/session/__tests__/backgroundSession.test.ts +392 -0
- package/src/ui/session/backgroundSession.ts +313 -0
- package/src/ui/session/index.ts +1 -0
- package/src/ui/session/useBackgroundSessionSync.ts +92 -0
- package/src/ui/types/navigation.ts +27 -19
- package/src/ui/utils/fileManagement.ts +108 -92
- package/src/ui/utils/netConnectivity.ts +27 -0
- package/src/ui/utils/oauthReturn.ts +23 -33
- package/src/ui/utils/userUtils.ts +27 -32
- package/lib/commonjs/ui/oauth/legacyRedirectLanes.js +0 -48
- package/lib/commonjs/ui/oauth/legacyRedirectLanes.js.map +0 -1
- package/lib/commonjs/ui/utils/crossOriginRestore.js +0 -140
- package/lib/commonjs/ui/utils/crossOriginRestore.js.map +0 -1
- package/lib/module/ui/oauth/legacyRedirectLanes.js +0 -44
- package/lib/module/ui/oauth/legacyRedirectLanes.js.map +0 -1
- package/lib/module/ui/utils/crossOriginRestore.js +0 -131
- package/lib/module/ui/utils/crossOriginRestore.js.map +0 -1
- package/lib/typescript/commonjs/ui/oauth/legacyRedirectLanes.d.ts +0 -40
- package/lib/typescript/commonjs/ui/oauth/legacyRedirectLanes.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/utils/crossOriginRestore.d.ts +0 -43
- package/lib/typescript/commonjs/ui/utils/crossOriginRestore.d.ts.map +0 -1
- package/lib/typescript/module/ui/oauth/legacyRedirectLanes.d.ts +0 -40
- package/lib/typescript/module/ui/oauth/legacyRedirectLanes.d.ts.map +0 -1
- package/lib/typescript/module/ui/utils/crossOriginRestore.d.ts +0 -43
- package/lib/typescript/module/ui/utils/crossOriginRestore.d.ts.map +0 -1
- package/src/ui/boot/__tests__/coldBootWebAuthMode.test.ts +0 -281
- package/src/ui/oauth/legacyRedirectLanes.ts +0 -43
- package/src/ui/utils/__tests__/crossOriginRestore.test.ts +0 -143
- package/src/ui/utils/crossOriginRestore.ts +0 -169
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* `runProviderColdBoot` — the `webAuthMode` transport gate (#691 phase 7).
|
|
3
|
-
*
|
|
4
|
-
* `webAuthMode: 'popup'` must never let the boot navigate the RP's top-level
|
|
5
|
-
* window: no silent `prompt=none` restore, no authorize redirect, a signed-out
|
|
6
|
-
* domain simply resolves signed out. `'redirect'` — still the default and the
|
|
7
|
-
* compatibility path — must behave exactly as before.
|
|
8
|
-
*
|
|
9
|
-
* Unlike `__tests__/boot/runProviderColdBoot.test.ts` (deadline + connectivity
|
|
10
|
-
* wiring, with `crossOriginRestore` stubbed out), this suite keeps the restore
|
|
11
|
-
* lane REAL so the redirect-mode assertions reach the actual navigation
|
|
12
|
-
* primitive — the thing popup mode has to suppress.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import type { AuthStateStore, PersistedAuthState, SessionClient } from '@oxyhq/core';
|
|
16
|
-
|
|
17
|
-
// Only `runSessionColdBoot` and the origin-CLASSIFICATION predicates are faked.
|
|
18
|
-
// jsdom's `location` is non-configurable, so origin eligibility has to be driven
|
|
19
|
-
// through the predicates (their real behaviour is covered by core's own tests);
|
|
20
|
-
// everything else in core (PKCE, authorize-URL builder, handshake store) stays
|
|
21
|
-
// real so the redirect-mode lane is exercised end to end.
|
|
22
|
-
jest.mock('@oxyhq/core', () => {
|
|
23
|
-
const actual = jest.requireActual('@oxyhq/core');
|
|
24
|
-
return {
|
|
25
|
-
__esModule: true,
|
|
26
|
-
...actual,
|
|
27
|
-
runSessionColdBoot: jest.fn(),
|
|
28
|
-
isLoopbackOrigin: jest.fn(() => false),
|
|
29
|
-
isOfficialWebOrigin: jest.fn(() => true),
|
|
30
|
-
isIdpHubOrigin: jest.fn(() => false),
|
|
31
|
-
};
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
// The ONLY top-level-window navigation primitive either lane can reach.
|
|
35
|
-
jest.mock('../../components/oauthNavigation', () => ({
|
|
36
|
-
redirectToAuthorize: jest.fn(),
|
|
37
|
-
}));
|
|
38
|
-
|
|
39
|
-
// Spied but REAL: redirect mode must still perform the actual restore.
|
|
40
|
-
jest.mock('../../utils/crossOriginRestore', () => {
|
|
41
|
-
const actual = jest.requireActual('../../utils/crossOriginRestore');
|
|
42
|
-
return {
|
|
43
|
-
__esModule: true,
|
|
44
|
-
...actual,
|
|
45
|
-
maybeStartSilentOAuthRestore: jest.fn(actual.maybeStartSilentOAuthRestore),
|
|
46
|
-
consumeSilentOAuthError: jest.fn(actual.consumeSilentOAuthError),
|
|
47
|
-
};
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
jest.mock('../../utils/oauthReturn', () => {
|
|
51
|
-
const actual = jest.requireActual('../../utils/oauthReturn');
|
|
52
|
-
return {
|
|
53
|
-
__esModule: true,
|
|
54
|
-
...actual,
|
|
55
|
-
tryCompleteOAuthReturn: jest.fn(async () => false),
|
|
56
|
-
consumeHubSyncFailure: jest.fn(actual.consumeHubSyncFailure),
|
|
57
|
-
};
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
import { runSessionColdBoot } from '@oxyhq/core';
|
|
61
|
-
import { redirectToAuthorize } from '../../components/oauthNavigation';
|
|
62
|
-
import {
|
|
63
|
-
clearCrossOriginRestoreGuards,
|
|
64
|
-
consumeSilentOAuthError,
|
|
65
|
-
maybeStartSilentOAuthRestore,
|
|
66
|
-
} from '../../utils/crossOriginRestore';
|
|
67
|
-
import { consumeHubSyncFailure, tryCompleteOAuthReturn } from '../../utils/oauthReturn';
|
|
68
|
-
import { runProviderColdBoot, type RunProviderColdBootOptions } from '../runProviderColdBoot';
|
|
69
|
-
|
|
70
|
-
const mockRunSessionColdBoot = runSessionColdBoot as jest.Mock;
|
|
71
|
-
const mockRedirectToAuthorize = redirectToAuthorize as jest.Mock;
|
|
72
|
-
const mockSilentRestore = maybeStartSilentOAuthRestore as jest.Mock;
|
|
73
|
-
const mockConsumeSilentOAuthError = consumeSilentOAuthError as jest.Mock;
|
|
74
|
-
const mockConsumeHubSyncFailure = consumeHubSyncFailure as jest.Mock;
|
|
75
|
-
const mockTryCompleteOAuthReturn = tryCompleteOAuthReturn as jest.Mock;
|
|
76
|
-
|
|
77
|
-
const CLIENT_ID = 'oxy_dk_test';
|
|
78
|
-
|
|
79
|
-
/** An auth store holding no device credential — the signed-out domain case. */
|
|
80
|
-
function makeEmptyAuthStore(): AuthStateStore {
|
|
81
|
-
return {
|
|
82
|
-
load: jest.fn(async (): Promise<PersistedAuthState | null> => null),
|
|
83
|
-
save: jest.fn(async () => undefined),
|
|
84
|
-
clear: jest.fn(async () => undefined),
|
|
85
|
-
} as unknown as AuthStateStore;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
interface Harness {
|
|
89
|
-
options: RunProviderColdBootOptions;
|
|
90
|
-
commitSession: jest.Mock;
|
|
91
|
-
markAuthResolved: jest.Mock;
|
|
92
|
-
setTokenReady: jest.Mock;
|
|
93
|
-
sessionClientStart: jest.Mock;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
function makeHarness(overrides: Partial<RunProviderColdBootOptions> = {}): Harness {
|
|
97
|
-
const commitSession = jest.fn(async () => undefined);
|
|
98
|
-
const markAuthResolved = jest.fn();
|
|
99
|
-
const setTokenReady = jest.fn();
|
|
100
|
-
const sessionClientStart = jest.fn(async () => undefined);
|
|
101
|
-
|
|
102
|
-
const options: RunProviderColdBootOptions = {
|
|
103
|
-
oxyServices: {} as RunProviderColdBootOptions['oxyServices'],
|
|
104
|
-
authStore: makeEmptyAuthStore(),
|
|
105
|
-
clientId: CLIENT_ID,
|
|
106
|
-
sessionClient: { start: sessionClientStart } as unknown as SessionClient,
|
|
107
|
-
syncDeviceCredentialToHost: jest.fn(async () => undefined),
|
|
108
|
-
commitSession,
|
|
109
|
-
markAuthResolved,
|
|
110
|
-
setTokenReady,
|
|
111
|
-
...overrides,
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
return { options, commitSession, markAuthResolved, setTokenReady, sessionClientStart };
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/** `runSessionColdBoot` finding no session at all — the signed-out domain. */
|
|
118
|
-
function stubSignedOutBoot(): void {
|
|
119
|
-
mockRunSessionColdBoot.mockImplementation(async (opts: Parameters<typeof runSessionColdBoot>[0]) => {
|
|
120
|
-
await opts.onSignedOut?.('no_session');
|
|
121
|
-
return { kind: 'unauthenticated' } as const;
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
describe('runProviderColdBoot — webAuthMode transport gate (#691 phase 7)', () => {
|
|
126
|
-
beforeEach(() => {
|
|
127
|
-
mockRunSessionColdBoot.mockReset();
|
|
128
|
-
mockRedirectToAuthorize.mockClear();
|
|
129
|
-
mockSilentRestore.mockClear();
|
|
130
|
-
mockConsumeSilentOAuthError.mockClear();
|
|
131
|
-
mockConsumeHubSyncFailure.mockClear();
|
|
132
|
-
mockTryCompleteOAuthReturn.mockClear();
|
|
133
|
-
mockTryCompleteOAuthReturn.mockImplementation(async () => false);
|
|
134
|
-
globalThis.sessionStorage?.clear();
|
|
135
|
-
clearCrossOriginRestoreGuards();
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
describe("webAuthMode: 'popup'", () => {
|
|
139
|
-
it('never starts the silent restore and never navigates the top-level window', async () => {
|
|
140
|
-
stubSignedOutBoot();
|
|
141
|
-
const { options } = makeHarness({ webAuthMode: 'popup' });
|
|
142
|
-
|
|
143
|
-
await runProviderColdBoot(options);
|
|
144
|
-
|
|
145
|
-
expect(mockSilentRestore).not.toHaveBeenCalled();
|
|
146
|
-
expect(mockRedirectToAuthorize).not.toHaveBeenCalled();
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
it('resolves a domain with no local credential SIGNED OUT instead of bouncing', async () => {
|
|
150
|
-
stubSignedOutBoot();
|
|
151
|
-
const { options, markAuthResolved, commitSession, sessionClientStart } = makeHarness({
|
|
152
|
-
webAuthMode: 'popup',
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
await runProviderColdBoot(options);
|
|
156
|
-
|
|
157
|
-
// Auth resolution concluded (routing can settle), nothing was committed,
|
|
158
|
-
// and with no persisted credential the device socket is not started.
|
|
159
|
-
expect(markAuthResolved).toHaveBeenCalled();
|
|
160
|
-
expect(commitSession).not.toHaveBeenCalled();
|
|
161
|
-
expect(sessionClientStart).not.toHaveBeenCalled();
|
|
162
|
-
expect(mockRedirectToAuthorize).not.toHaveBeenCalled();
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
it('still completes an authorization code already on the URL (blocked-popup fallback)', async () => {
|
|
166
|
-
// A popup-mode app lands here whenever the browser blocked the popup and
|
|
167
|
-
// `startWebOAuthSignIn` fell back to a full-page redirect.
|
|
168
|
-
mockTryCompleteOAuthReturn.mockImplementation(async () => true);
|
|
169
|
-
const { options, markAuthResolved, setTokenReady } = makeHarness({ webAuthMode: 'popup' });
|
|
170
|
-
|
|
171
|
-
await runProviderColdBoot(options);
|
|
172
|
-
|
|
173
|
-
expect(mockTryCompleteOAuthReturn).toHaveBeenCalledTimes(1);
|
|
174
|
-
expect(setTokenReady).toHaveBeenLastCalledWith(true);
|
|
175
|
-
expect(markAuthResolved).toHaveBeenCalled();
|
|
176
|
-
// The device mint is short-circuited by the completed return leg.
|
|
177
|
-
expect(mockRunSessionColdBoot).not.toHaveBeenCalled();
|
|
178
|
-
expect(mockRedirectToAuthorize).not.toHaveBeenCalled();
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
it('commits the OAuth return WITHOUT hub sync', async () => {
|
|
182
|
-
mockTryCompleteOAuthReturn.mockImplementation(async () => true);
|
|
183
|
-
const { options } = makeHarness({ webAuthMode: 'popup' });
|
|
184
|
-
|
|
185
|
-
await runProviderColdBoot(options);
|
|
186
|
-
|
|
187
|
-
const commit = mockTryCompleteOAuthReturn.mock.calls[0][0] as {
|
|
188
|
-
commitSession: (input: unknown) => Promise<void>;
|
|
189
|
-
};
|
|
190
|
-
await commit.commitSession({ sessionId: 's1', userId: 'u1' });
|
|
191
|
-
expect(options.commitSession).toHaveBeenCalledWith(
|
|
192
|
-
{ sessionId: 's1', userId: 'u1' },
|
|
193
|
-
{ activate: true, hubSync: false },
|
|
194
|
-
);
|
|
195
|
-
});
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
describe("webAuthMode: 'redirect' (unchanged compatibility path)", () => {
|
|
199
|
-
it('starts the silent restore and navigates to the IdP with prompt=none', async () => {
|
|
200
|
-
stubSignedOutBoot();
|
|
201
|
-
const { options } = makeHarness({ webAuthMode: 'redirect' });
|
|
202
|
-
|
|
203
|
-
await runProviderColdBoot(options);
|
|
204
|
-
|
|
205
|
-
expect(mockSilentRestore).toHaveBeenCalledTimes(1);
|
|
206
|
-
expect(mockRedirectToAuthorize).toHaveBeenCalledTimes(1);
|
|
207
|
-
const url = new URL(mockRedirectToAuthorize.mock.calls[0][0] as string);
|
|
208
|
-
expect(url.origin + url.pathname).toBe('https://auth.oxy.so/authorize');
|
|
209
|
-
expect(url.searchParams.get('client_id')).toBe(CLIENT_ID);
|
|
210
|
-
expect(url.searchParams.get('prompt')).toBe('none');
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
it('is the DEFAULT when no webAuthMode is supplied', async () => {
|
|
214
|
-
stubSignedOutBoot();
|
|
215
|
-
const { options } = makeHarness();
|
|
216
|
-
|
|
217
|
-
await runProviderColdBoot(options);
|
|
218
|
-
|
|
219
|
-
expect(mockSilentRestore).toHaveBeenCalledTimes(1);
|
|
220
|
-
expect(mockRedirectToAuthorize).toHaveBeenCalledTimes(1);
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
it('does NOT restore when the mint already resolved a session', async () => {
|
|
224
|
-
mockRunSessionColdBoot.mockImplementation(async (opts: Parameters<typeof runSessionColdBoot>[0]) => {
|
|
225
|
-
const session = { sessionId: 's1', userId: 'u1', accessToken: 'at', via: 'device-secret-mint' };
|
|
226
|
-
await opts.onSession?.(session);
|
|
227
|
-
return { kind: 'session', via: session.via, session } as const;
|
|
228
|
-
});
|
|
229
|
-
const { options, commitSession } = makeHarness({ webAuthMode: 'redirect' });
|
|
230
|
-
|
|
231
|
-
await runProviderColdBoot(options);
|
|
232
|
-
|
|
233
|
-
expect(commitSession).toHaveBeenCalledWith(
|
|
234
|
-
{ sessionId: 's1', accessToken: 'at', userId: 'u1' },
|
|
235
|
-
{ activate: false },
|
|
236
|
-
);
|
|
237
|
-
expect(mockSilentRestore).not.toHaveBeenCalled();
|
|
238
|
-
expect(mockRedirectToAuthorize).not.toHaveBeenCalled();
|
|
239
|
-
});
|
|
240
|
-
});
|
|
241
|
-
|
|
242
|
-
describe('URL-cleanup consumers run in BOTH modes', () => {
|
|
243
|
-
it.each(['popup', 'redirect'] as const)(
|
|
244
|
-
'consumes the silent-OAuth error and hub-sync failure params (%s)',
|
|
245
|
-
async (webAuthMode) => {
|
|
246
|
-
stubSignedOutBoot();
|
|
247
|
-
const { options } = makeHarness({ webAuthMode });
|
|
248
|
-
|
|
249
|
-
await runProviderColdBoot(options);
|
|
250
|
-
|
|
251
|
-
expect(mockConsumeSilentOAuthError).toHaveBeenCalledTimes(1);
|
|
252
|
-
expect(mockConsumeHubSyncFailure).toHaveBeenCalledTimes(1);
|
|
253
|
-
},
|
|
254
|
-
);
|
|
255
|
-
|
|
256
|
-
it.each(['popup', 'redirect'] as const)(
|
|
257
|
-
'consumes an authorization code left on the URL (%s)',
|
|
258
|
-
async (webAuthMode) => {
|
|
259
|
-
stubSignedOutBoot();
|
|
260
|
-
const { options } = makeHarness({ webAuthMode });
|
|
261
|
-
|
|
262
|
-
await runProviderColdBoot(options);
|
|
263
|
-
|
|
264
|
-
expect(mockTryCompleteOAuthReturn).toHaveBeenCalledTimes(1);
|
|
265
|
-
},
|
|
266
|
-
);
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
describe('identity mode still skips both web OAuth lanes in either transport', () => {
|
|
270
|
-
it.each(['popup', 'redirect'] as const)('skips the return leg and the restore (%s)', async (webAuthMode) => {
|
|
271
|
-
stubSignedOutBoot();
|
|
272
|
-
const { options } = makeHarness({ webAuthMode, sessionMode: 'identity' });
|
|
273
|
-
|
|
274
|
-
await runProviderColdBoot(options);
|
|
275
|
-
|
|
276
|
-
expect(mockTryCompleteOAuthReturn).not.toHaveBeenCalled();
|
|
277
|
-
expect(mockSilentRestore).not.toHaveBeenCalled();
|
|
278
|
-
expect(mockRedirectToAuthorize).not.toHaveBeenCalled();
|
|
279
|
-
});
|
|
280
|
-
});
|
|
281
|
-
});
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The legacy, redirect-mode-only lanes that navigate the RP's TOP-LEVEL window
|
|
3
|
-
* to the IdP without a user gesture.
|
|
4
|
-
*
|
|
5
|
-
* `webAuthMode: 'popup'` exists to guarantee exactly one thing: the relying
|
|
6
|
-
* party never leaves its route. Two mechanics in this SDK break that guarantee,
|
|
7
|
-
* because each replaces the whole document on its own initiative:
|
|
8
|
-
*
|
|
9
|
-
* 1. **Cold-boot silent restore** — a full-page `prompt=none` authorize bounce
|
|
10
|
-
* to `auth.oxy.so` when the device-secret mint finds no local session
|
|
11
|
-
* (`maybeStartSilentOAuthRestore`, called from `runProviderColdBoot`).
|
|
12
|
-
* 2. **Post-sign-in hub sync** — a full-page hop to `auth.oxy.so/sync` that
|
|
13
|
-
* plants this device's credential on the IdP hub so OTHER origins can later
|
|
14
|
-
* run lane 1 (`syncHubAfterSignIn`, called from the `commitSession` funnel).
|
|
15
|
-
*
|
|
16
|
-
* Both belong to the redirect transport and are kept only for the migration
|
|
17
|
-
* window (issue #691, "Cold boot and cross-domain behavior"). In popup mode a
|
|
18
|
-
* domain with no local credential simply resolves SIGNED OUT, and the user's
|
|
19
|
-
* next explicit "Continue with Oxy" opens the popup — from a real user gesture,
|
|
20
|
-
* never automatically.
|
|
21
|
-
*
|
|
22
|
-
* NOT covered here, and correctly enabled in BOTH modes: navigations the user
|
|
23
|
-
* asked for. When the browser blocks the popup, `startWebOAuthSignIn` still
|
|
24
|
-
* falls back to a full-page redirect rather than dead-ending the sign-in, and
|
|
25
|
-
* `tryCompleteOAuthReturn` still consumes a `?code=` that is already on the URL.
|
|
26
|
-
*
|
|
27
|
-
* PHASE 7b: once the pilot flips the default transport to `'popup'`, this
|
|
28
|
-
* predicate and BOTH lanes above are deleted outright. Grepping this symbol
|
|
29
|
-
* finds every site that has to go.
|
|
30
|
-
*/
|
|
31
|
-
|
|
32
|
-
import type { WebAuthMode } from './types';
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Whether a provider running `webAuthMode` may perform an SDK-initiated,
|
|
36
|
-
* non-gesture, full-page navigation to the IdP.
|
|
37
|
-
*
|
|
38
|
-
* `true` only for `'redirect'` — still the default and the compatibility path,
|
|
39
|
-
* whose behaviour must stay byte-for-byte unchanged.
|
|
40
|
-
*/
|
|
41
|
-
export function allowsAutomaticIdpRedirect(webAuthMode: WebAuthMode): boolean {
|
|
42
|
-
return webAuthMode === 'redirect';
|
|
43
|
-
}
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import type { OxyServices } from '@oxyhq/core';
|
|
2
|
-
|
|
3
|
-
// Spy on the platform redirect so no real navigation happens and we can assert
|
|
4
|
-
// the authorize URL the silent-restore flow hands to the browser.
|
|
5
|
-
jest.mock('../../components/oauthNavigation', () => ({
|
|
6
|
-
redirectToAuthorize: jest.fn(),
|
|
7
|
-
}));
|
|
8
|
-
|
|
9
|
-
// jsdom's `location` is non-configurable, so the origin the code reads cannot be
|
|
10
|
-
// reassigned per-test. Instead, drive the ORIGIN-CLASSIFICATION predicates
|
|
11
|
-
// (whose real behaviour is covered by core's officialOrigins.test.ts) and keep
|
|
12
|
-
// every other core helper real (PKCE, authorize-URL builder, handshake store).
|
|
13
|
-
jest.mock('@oxyhq/core', () => {
|
|
14
|
-
const actual = jest.requireActual('@oxyhq/core');
|
|
15
|
-
return {
|
|
16
|
-
__esModule: true,
|
|
17
|
-
...actual,
|
|
18
|
-
isLoopbackOrigin: jest.fn(),
|
|
19
|
-
isOfficialWebOrigin: jest.fn(),
|
|
20
|
-
isIdpHubOrigin: jest.fn(),
|
|
21
|
-
};
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
import {
|
|
25
|
-
isLoopbackOrigin,
|
|
26
|
-
isOfficialWebOrigin,
|
|
27
|
-
isIdpHubOrigin,
|
|
28
|
-
} from '@oxyhq/core';
|
|
29
|
-
import { redirectToAuthorize } from '../../components/oauthNavigation';
|
|
30
|
-
import {
|
|
31
|
-
isSilentRestoreEligibleOrigin,
|
|
32
|
-
maybeStartSilentOAuthRestore,
|
|
33
|
-
clearCrossOriginRestoreGuards,
|
|
34
|
-
} from '../crossOriginRestore';
|
|
35
|
-
|
|
36
|
-
const mockRedirect = redirectToAuthorize as jest.Mock;
|
|
37
|
-
const mockIsLoopback = isLoopbackOrigin as jest.Mock;
|
|
38
|
-
const mockIsOfficial = isOfficialWebOrigin as jest.Mock;
|
|
39
|
-
const mockIsIdpHub = isIdpHubOrigin as jest.Mock;
|
|
40
|
-
|
|
41
|
-
const OXY_SERVICES_STUB = {} as OxyServices;
|
|
42
|
-
|
|
43
|
-
/** Default to an eligible official origin; individual tests narrow this. */
|
|
44
|
-
function makeOriginEligible(): void {
|
|
45
|
-
mockIsLoopback.mockReturnValue(false);
|
|
46
|
-
mockIsIdpHub.mockReturnValue(false);
|
|
47
|
-
mockIsOfficial.mockReturnValue(true);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
describe('crossOriginRestore', () => {
|
|
51
|
-
beforeEach(() => {
|
|
52
|
-
mockRedirect.mockClear();
|
|
53
|
-
mockIsLoopback.mockReset();
|
|
54
|
-
mockIsOfficial.mockReset();
|
|
55
|
-
mockIsIdpHub.mockReset();
|
|
56
|
-
globalThis.sessionStorage?.clear();
|
|
57
|
-
clearCrossOriginRestoreGuards();
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
describe('isSilentRestoreEligibleOrigin', () => {
|
|
61
|
-
it('rejects loopback / local-dev origins', () => {
|
|
62
|
-
mockIsLoopback.mockReturnValue(true);
|
|
63
|
-
mockIsIdpHub.mockReturnValue(false);
|
|
64
|
-
mockIsOfficial.mockReturnValue(true);
|
|
65
|
-
expect(isSilentRestoreEligibleOrigin('http://localhost:3000')).toBe(false);
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it('rejects the central IdP hub origin (no self-hop)', () => {
|
|
69
|
-
mockIsLoopback.mockReturnValue(false);
|
|
70
|
-
mockIsIdpHub.mockReturnValue(true);
|
|
71
|
-
mockIsOfficial.mockReturnValue(true);
|
|
72
|
-
expect(isSilentRestoreEligibleOrigin('https://auth.oxy.so')).toBe(false);
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('rejects non-official origins', () => {
|
|
76
|
-
mockIsLoopback.mockReturnValue(false);
|
|
77
|
-
mockIsIdpHub.mockReturnValue(false);
|
|
78
|
-
mockIsOfficial.mockReturnValue(false);
|
|
79
|
-
expect(isSilentRestoreEligibleOrigin('https://evil.example')).toBe(false);
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it('accepts official, non-loopback, non-IdP origins', () => {
|
|
83
|
-
makeOriginEligible();
|
|
84
|
-
expect(isSilentRestoreEligibleOrigin('https://accounts.oxy.so')).toBe(true);
|
|
85
|
-
});
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
describe('maybeStartSilentOAuthRestore', () => {
|
|
89
|
-
it('is SKIPPED on a loopback origin (no redirect)', async () => {
|
|
90
|
-
mockIsLoopback.mockReturnValue(true);
|
|
91
|
-
mockIsIdpHub.mockReturnValue(false);
|
|
92
|
-
mockIsOfficial.mockReturnValue(true);
|
|
93
|
-
const redirected = await maybeStartSilentOAuthRestore({
|
|
94
|
-
oxyServices: OXY_SERVICES_STUB,
|
|
95
|
-
clientId: 'oxy_dk_test',
|
|
96
|
-
});
|
|
97
|
-
expect(redirected).toBe(false);
|
|
98
|
-
expect(mockRedirect).not.toHaveBeenCalled();
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
it('is SKIPPED on a non-official origin (no redirect)', async () => {
|
|
102
|
-
mockIsLoopback.mockReturnValue(false);
|
|
103
|
-
mockIsIdpHub.mockReturnValue(false);
|
|
104
|
-
mockIsOfficial.mockReturnValue(false);
|
|
105
|
-
const redirected = await maybeStartSilentOAuthRestore({
|
|
106
|
-
oxyServices: OXY_SERVICES_STUB,
|
|
107
|
-
clientId: 'oxy_dk_test',
|
|
108
|
-
});
|
|
109
|
-
expect(redirected).toBe(false);
|
|
110
|
-
expect(mockRedirect).not.toHaveBeenCalled();
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it('redirects to the PROD IdP by default on an eligible origin', async () => {
|
|
114
|
-
makeOriginEligible();
|
|
115
|
-
const redirected = await maybeStartSilentOAuthRestore({
|
|
116
|
-
oxyServices: OXY_SERVICES_STUB,
|
|
117
|
-
clientId: 'oxy_dk_test',
|
|
118
|
-
});
|
|
119
|
-
expect(redirected).toBe(true);
|
|
120
|
-
expect(mockRedirect).toHaveBeenCalledTimes(1);
|
|
121
|
-
const url = mockRedirect.mock.calls[0][0] as string;
|
|
122
|
-
expect(url.startsWith('https://auth.oxy.so/authorize?')).toBe(true);
|
|
123
|
-
const params = new URL(url).searchParams;
|
|
124
|
-
expect(params.get('client_id')).toBe('oxy_dk_test');
|
|
125
|
-
expect(params.get('prompt')).toBe('none');
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
it('honors an authorizeBaseUrl override (self-hosted / staging IdP)', async () => {
|
|
129
|
-
makeOriginEligible();
|
|
130
|
-
const redirected = await maybeStartSilentOAuthRestore({
|
|
131
|
-
oxyServices: OXY_SERVICES_STUB,
|
|
132
|
-
clientId: 'oxy_dk_test',
|
|
133
|
-
authorizeBaseUrl: 'https://auth.staging.oxy.so/authorize',
|
|
134
|
-
});
|
|
135
|
-
expect(redirected).toBe(true);
|
|
136
|
-
const url = mockRedirect.mock.calls[0][0] as string;
|
|
137
|
-
expect(url.startsWith('https://auth.staging.oxy.so/authorize?')).toBe(true);
|
|
138
|
-
const params = new URL(url).searchParams;
|
|
139
|
-
expect(params.get('client_id')).toBe('oxy_dk_test');
|
|
140
|
-
expect(params.get('prompt')).toBe('none');
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
});
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import type { OxyServices } from '@oxyhq/core';
|
|
2
|
-
import {
|
|
3
|
-
buildOAuthAuthorizeUrl,
|
|
4
|
-
generateOAuthState,
|
|
5
|
-
generatePkcePair,
|
|
6
|
-
isIdpHubOrigin,
|
|
7
|
-
isLoopbackOrigin,
|
|
8
|
-
isOfficialWebOrigin,
|
|
9
|
-
OXY_CROSS_ORIGIN_RESTORE_ATTEMPTED_KEY,
|
|
10
|
-
OXY_SILENT_OAUTH_ATTEMPTED_KEY,
|
|
11
|
-
clearOAuthHandshake,
|
|
12
|
-
persistOAuthHandshake,
|
|
13
|
-
normalizeOAuthRedirectUri,
|
|
14
|
-
logger,
|
|
15
|
-
} from '@oxyhq/core';
|
|
16
|
-
import { isWebBrowser } from './isWebBrowser';
|
|
17
|
-
import { replaceUrlAfterOAuthReturn } from './oauthReturn';
|
|
18
|
-
import { redirectToAuthorize } from '../components/oauthNavigation';
|
|
19
|
-
|
|
20
|
-
function sessionStore(): Storage | undefined {
|
|
21
|
-
return (globalThis as { sessionStorage?: Storage }).sessionStorage;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/** True when this tab already attempted cross-origin silent OAuth restore. */
|
|
25
|
-
export function isCrossOriginRestoreBlocked(): boolean {
|
|
26
|
-
const store = sessionStore();
|
|
27
|
-
if (!store) return false;
|
|
28
|
-
return Boolean(
|
|
29
|
-
store.getItem(OXY_CROSS_ORIGIN_RESTORE_ATTEMPTED_KEY) ||
|
|
30
|
-
store.getItem(OXY_SILENT_OAUTH_ATTEMPTED_KEY),
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/** Mark restore as attempted — never auto-retry until sign-out clears guards. */
|
|
35
|
-
export function markCrossOriginRestoreAttempted(): void {
|
|
36
|
-
const store = sessionStore();
|
|
37
|
-
if (!store) return;
|
|
38
|
-
store.setItem(OXY_CROSS_ORIGIN_RESTORE_ATTEMPTED_KEY, '1');
|
|
39
|
-
store.setItem(OXY_SILENT_OAUTH_ATTEMPTED_KEY, '1');
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/** Clear all cross-origin restore loop guards (call on sign-out). */
|
|
43
|
-
export function clearCrossOriginRestoreGuards(): void {
|
|
44
|
-
const store = sessionStore();
|
|
45
|
-
if (!store) return;
|
|
46
|
-
for (const key of [OXY_CROSS_ORIGIN_RESTORE_ATTEMPTED_KEY, OXY_SILENT_OAUTH_ATTEMPTED_KEY]) {
|
|
47
|
-
store.removeItem(key);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* Whether cold boot should attempt silent cross-origin OAuth restore for the
|
|
53
|
-
* given web origin.
|
|
54
|
-
*
|
|
55
|
-
* Mirrors the hub-sync WRITE gate (`syncHubAfterSignIn`): only OFFICIAL Oxy web
|
|
56
|
-
* origins participate in cross-app SSO — a random third-party / preview origin
|
|
57
|
-
* must never have its tab bounced to the IdP. Additionally, loopback / local-dev
|
|
58
|
-
* origins are EXCLUDED here even though {@link isOfficialWebOrigin} treats them
|
|
59
|
-
* as official: a developer's local app must never be redirected to a hosted IdP
|
|
60
|
-
* on cold boot (it signs in through the in-app dialog instead). The central IdP
|
|
61
|
-
* hub's own origin is excluded to avoid a wasteful self-hop.
|
|
62
|
-
*/
|
|
63
|
-
export function isSilentRestoreEligibleOrigin(origin: string): boolean {
|
|
64
|
-
if (isLoopbackOrigin(origin)) return false;
|
|
65
|
-
if (isIdpHubOrigin()) return false;
|
|
66
|
-
return isOfficialWebOrigin(origin);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface SilentOAuthRestoreOptions {
|
|
70
|
-
oxyServices: OxyServices;
|
|
71
|
-
clientId: string;
|
|
72
|
-
redirectUri?: string;
|
|
73
|
-
scope?: string;
|
|
74
|
-
/**
|
|
75
|
-
* Authorize endpoint override (env-configurable per deployment). Defaults to
|
|
76
|
-
* the production Oxy IdP when unset, so a local/staging app points silent
|
|
77
|
-
* restore at its OWN IdP instead of production `auth.oxy.so`.
|
|
78
|
-
*/
|
|
79
|
-
authorizeBaseUrl?: string;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Top-level redirect to auth.oxy.so/authorize with `prompt=none` for silent
|
|
84
|
-
* cross-origin session restore on all web apps (official + third-party).
|
|
85
|
-
*/
|
|
86
|
-
export async function maybeStartSilentOAuthRestore(
|
|
87
|
-
opts: SilentOAuthRestoreOptions,
|
|
88
|
-
): Promise<boolean> {
|
|
89
|
-
if (!isWebBrowser()) return false;
|
|
90
|
-
|
|
91
|
-
const location = (globalThis as { location?: Location }).location;
|
|
92
|
-
if (!location) return false;
|
|
93
|
-
|
|
94
|
-
// Defense-in-depth: never bounce a loopback / non-official / IdP-hub origin to
|
|
95
|
-
// a hosted authorize endpoint (the caller gates on this too).
|
|
96
|
-
if (!isSilentRestoreEligibleOrigin(location.origin)) {
|
|
97
|
-
return false;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
if (isCrossOriginRestoreBlocked()) {
|
|
101
|
-
return false;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
const params = new URLSearchParams(location.search);
|
|
105
|
-
if (params.has('code') || params.has('error')) {
|
|
106
|
-
return false;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
try {
|
|
110
|
-
const { codeVerifier, codeChallenge } = await generatePkcePair();
|
|
111
|
-
const state = await generateOAuthState();
|
|
112
|
-
if (!persistOAuthHandshake(state, codeVerifier)) {
|
|
113
|
-
return false;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
const redirectUri = normalizeOAuthRedirectUri(
|
|
117
|
-
opts.redirectUri ?? location.origin,
|
|
118
|
-
);
|
|
119
|
-
|
|
120
|
-
const authorizeUrl = buildOAuthAuthorizeUrl({
|
|
121
|
-
authorizeBaseUrl: opts.authorizeBaseUrl,
|
|
122
|
-
clientId: opts.clientId,
|
|
123
|
-
redirectUri,
|
|
124
|
-
state,
|
|
125
|
-
codeChallenge,
|
|
126
|
-
scope: opts.scope,
|
|
127
|
-
prompt: 'none',
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
markCrossOriginRestoreAttempted();
|
|
131
|
-
redirectToAuthorize(authorizeUrl);
|
|
132
|
-
return true;
|
|
133
|
-
} catch (error) {
|
|
134
|
-
logger.warn('Silent OAuth restore skipped', { component: 'crossOriginRestore' }, error);
|
|
135
|
-
return false;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* When the RP lands with OAuth error params from a silent authorize attempt,
|
|
141
|
-
* strip them and return whether the error was terminal for silent restore.
|
|
142
|
-
*/
|
|
143
|
-
export function consumeSilentOAuthError(): 'login_required' | 'consent_required' | null {
|
|
144
|
-
if (!isWebBrowser()) return null;
|
|
145
|
-
const location = (globalThis as { location?: Location; history?: History }).location;
|
|
146
|
-
const history = (globalThis as { history?: History }).history;
|
|
147
|
-
if (!location) return null;
|
|
148
|
-
|
|
149
|
-
const params = new URLSearchParams(location.search);
|
|
150
|
-
const error = params.get('error');
|
|
151
|
-
if (error !== 'login_required' && error !== 'consent_required') {
|
|
152
|
-
return null;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
markCrossOriginRestoreAttempted();
|
|
156
|
-
|
|
157
|
-
if (history?.replaceState) {
|
|
158
|
-
const url = new URL(location.href);
|
|
159
|
-
url.searchParams.delete('error');
|
|
160
|
-
url.searchParams.delete('error_description');
|
|
161
|
-
url.searchParams.delete('state');
|
|
162
|
-
// Silent restore failed, but the visitor still asked for a specific page.
|
|
163
|
-
// Put them back on it rather than leaving them on the bare origin the IdP
|
|
164
|
-
// redirected to.
|
|
165
|
-
replaceUrlAfterOAuthReturn(`${url.pathname}${url.search}${url.hash}`);
|
|
166
|
-
}
|
|
167
|
-
clearOAuthHandshake();
|
|
168
|
-
return error;
|
|
169
|
-
}
|