@oxyhq/services 22.12.4 → 22.12.7
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 +16 -46
- package/lib/commonjs/index.js +84 -10
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/notifications/deviceNotifications.js +380 -0
- package/lib/commonjs/notifications/deviceNotifications.js.map +1 -0
- package/lib/commonjs/ui/boot/runProviderColdBoot.js +51 -9
- package/lib/commonjs/ui/boot/runProviderColdBoot.js.map +1 -1
- package/lib/commonjs/ui/client.js +0 -13
- package/lib/commonjs/ui/client.js.map +1 -1
- package/lib/commonjs/ui/components/AvatarCameraBadge.js +3 -2
- package/lib/commonjs/ui/components/AvatarCameraBadge.js.map +1 -1
- package/lib/commonjs/ui/components/OxyAccountDialogScreen.js +14 -3
- package/lib/commonjs/ui/components/OxyAccountDialogScreen.js.map +1 -1
- package/lib/commonjs/ui/components/OxyAuthChooser.js +70 -1121
- package/lib/commonjs/ui/components/OxyAuthChooser.js.map +1 -1
- package/lib/commonjs/ui/components/OxyConsentScreen.js +50 -12
- package/lib/commonjs/ui/components/OxyConsentScreen.js.map +1 -1
- package/lib/commonjs/ui/components/OxyProvider.js +4 -4
- package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
- package/lib/commonjs/ui/components/OxySignInButton.js +74 -40
- package/lib/commonjs/ui/components/OxySignInButton.js.map +1 -1
- package/lib/commonjs/ui/components/OxySignInRequestSurface.js +147 -0
- package/lib/commonjs/ui/components/OxySignInRequestSurface.js.map +1 -0
- package/lib/commonjs/ui/components/ProfileButton.js +4 -3
- package/lib/commonjs/ui/components/ProfileButton.js.map +1 -1
- package/lib/commonjs/ui/components/SettingsIcon.js +3 -2
- package/lib/commonjs/ui/components/SettingsIcon.js.map +1 -1
- package/lib/commonjs/ui/components/authChooser/AccountsMenuView.js +527 -0
- package/lib/commonjs/ui/components/authChooser/AccountsMenuView.js.map +1 -0
- package/lib/commonjs/ui/components/authChooser/SignInEntryView.js +90 -0
- package/lib/commonjs/ui/components/authChooser/SignInEntryView.js.map +1 -0
- package/lib/commonjs/ui/components/authChooser/SignInRequestView.js +106 -0
- package/lib/commonjs/ui/components/authChooser/SignInRequestView.js.map +1 -0
- package/lib/commonjs/ui/components/authChooser/SignUpView.js +188 -0
- package/lib/commonjs/ui/components/authChooser/SignUpView.js.map +1 -0
- package/lib/commonjs/ui/components/authChooser/TroubleDisclosure.js +61 -0
- package/lib/commonjs/ui/components/authChooser/TroubleDisclosure.js.map +1 -0
- package/lib/commonjs/ui/components/authChooser/primitives.js +170 -0
- package/lib/commonjs/ui/components/authChooser/primitives.js.map +1 -0
- package/lib/commonjs/ui/components/authChooser/requestSurfaces.js +153 -0
- package/lib/commonjs/ui/components/authChooser/requestSurfaces.js.map +1 -0
- package/lib/commonjs/ui/components/authChooser/signInProgress.js +54 -0
- package/lib/commonjs/ui/components/authChooser/signInProgress.js.map +1 -0
- package/lib/commonjs/ui/components/{oxyAuthChooserStyles.js → authChooser/styles.js} +19 -1
- package/lib/commonjs/ui/components/authChooser/styles.js.map +1 -0
- package/lib/commonjs/ui/components/authChooser/types.js +70 -0
- package/lib/commonjs/ui/components/authChooser/types.js.map +1 -0
- package/lib/commonjs/ui/components/authChooser/useUsernameAvailability.js +50 -0
- package/lib/commonjs/ui/components/authChooser/useUsernameAvailability.js.map +1 -0
- package/lib/commonjs/ui/components/fileManagement/AnimatedButton.js +3 -2
- package/lib/commonjs/ui/components/fileManagement/AnimatedButton.js.map +1 -1
- package/lib/commonjs/ui/components/fileManagement/FileDetailsModal.js +3 -2
- package/lib/commonjs/ui/components/fileManagement/FileDetailsModal.js.map +1 -1
- package/lib/commonjs/ui/components/fileManagement/FileViewer.js +15 -14
- package/lib/commonjs/ui/components/fileManagement/FileViewer.js.map +1 -1
- package/lib/commonjs/ui/components/fileManagement/UploadPreview.js +6 -5
- package/lib/commonjs/ui/components/fileManagement/UploadPreview.js.map +1 -1
- package/lib/commonjs/ui/components/modals/DeleteAccountModal.js +3 -2
- package/lib/commonjs/ui/components/modals/DeleteAccountModal.js.map +1 -1
- package/lib/commonjs/ui/components/payment/PaymentDetailsStep.js +6 -6
- package/lib/commonjs/ui/components/payment/PaymentDetailsStep.js.map +1 -1
- package/lib/commonjs/ui/components/payment/PaymentMethodStep.js +5 -5
- package/lib/commonjs/ui/components/payment/PaymentMethodStep.js.map +1 -1
- package/lib/commonjs/ui/components/payment/PaymentReviewStep.js +10 -9
- package/lib/commonjs/ui/components/payment/PaymentReviewStep.js.map +1 -1
- package/lib/commonjs/ui/components/payment/PaymentSuccessStep.js +4 -3
- package/lib/commonjs/ui/components/payment/PaymentSuccessStep.js.map +1 -1
- package/lib/commonjs/ui/components/payment/PaymentSummaryStep.js +6 -5
- package/lib/commonjs/ui/components/payment/PaymentSummaryStep.js.map +1 -1
- package/lib/commonjs/ui/context/OxyContext.js +200 -29
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/context/commitSessionFlow.js +43 -0
- package/lib/commonjs/ui/context/commitSessionFlow.js.map +1 -1
- package/lib/commonjs/ui/context/useOxyAccountGraph.js +13 -5
- package/lib/commonjs/ui/context/useOxyAccountGraph.js.map +1 -1
- package/lib/commonjs/ui/hooks/useSwitchableAccounts.js +6 -1
- package/lib/commonjs/ui/hooks/useSwitchableAccounts.js.map +1 -1
- package/lib/commonjs/ui/index.js +0 -13
- package/lib/commonjs/ui/index.js.map +1 -1
- package/lib/commonjs/ui/oauth/browserAuthTransport.js +168 -0
- package/lib/commonjs/ui/oauth/browserAuthTransport.js.map +1 -0
- package/lib/commonjs/ui/oauth/completeOAuthCode.js +78 -0
- package/lib/commonjs/ui/oauth/completeOAuthCode.js.map +1 -0
- package/lib/commonjs/ui/oauth/legacyRedirectLanes.js +48 -0
- package/lib/commonjs/ui/oauth/legacyRedirectLanes.js.map +1 -0
- package/lib/commonjs/ui/oauth/oauthHandshake.js +53 -0
- package/lib/commonjs/ui/oauth/oauthHandshake.js.map +1 -0
- package/lib/commonjs/ui/oauth/oauthPopup.js +229 -0
- package/lib/commonjs/ui/oauth/oauthPopup.js.map +1 -0
- package/lib/commonjs/ui/oauth/oauthPopupMessages.js +141 -0
- package/lib/commonjs/ui/oauth/oauthPopupMessages.js.map +1 -0
- package/lib/commonjs/ui/oauth/types.js +2 -0
- package/lib/commonjs/ui/oauth/types.js.map +1 -0
- package/lib/commonjs/ui/screens/AccountMembersScreen.js +4 -3
- package/lib/commonjs/ui/screens/AccountMembersScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/CreateAccountScreen.js +7 -6
- package/lib/commonjs/ui/screens/CreateAccountScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/EditProfileFieldScreen.js +4 -3
- package/lib/commonjs/ui/screens/EditProfileFieldScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FAQScreen.js +3 -2
- package/lib/commonjs/ui/screens/FAQScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FeedbackScreen.js +11 -10
- package/lib/commonjs/ui/screens/FeedbackScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/FileManagementScreen.js +19 -18
- package/lib/commonjs/ui/screens/FileManagementScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/LanguageSelectorScreen.js +4 -3
- package/lib/commonjs/ui/screens/LanguageSelectorScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ManageAccountScreen.js +2 -2
- package/lib/commonjs/ui/screens/ManageAccountScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PaymentGatewayScreen.js +3 -3
- package/lib/commonjs/ui/screens/PaymentGatewayScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js +9 -8
- package/lib/commonjs/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ProfileScreen.js +10 -10
- package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/UserListScreen.js +3 -3
- package/lib/commonjs/ui/screens/UserListScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/WelcomeNewUserScreen.js +3 -2
- package/lib/commonjs/ui/screens/WelcomeNewUserScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/fileManagement/FileLibraryError.js +4 -3
- package/lib/commonjs/ui/screens/fileManagement/FileLibraryError.js.map +1 -1
- package/lib/commonjs/ui/screens/fileManagement/FileListSection.js +4 -3
- package/lib/commonjs/ui/screens/fileManagement/FileListSection.js.map +1 -1
- package/lib/commonjs/ui/screens/fileManagement/PhotoPickerSection.js +4 -3
- package/lib/commonjs/ui/screens/fileManagement/PhotoPickerSection.js.map +1 -1
- package/lib/commonjs/ui/screens/fileManagement/UploadBar.js +3 -2
- package/lib/commonjs/ui/screens/fileManagement/UploadBar.js.map +1 -1
- package/lib/commonjs/ui/screens/trust/TrustCenterScreen.js +3 -2
- package/lib/commonjs/ui/screens/trust/TrustCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/trust/TrustLeaderboardScreen.js +4 -3
- package/lib/commonjs/ui/screens/trust/TrustLeaderboardScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/trust/TrustRewardsScreen.js +4 -3
- package/lib/commonjs/ui/screens/trust/TrustRewardsScreen.js.map +1 -1
- package/lib/commonjs/ui/server.js +2 -5
- package/lib/commonjs/ui/server.js.map +1 -1
- package/lib/commonjs/ui/session/authStore.js +6 -75
- package/lib/commonjs/ui/session/authStore.js.map +1 -1
- package/lib/commonjs/ui/session/createSessionClient.js +11 -3
- package/lib/commonjs/ui/session/createSessionClient.js.map +1 -1
- package/lib/commonjs/ui/session/identityBinding.js +95 -0
- package/lib/commonjs/ui/session/identityBinding.js.map +1 -0
- package/lib/commonjs/ui/session/index.js +13 -0
- package/lib/commonjs/ui/session/index.js.map +1 -1
- package/lib/commonjs/ui/session/nativeSecureStorage.js +90 -0
- package/lib/commonjs/ui/session/nativeSecureStorage.js.map +1 -0
- package/lib/commonjs/ui/session/tokenTransport.js +11 -1
- package/lib/commonjs/ui/session/tokenTransport.js.map +1 -1
- package/lib/commonjs/ui/utils/crossOriginRestore.js +3 -2
- package/lib/commonjs/ui/utils/crossOriginRestore.js.map +1 -1
- package/lib/commonjs/ui/utils/deliveryPlatform.js +58 -0
- package/lib/commonjs/ui/utils/deliveryPlatform.js.map +1 -0
- package/lib/commonjs/ui/utils/oauthReturn.js +70 -46
- package/lib/commonjs/ui/utils/oauthReturn.js.map +1 -1
- package/lib/module/index.js +27 -4
- package/lib/module/index.js.map +1 -1
- package/lib/module/notifications/deviceNotifications.js +371 -0
- package/lib/module/notifications/deviceNotifications.js.map +1 -0
- package/lib/module/ui/boot/runProviderColdBoot.js +51 -9
- package/lib/module/ui/boot/runProviderColdBoot.js.map +1 -1
- package/lib/module/ui/client.js +0 -1
- package/lib/module/ui/client.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/OxyAccountDialogScreen.js +14 -3
- package/lib/module/ui/components/OxyAccountDialogScreen.js.map +1 -1
- package/lib/module/ui/components/OxyAuthChooser.js +74 -1126
- package/lib/module/ui/components/OxyAuthChooser.js.map +1 -1
- package/lib/module/ui/components/OxyConsentScreen.js +50 -12
- package/lib/module/ui/components/OxyConsentScreen.js.map +1 -1
- package/lib/module/ui/components/OxyProvider.js +4 -4
- package/lib/module/ui/components/OxyProvider.js.map +1 -1
- package/lib/module/ui/components/OxySignInButton.js +76 -42
- package/lib/module/ui/components/OxySignInButton.js.map +1 -1
- package/lib/module/ui/components/OxySignInRequestSurface.js +141 -0
- package/lib/module/ui/components/OxySignInRequestSurface.js.map +1 -0
- package/lib/module/ui/components/ProfileButton.js +1 -1
- package/lib/module/ui/components/ProfileButton.js.map +1 -1
- package/lib/module/ui/components/SettingsIcon.js +1 -1
- package/lib/module/ui/components/SettingsIcon.js.map +1 -1
- package/lib/module/ui/components/authChooser/AccountsMenuView.js +523 -0
- package/lib/module/ui/components/authChooser/AccountsMenuView.js.map +1 -0
- package/lib/module/ui/components/authChooser/SignInEntryView.js +85 -0
- package/lib/module/ui/components/authChooser/SignInEntryView.js.map +1 -0
- package/lib/module/ui/components/authChooser/SignInRequestView.js +101 -0
- package/lib/module/ui/components/authChooser/SignInRequestView.js.map +1 -0
- package/lib/module/ui/components/authChooser/SignUpView.js +184 -0
- package/lib/module/ui/components/authChooser/SignUpView.js.map +1 -0
- package/lib/module/ui/components/authChooser/TroubleDisclosure.js +57 -0
- package/lib/module/ui/components/authChooser/TroubleDisclosure.js.map +1 -0
- package/lib/module/ui/components/authChooser/primitives.js +163 -0
- package/lib/module/ui/components/authChooser/primitives.js.map +1 -0
- package/lib/module/ui/components/authChooser/requestSurfaces.js +143 -0
- package/lib/module/ui/components/authChooser/requestSurfaces.js.map +1 -0
- package/lib/module/ui/components/authChooser/signInProgress.js +50 -0
- package/lib/module/ui/components/authChooser/signInProgress.js.map +1 -0
- package/lib/module/ui/components/{oxyAuthChooserStyles.js → authChooser/styles.js} +19 -1
- package/lib/module/ui/components/authChooser/styles.js.map +1 -0
- package/lib/module/ui/components/authChooser/types.js +66 -0
- package/lib/module/ui/components/authChooser/types.js.map +1 -0
- package/lib/module/ui/components/authChooser/useUsernameAvailability.js +46 -0
- package/lib/module/ui/components/authChooser/useUsernameAvailability.js.map +1 -0
- package/lib/module/ui/components/fileManagement/AnimatedButton.js +1 -1
- package/lib/module/ui/components/fileManagement/AnimatedButton.js.map +1 -1
- package/lib/module/ui/components/fileManagement/FileDetailsModal.js +1 -1
- package/lib/module/ui/components/fileManagement/FileDetailsModal.js.map +1 -1
- package/lib/module/ui/components/fileManagement/FileViewer.js +1 -1
- package/lib/module/ui/components/fileManagement/FileViewer.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/modals/DeleteAccountModal.js +1 -1
- package/lib/module/ui/components/modals/DeleteAccountModal.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/PaymentMethodStep.js +1 -1
- package/lib/module/ui/components/payment/PaymentMethodStep.js.map +1 -1
- package/lib/module/ui/components/payment/PaymentReviewStep.js +1 -1
- package/lib/module/ui/components/payment/PaymentReviewStep.js.map +1 -1
- package/lib/module/ui/components/payment/PaymentSuccessStep.js +1 -1
- package/lib/module/ui/components/payment/PaymentSuccessStep.js.map +1 -1
- package/lib/module/ui/components/payment/PaymentSummaryStep.js +1 -1
- package/lib/module/ui/components/payment/PaymentSummaryStep.js.map +1 -1
- package/lib/module/ui/context/OxyContext.js +203 -32
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/context/commitSessionFlow.js +42 -0
- package/lib/module/ui/context/commitSessionFlow.js.map +1 -1
- package/lib/module/ui/context/useOxyAccountGraph.js +13 -5
- package/lib/module/ui/context/useOxyAccountGraph.js.map +1 -1
- package/lib/module/ui/hooks/useSwitchableAccounts.js +6 -1
- package/lib/module/ui/hooks/useSwitchableAccounts.js.map +1 -1
- package/lib/module/ui/index.js +0 -1
- package/lib/module/ui/index.js.map +1 -1
- package/lib/module/ui/oauth/browserAuthTransport.js +165 -0
- package/lib/module/ui/oauth/browserAuthTransport.js.map +1 -0
- package/lib/module/ui/oauth/completeOAuthCode.js +75 -0
- package/lib/module/ui/oauth/completeOAuthCode.js.map +1 -0
- package/lib/module/ui/oauth/legacyRedirectLanes.js +44 -0
- package/lib/module/ui/oauth/legacyRedirectLanes.js.map +1 -0
- package/lib/module/ui/oauth/oauthHandshake.js +50 -0
- package/lib/module/ui/oauth/oauthHandshake.js.map +1 -0
- package/lib/module/ui/oauth/oauthPopup.js +221 -0
- package/lib/module/ui/oauth/oauthPopup.js.map +1 -0
- package/lib/module/ui/oauth/oauthPopupMessages.js +135 -0
- package/lib/module/ui/oauth/oauthPopupMessages.js.map +1 -0
- package/lib/module/ui/oauth/types.js +2 -0
- package/lib/module/ui/oauth/types.js.map +1 -0
- package/lib/module/ui/screens/AccountMembersScreen.js +1 -1
- package/lib/module/ui/screens/AccountMembersScreen.js.map +1 -1
- package/lib/module/ui/screens/CreateAccountScreen.js +1 -1
- package/lib/module/ui/screens/CreateAccountScreen.js.map +1 -1
- package/lib/module/ui/screens/EditProfileFieldScreen.js +1 -1
- package/lib/module/ui/screens/EditProfileFieldScreen.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 +1 -1
- package/lib/module/ui/screens/FeedbackScreen.js.map +1 -1
- package/lib/module/ui/screens/FileManagementScreen.js +2 -1
- package/lib/module/ui/screens/FileManagementScreen.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/ManageAccountScreen.js +1 -1
- package/lib/module/ui/screens/ManageAccountScreen.js.map +1 -1
- package/lib/module/ui/screens/PaymentGatewayScreen.js +1 -1
- package/lib/module/ui/screens/PaymentGatewayScreen.js.map +1 -1
- package/lib/module/ui/screens/PremiumSubscriptionScreen.js +1 -1
- package/lib/module/ui/screens/PremiumSubscriptionScreen.js.map +1 -1
- package/lib/module/ui/screens/ProfileScreen.js +1 -1
- package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
- package/lib/module/ui/screens/UserListScreen.js +1 -1
- package/lib/module/ui/screens/UserListScreen.js.map +1 -1
- package/lib/module/ui/screens/WelcomeNewUserScreen.js +1 -1
- package/lib/module/ui/screens/WelcomeNewUserScreen.js.map +1 -1
- package/lib/module/ui/screens/fileManagement/FileLibraryError.js +1 -1
- package/lib/module/ui/screens/fileManagement/FileLibraryError.js.map +1 -1
- package/lib/module/ui/screens/fileManagement/FileListSection.js +1 -1
- package/lib/module/ui/screens/fileManagement/FileListSection.js.map +1 -1
- package/lib/module/ui/screens/fileManagement/PhotoPickerSection.js +2 -1
- package/lib/module/ui/screens/fileManagement/PhotoPickerSection.js.map +1 -1
- package/lib/module/ui/screens/fileManagement/UploadBar.js +1 -1
- package/lib/module/ui/screens/fileManagement/UploadBar.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 +1 -1
- 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/server.js +0 -2
- package/lib/module/ui/server.js.map +1 -1
- package/lib/module/ui/session/authStore.js +5 -75
- package/lib/module/ui/session/authStore.js.map +1 -1
- package/lib/module/ui/session/createSessionClient.js +11 -3
- package/lib/module/ui/session/createSessionClient.js.map +1 -1
- package/lib/module/ui/session/identityBinding.js +89 -0
- package/lib/module/ui/session/identityBinding.js.map +1 -0
- package/lib/module/ui/session/index.js +5 -2
- package/lib/module/ui/session/index.js.map +1 -1
- package/lib/module/ui/session/nativeSecureStorage.js +88 -0
- package/lib/module/ui/session/nativeSecureStorage.js.map +1 -0
- package/lib/module/ui/session/tokenTransport.js +11 -1
- package/lib/module/ui/session/tokenTransport.js.map +1 -1
- package/lib/module/ui/utils/crossOriginRestore.js +4 -3
- package/lib/module/ui/utils/crossOriginRestore.js.map +1 -1
- package/lib/module/ui/utils/deliveryPlatform.js +55 -0
- package/lib/module/ui/utils/deliveryPlatform.js.map +1 -0
- package/lib/module/ui/utils/oauthReturn.js +70 -46
- package/lib/module/ui/utils/oauthReturn.js.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +9 -1
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/notifications/deviceNotifications.d.ts +141 -0
- package/lib/typescript/commonjs/notifications/deviceNotifications.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/boot/runProviderColdBoot.d.ts +34 -2
- package/lib/typescript/commonjs/ui/boot/runProviderColdBoot.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/client.d.ts +0 -1
- package/lib/typescript/commonjs/ui/client.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 +16 -29
- package/lib/typescript/commonjs/ui/components/OxyAuthChooser.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/OxyConsentScreen.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 +17 -12
- package/lib/typescript/commonjs/ui/components/OxySignInButton.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/OxySignInRequestSurface.d.ts +108 -0
- package/lib/typescript/commonjs/ui/components/OxySignInRequestSurface.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/SettingsIcon.d.ts +1 -1
- package/lib/typescript/commonjs/ui/components/SettingsIcon.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/components/authChooser/AccountsMenuView.d.ts +38 -0
- package/lib/typescript/commonjs/ui/components/authChooser/AccountsMenuView.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/authChooser/SignInEntryView.d.ts +32 -0
- package/lib/typescript/commonjs/ui/components/authChooser/SignInEntryView.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/authChooser/SignInRequestView.d.ts +34 -0
- package/lib/typescript/commonjs/ui/components/authChooser/SignInRequestView.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/authChooser/SignUpView.d.ts +34 -0
- package/lib/typescript/commonjs/ui/components/authChooser/SignUpView.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/authChooser/TroubleDisclosure.d.ts +36 -0
- package/lib/typescript/commonjs/ui/components/authChooser/TroubleDisclosure.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/authChooser/primitives.d.ts +55 -0
- package/lib/typescript/commonjs/ui/components/authChooser/primitives.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/authChooser/requestSurfaces.d.ts +58 -0
- package/lib/typescript/commonjs/ui/components/authChooser/requestSurfaces.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/authChooser/signInProgress.d.ts +26 -0
- package/lib/typescript/commonjs/ui/components/authChooser/signInProgress.d.ts.map +1 -0
- package/lib/typescript/{module/ui/components/oxyAuthChooserStyles.d.ts → commonjs/ui/components/authChooser/styles.d.ts} +19 -1
- package/lib/typescript/commonjs/ui/components/authChooser/styles.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/authChooser/types.d.ts +103 -0
- package/lib/typescript/commonjs/ui/components/authChooser/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/authChooser/useUsernameAvailability.d.ts +16 -0
- package/lib/typescript/commonjs/ui/components/authChooser/useUsernameAvailability.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/components/payment/types.d.ts +1 -1
- 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 +40 -0
- package/lib/typescript/commonjs/ui/context/commitSessionFlow.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/oxyContextTypes.d.ts +44 -1
- package/lib/typescript/commonjs/ui/context/oxyContextTypes.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/context/useOxyAccountGraph.d.ts +7 -1
- package/lib/typescript/commonjs/ui/context/useOxyAccountGraph.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/hooks/useSwitchableAccounts.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/index.d.ts +0 -1
- package/lib/typescript/commonjs/ui/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/oauth/browserAuthTransport.d.ts +56 -0
- package/lib/typescript/commonjs/ui/oauth/browserAuthTransport.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/oauth/completeOAuthCode.d.ts +49 -0
- package/lib/typescript/commonjs/ui/oauth/completeOAuthCode.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/oauth/legacyRedirectLanes.d.ts +40 -0
- package/lib/typescript/commonjs/ui/oauth/legacyRedirectLanes.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/oauth/oauthHandshake.d.ts +50 -0
- package/lib/typescript/commonjs/ui/oauth/oauthHandshake.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/oauth/oauthPopup.d.ts +77 -0
- package/lib/typescript/commonjs/ui/oauth/oauthPopup.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/oauth/oauthPopupMessages.d.ts +67 -0
- package/lib/typescript/commonjs/ui/oauth/oauthPopupMessages.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/oauth/types.d.ts +176 -0
- package/lib/typescript/commonjs/ui/oauth/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/FeedbackScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/FileManagementScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/fileManagement/PhotoPickerSection.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/server.d.ts +0 -2
- package/lib/typescript/commonjs/ui/server.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/session/authStore.d.ts +3 -7
- package/lib/typescript/commonjs/ui/session/authStore.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/session/createSessionClient.d.ts +8 -1
- package/lib/typescript/commonjs/ui/session/createSessionClient.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/session/identityBinding.d.ts +66 -0
- package/lib/typescript/commonjs/ui/session/identityBinding.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/session/index.d.ts +6 -2
- package/lib/typescript/commonjs/ui/session/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/session/nativeSecureStorage.d.ts +25 -0
- package/lib/typescript/commonjs/ui/session/nativeSecureStorage.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/session/tokenTransport.d.ts +8 -1
- package/lib/typescript/commonjs/ui/session/tokenTransport.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/types/navigation.d.ts +44 -0
- package/lib/typescript/commonjs/ui/types/navigation.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/crossOriginRestore.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/deliveryPlatform.d.ts +33 -0
- package/lib/typescript/commonjs/ui/utils/deliveryPlatform.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/utils/fileManagement.d.ts +1 -1
- package/lib/typescript/commonjs/ui/utils/fileManagement.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/utils/oauthReturn.d.ts +30 -16
- package/lib/typescript/commonjs/ui/utils/oauthReturn.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +9 -1
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/notifications/deviceNotifications.d.ts +141 -0
- package/lib/typescript/module/notifications/deviceNotifications.d.ts.map +1 -0
- package/lib/typescript/module/ui/boot/runProviderColdBoot.d.ts +34 -2
- package/lib/typescript/module/ui/boot/runProviderColdBoot.d.ts.map +1 -1
- package/lib/typescript/module/ui/client.d.ts +0 -1
- package/lib/typescript/module/ui/client.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 +16 -29
- package/lib/typescript/module/ui/components/OxyAuthChooser.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/OxyConsentScreen.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 +17 -12
- package/lib/typescript/module/ui/components/OxySignInButton.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/OxySignInRequestSurface.d.ts +108 -0
- package/lib/typescript/module/ui/components/OxySignInRequestSurface.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/SettingsIcon.d.ts +1 -1
- package/lib/typescript/module/ui/components/SettingsIcon.d.ts.map +1 -1
- package/lib/typescript/module/ui/components/authChooser/AccountsMenuView.d.ts +38 -0
- package/lib/typescript/module/ui/components/authChooser/AccountsMenuView.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/authChooser/SignInEntryView.d.ts +32 -0
- package/lib/typescript/module/ui/components/authChooser/SignInEntryView.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/authChooser/SignInRequestView.d.ts +34 -0
- package/lib/typescript/module/ui/components/authChooser/SignInRequestView.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/authChooser/SignUpView.d.ts +34 -0
- package/lib/typescript/module/ui/components/authChooser/SignUpView.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/authChooser/TroubleDisclosure.d.ts +36 -0
- package/lib/typescript/module/ui/components/authChooser/TroubleDisclosure.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/authChooser/primitives.d.ts +55 -0
- package/lib/typescript/module/ui/components/authChooser/primitives.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/authChooser/requestSurfaces.d.ts +58 -0
- package/lib/typescript/module/ui/components/authChooser/requestSurfaces.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/authChooser/signInProgress.d.ts +26 -0
- package/lib/typescript/module/ui/components/authChooser/signInProgress.d.ts.map +1 -0
- package/lib/typescript/{commonjs/ui/components/oxyAuthChooserStyles.d.ts → module/ui/components/authChooser/styles.d.ts} +19 -1
- package/lib/typescript/module/ui/components/authChooser/styles.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/authChooser/types.d.ts +103 -0
- package/lib/typescript/module/ui/components/authChooser/types.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/authChooser/useUsernameAvailability.d.ts +16 -0
- package/lib/typescript/module/ui/components/authChooser/useUsernameAvailability.d.ts.map +1 -0
- package/lib/typescript/module/ui/components/payment/types.d.ts +1 -1
- 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 +40 -0
- package/lib/typescript/module/ui/context/commitSessionFlow.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/oxyContextTypes.d.ts +44 -1
- package/lib/typescript/module/ui/context/oxyContextTypes.d.ts.map +1 -1
- package/lib/typescript/module/ui/context/useOxyAccountGraph.d.ts +7 -1
- package/lib/typescript/module/ui/context/useOxyAccountGraph.d.ts.map +1 -1
- package/lib/typescript/module/ui/hooks/useSwitchableAccounts.d.ts.map +1 -1
- package/lib/typescript/module/ui/index.d.ts +0 -1
- package/lib/typescript/module/ui/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/oauth/browserAuthTransport.d.ts +56 -0
- package/lib/typescript/module/ui/oauth/browserAuthTransport.d.ts.map +1 -0
- package/lib/typescript/module/ui/oauth/completeOAuthCode.d.ts +49 -0
- package/lib/typescript/module/ui/oauth/completeOAuthCode.d.ts.map +1 -0
- package/lib/typescript/module/ui/oauth/legacyRedirectLanes.d.ts +40 -0
- package/lib/typescript/module/ui/oauth/legacyRedirectLanes.d.ts.map +1 -0
- package/lib/typescript/module/ui/oauth/oauthHandshake.d.ts +50 -0
- package/lib/typescript/module/ui/oauth/oauthHandshake.d.ts.map +1 -0
- package/lib/typescript/module/ui/oauth/oauthPopup.d.ts +77 -0
- package/lib/typescript/module/ui/oauth/oauthPopup.d.ts.map +1 -0
- package/lib/typescript/module/ui/oauth/oauthPopupMessages.d.ts +67 -0
- package/lib/typescript/module/ui/oauth/oauthPopupMessages.d.ts.map +1 -0
- package/lib/typescript/module/ui/oauth/types.d.ts +176 -0
- package/lib/typescript/module/ui/oauth/types.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/FeedbackScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/FileManagementScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/fileManagement/PhotoPickerSection.d.ts.map +1 -1
- package/lib/typescript/module/ui/server.d.ts +0 -2
- package/lib/typescript/module/ui/server.d.ts.map +1 -1
- package/lib/typescript/module/ui/session/authStore.d.ts +3 -7
- package/lib/typescript/module/ui/session/authStore.d.ts.map +1 -1
- package/lib/typescript/module/ui/session/createSessionClient.d.ts +8 -1
- package/lib/typescript/module/ui/session/createSessionClient.d.ts.map +1 -1
- package/lib/typescript/module/ui/session/identityBinding.d.ts +66 -0
- package/lib/typescript/module/ui/session/identityBinding.d.ts.map +1 -0
- package/lib/typescript/module/ui/session/index.d.ts +6 -2
- package/lib/typescript/module/ui/session/index.d.ts.map +1 -1
- package/lib/typescript/module/ui/session/nativeSecureStorage.d.ts +25 -0
- package/lib/typescript/module/ui/session/nativeSecureStorage.d.ts.map +1 -0
- package/lib/typescript/module/ui/session/tokenTransport.d.ts +8 -1
- package/lib/typescript/module/ui/session/tokenTransport.d.ts.map +1 -1
- package/lib/typescript/module/ui/types/navigation.d.ts +44 -0
- package/lib/typescript/module/ui/types/navigation.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/crossOriginRestore.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/deliveryPlatform.d.ts +33 -0
- package/lib/typescript/module/ui/utils/deliveryPlatform.d.ts.map +1 -0
- package/lib/typescript/module/ui/utils/fileManagement.d.ts +1 -1
- package/lib/typescript/module/ui/utils/fileManagement.d.ts.map +1 -1
- package/lib/typescript/module/ui/utils/oauthReturn.d.ts +30 -16
- package/lib/typescript/module/ui/utils/oauthReturn.d.ts.map +1 -1
- package/package.json +15 -7
- package/src/index.ts +50 -5
- package/src/notifications/deviceNotifications.ts +395 -0
- package/src/ui/boot/__tests__/coldBootWebAuthMode.test.ts +281 -0
- package/src/ui/boot/runProviderColdBoot.ts +83 -13
- package/src/ui/client.ts +0 -1
- package/src/ui/components/AvatarCameraBadge.tsx +1 -1
- package/src/ui/components/OxyAccountDialogScreen.tsx +20 -3
- package/src/ui/components/OxyAuthChooser.tsx +91 -1230
- package/src/ui/components/OxyConsentScreen.tsx +56 -13
- package/src/ui/components/OxyProvider.tsx +4 -4
- package/src/ui/components/OxySignInButton.tsx +119 -78
- package/src/ui/components/OxySignInRequestSurface.tsx +202 -0
- package/src/ui/components/ProfileButton.tsx +1 -1
- package/src/ui/components/SettingsIcon.tsx +1 -1
- package/src/ui/components/__tests__/OxyConsentScreen.test.tsx +27 -0
- package/src/ui/components/authChooser/AccountsMenuView.tsx +569 -0
- package/src/ui/components/authChooser/SignInEntryView.tsx +121 -0
- package/src/ui/components/authChooser/SignInRequestView.tsx +130 -0
- package/src/ui/components/authChooser/SignUpView.tsx +174 -0
- package/src/ui/components/authChooser/TroubleDisclosure.tsx +73 -0
- package/src/ui/components/authChooser/primitives.tsx +144 -0
- package/src/ui/components/authChooser/requestSurfaces.tsx +120 -0
- package/src/ui/components/authChooser/signInProgress.ts +54 -0
- package/src/ui/components/{oxyAuthChooserStyles.ts → authChooser/styles.ts} +18 -0
- package/src/ui/components/authChooser/types.ts +120 -0
- package/src/ui/components/authChooser/useUsernameAvailability.ts +60 -0
- package/src/ui/components/fileManagement/AnimatedButton.tsx +1 -1
- package/src/ui/components/fileManagement/FileDetailsModal.tsx +1 -1
- package/src/ui/components/fileManagement/FileViewer.tsx +1 -1
- package/src/ui/components/fileManagement/UploadPreview.tsx +1 -1
- package/src/ui/components/modals/DeleteAccountModal.tsx +1 -1
- package/src/ui/components/payment/PaymentDetailsStep.tsx +1 -1
- package/src/ui/components/payment/PaymentMethodStep.tsx +1 -1
- package/src/ui/components/payment/PaymentReviewStep.tsx +1 -1
- package/src/ui/components/payment/PaymentSuccessStep.tsx +1 -1
- package/src/ui/components/payment/PaymentSummaryStep.tsx +1 -1
- package/src/ui/components/payment/types.ts +1 -1
- package/src/ui/context/OxyContext.tsx +220 -24
- package/src/ui/context/__tests__/commitSessionFlow.test.ts +89 -0
- package/src/ui/context/commitSessionFlow.ts +61 -0
- package/src/ui/context/oxyContextTypes.ts +45 -1
- package/src/ui/context/useOxyAccountGraph.ts +19 -5
- package/src/ui/hooks/useSwitchableAccounts.ts +12 -1
- package/src/ui/index.ts +0 -1
- package/src/ui/oauth/__tests__/browserAuthTransport.test.ts +335 -0
- package/src/ui/oauth/__tests__/completeOAuthCode.test.ts +142 -0
- package/src/ui/oauth/__tests__/oauthPopup.test.ts +326 -0
- package/src/ui/oauth/__tests__/oauthPopupMessages.test.ts +189 -0
- package/src/ui/oauth/__tests__/sharedCompletionPath.test.ts +174 -0
- package/src/ui/oauth/browserAuthTransport.ts +187 -0
- package/src/ui/oauth/completeOAuthCode.ts +93 -0
- package/src/ui/oauth/legacyRedirectLanes.ts +43 -0
- package/src/ui/oauth/oauthHandshake.ts +74 -0
- package/src/ui/oauth/oauthPopup.ts +219 -0
- package/src/ui/oauth/oauthPopupMessages.ts +136 -0
- package/src/ui/oauth/types.ts +150 -0
- package/src/ui/screens/AccountMembersScreen.tsx +1 -1
- package/src/ui/screens/CreateAccountScreen.tsx +1 -1
- package/src/ui/screens/EditProfileFieldScreen.tsx +1 -1
- package/src/ui/screens/FAQScreen.tsx +1 -1
- package/src/ui/screens/FeedbackScreen.tsx +2 -1
- package/src/ui/screens/FileManagementScreen.tsx +2 -1
- package/src/ui/screens/LanguageSelectorScreen.tsx +1 -1
- package/src/ui/screens/ManageAccountScreen.tsx +1 -1
- package/src/ui/screens/PaymentGatewayScreen.tsx +1 -1
- package/src/ui/screens/PremiumSubscriptionScreen.tsx +1 -1
- package/src/ui/screens/ProfileScreen.tsx +1 -1
- package/src/ui/screens/UserListScreen.tsx +1 -1
- package/src/ui/screens/WelcomeNewUserScreen.tsx +1 -1
- package/src/ui/screens/fileManagement/FileLibraryError.tsx +1 -1
- package/src/ui/screens/fileManagement/FileListSection.tsx +1 -1
- package/src/ui/screens/fileManagement/PhotoPickerSection.tsx +2 -1
- package/src/ui/screens/fileManagement/UploadBar.tsx +1 -1
- package/src/ui/screens/trust/TrustCenterScreen.tsx +1 -1
- package/src/ui/screens/trust/TrustLeaderboardScreen.tsx +1 -1
- package/src/ui/screens/trust/TrustRewardsScreen.tsx +1 -1
- package/src/ui/server.ts +0 -2
- package/src/ui/session/__tests__/createSessionClient.test.ts +26 -0
- package/src/ui/session/__tests__/tokenTransport.test.ts +34 -0
- package/src/ui/session/authStore.ts +5 -89
- package/src/ui/session/createSessionClient.ts +15 -2
- package/src/ui/session/identityBinding.ts +116 -0
- package/src/ui/session/index.ts +6 -2
- package/src/ui/session/nativeSecureStorage.ts +98 -0
- package/src/ui/session/tokenTransport.ts +14 -1
- package/src/ui/types/navigation.ts +44 -1
- package/src/ui/utils/crossOriginRestore.ts +4 -7
- package/src/ui/utils/deliveryPlatform.ts +65 -0
- package/src/ui/utils/fileManagement.ts +1 -1
- package/src/ui/utils/oauthReturn.ts +74 -65
- package/lib/commonjs/assets/assets/fonts/Inter/Inter_18pt-Black.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/Inter/Inter_18pt-Bold.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/Inter/Inter_18pt-ExtraBold.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/Inter/Inter_18pt-Light.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/Inter/Inter_18pt-Medium.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/Inter/Inter_18pt-Regular.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/Inter/Inter_18pt-SemiBold.ttf +0 -0
- package/lib/commonjs/assets/fonts/Inter/Inter_18pt-Black.ttf +0 -0
- package/lib/commonjs/assets/fonts/Inter/Inter_18pt-Bold.ttf +0 -0
- package/lib/commonjs/assets/fonts/Inter/Inter_18pt-ExtraBold.ttf +0 -0
- package/lib/commonjs/assets/fonts/Inter/Inter_18pt-Light.ttf +0 -0
- package/lib/commonjs/assets/fonts/Inter/Inter_18pt-Medium.ttf +0 -0
- package/lib/commonjs/assets/fonts/Inter/Inter_18pt-Regular.ttf +0 -0
- package/lib/commonjs/assets/fonts/Inter/Inter_18pt-SemiBold.ttf +0 -0
- package/lib/commonjs/ui/components/FontLoader.js +0 -35
- package/lib/commonjs/ui/components/FontLoader.js.map +0 -1
- package/lib/commonjs/ui/components/FontLoader.native.js +0 -88
- package/lib/commonjs/ui/components/FontLoader.native.js.map +0 -1
- package/lib/commonjs/ui/components/oxyAuthChooserStyles.js.map +0 -1
- package/lib/module/assets/assets/fonts/Inter/Inter_18pt-Black.ttf +0 -0
- package/lib/module/assets/assets/fonts/Inter/Inter_18pt-Bold.ttf +0 -0
- package/lib/module/assets/assets/fonts/Inter/Inter_18pt-ExtraBold.ttf +0 -0
- package/lib/module/assets/assets/fonts/Inter/Inter_18pt-Light.ttf +0 -0
- package/lib/module/assets/assets/fonts/Inter/Inter_18pt-Medium.ttf +0 -0
- package/lib/module/assets/assets/fonts/Inter/Inter_18pt-Regular.ttf +0 -0
- package/lib/module/assets/assets/fonts/Inter/Inter_18pt-SemiBold.ttf +0 -0
- package/lib/module/assets/fonts/Inter/Inter_18pt-Black.ttf +0 -0
- package/lib/module/assets/fonts/Inter/Inter_18pt-Bold.ttf +0 -0
- package/lib/module/assets/fonts/Inter/Inter_18pt-ExtraBold.ttf +0 -0
- package/lib/module/assets/fonts/Inter/Inter_18pt-Light.ttf +0 -0
- package/lib/module/assets/fonts/Inter/Inter_18pt-Medium.ttf +0 -0
- package/lib/module/assets/fonts/Inter/Inter_18pt-Regular.ttf +0 -0
- package/lib/module/assets/fonts/Inter/Inter_18pt-SemiBold.ttf +0 -0
- package/lib/module/ui/components/FontLoader.js +0 -29
- package/lib/module/ui/components/FontLoader.js.map +0 -1
- package/lib/module/ui/components/FontLoader.native.js +0 -83
- package/lib/module/ui/components/FontLoader.native.js.map +0 -1
- package/lib/module/ui/components/oxyAuthChooserStyles.js.map +0 -1
- package/lib/typescript/commonjs/ui/components/FontLoader.d.ts +0 -24
- package/lib/typescript/commonjs/ui/components/FontLoader.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/components/FontLoader.native.d.ts +0 -13
- package/lib/typescript/commonjs/ui/components/FontLoader.native.d.ts.map +0 -1
- package/lib/typescript/commonjs/ui/components/oxyAuthChooserStyles.d.ts.map +0 -1
- package/lib/typescript/module/ui/components/FontLoader.d.ts +0 -24
- package/lib/typescript/module/ui/components/FontLoader.d.ts.map +0 -1
- package/lib/typescript/module/ui/components/FontLoader.native.d.ts +0 -13
- package/lib/typescript/module/ui/components/FontLoader.native.d.ts.map +0 -1
- package/lib/typescript/module/ui/components/oxyAuthChooserStyles.d.ts.map +0 -1
- package/src/assets/fonts/Inter/Inter_18pt-Black.ttf +0 -0
- package/src/assets/fonts/Inter/Inter_18pt-Bold.ttf +0 -0
- package/src/assets/fonts/Inter/Inter_18pt-ExtraBold.ttf +0 -0
- package/src/assets/fonts/Inter/Inter_18pt-Light.ttf +0 -0
- package/src/assets/fonts/Inter/Inter_18pt-Medium.ttf +0 -0
- package/src/assets/fonts/Inter/Inter_18pt-Regular.ttf +0 -0
- package/src/assets/fonts/Inter/Inter_18pt-SemiBold.ttf +0 -0
- package/src/ui/components/FontLoader.native.tsx +0 -88
- package/src/ui/components/FontLoader.tsx +0 -27
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
import {
|
|
2
|
+
awaitOAuthPopupResult,
|
|
3
|
+
closeOAuthPopup,
|
|
4
|
+
navigateOAuthPopup,
|
|
5
|
+
openOAuthPopup,
|
|
6
|
+
OXY_OAUTH_POPUP_WINDOW_NAME,
|
|
7
|
+
} from '../oauthPopup';
|
|
8
|
+
import { OXY_OAUTH_CODE_MESSAGE_TYPE, OXY_OAUTH_ERROR_MESSAGE_TYPE } from '../oauthPopupMessages';
|
|
9
|
+
import type { OAuthPopupHandle, OAuthPopupOutcome } from '../types';
|
|
10
|
+
|
|
11
|
+
const IDP_ORIGIN = 'https://auth.oxy.so';
|
|
12
|
+
const STATE = 'state-abc';
|
|
13
|
+
|
|
14
|
+
interface ControllablePopup extends OAuthPopupHandle {
|
|
15
|
+
close: jest.Mock;
|
|
16
|
+
setClosed: () => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function fakePopup(): ControllablePopup {
|
|
20
|
+
let closed = false;
|
|
21
|
+
return {
|
|
22
|
+
get closed() {
|
|
23
|
+
return closed;
|
|
24
|
+
},
|
|
25
|
+
close: jest.fn(() => {
|
|
26
|
+
closed = true;
|
|
27
|
+
}),
|
|
28
|
+
location: { href: '' },
|
|
29
|
+
setClosed: () => {
|
|
30
|
+
closed = true;
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function dispatchMessage(init: { data: unknown; origin: string; source: unknown }): void {
|
|
36
|
+
const event = new Event('message');
|
|
37
|
+
Object.assign(event, init);
|
|
38
|
+
window.dispatchEvent(event);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function codeMessage(source: unknown, state = STATE, origin = IDP_ORIGIN) {
|
|
42
|
+
return {
|
|
43
|
+
data: { type: OXY_OAUTH_CODE_MESSAGE_TYPE, code: 'code-1', state },
|
|
44
|
+
origin,
|
|
45
|
+
source,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** Resolve the outcome, or `'pending'` when the promise has not settled yet. */
|
|
50
|
+
async function outcomeOrPending(
|
|
51
|
+
promise: Promise<OAuthPopupOutcome>,
|
|
52
|
+
): Promise<OAuthPopupOutcome | 'pending'> {
|
|
53
|
+
return Promise.race([
|
|
54
|
+
promise,
|
|
55
|
+
Promise.resolve().then(() => 'pending' as const),
|
|
56
|
+
]);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
describe('openOAuthPopup', () => {
|
|
60
|
+
afterEach(() => {
|
|
61
|
+
jest.restoreAllMocks();
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('opens an empty, named window so a second press reuses it', () => {
|
|
65
|
+
const handle = fakePopup();
|
|
66
|
+
const openSpy = jest
|
|
67
|
+
.spyOn(window, 'open')
|
|
68
|
+
.mockReturnValue(handle as unknown as Window);
|
|
69
|
+
|
|
70
|
+
expect(openOAuthPopup()).toBe(handle);
|
|
71
|
+
expect(openSpy).toHaveBeenCalledWith('', OXY_OAUTH_POPUP_WINDOW_NAME, expect.any(String));
|
|
72
|
+
// The window is navigated later, once the authorize URL exists.
|
|
73
|
+
expect(openSpy.mock.calls[0][0]).toBe('');
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('returns null when the browser blocks the popup', () => {
|
|
77
|
+
jest.spyOn(window, 'open').mockReturnValue(null);
|
|
78
|
+
expect(openOAuthPopup()).toBeNull();
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it('returns null instead of throwing when window.open throws', () => {
|
|
82
|
+
jest.spyOn(window, 'open').mockImplementation(() => {
|
|
83
|
+
throw new Error('blocked');
|
|
84
|
+
});
|
|
85
|
+
expect(openOAuthPopup()).toBeNull();
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
describe('navigateOAuthPopup', () => {
|
|
90
|
+
it('points the popup at the authorize URL', () => {
|
|
91
|
+
const popup = fakePopup();
|
|
92
|
+
expect(navigateOAuthPopup(popup, `${IDP_ORIGIN}/authorize?x=1`)).toBe(true);
|
|
93
|
+
expect(popup.location.href).toBe(`${IDP_ORIGIN}/authorize?x=1`);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
it('reports failure instead of throwing when the window is gone', () => {
|
|
97
|
+
const popup: OAuthPopupHandle = {
|
|
98
|
+
closed: true,
|
|
99
|
+
close: () => undefined,
|
|
100
|
+
get location(): { href: string } {
|
|
101
|
+
throw new Error('window closed');
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
expect(navigateOAuthPopup(popup, `${IDP_ORIGIN}/authorize`)).toBe(false);
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
describe('closeOAuthPopup', () => {
|
|
109
|
+
it('is a no-op for null and for an already-closed window', () => {
|
|
110
|
+
expect(() => closeOAuthPopup(null)).not.toThrow();
|
|
111
|
+
const popup = fakePopup();
|
|
112
|
+
popup.setClosed();
|
|
113
|
+
closeOAuthPopup(popup);
|
|
114
|
+
expect(popup.close).not.toHaveBeenCalled();
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('closes an open window and swallows a close that throws', () => {
|
|
118
|
+
const popup = fakePopup();
|
|
119
|
+
closeOAuthPopup(popup);
|
|
120
|
+
expect(popup.close).toHaveBeenCalledTimes(1);
|
|
121
|
+
|
|
122
|
+
const hostile: OAuthPopupHandle = {
|
|
123
|
+
closed: false,
|
|
124
|
+
close: () => {
|
|
125
|
+
throw new Error('denied');
|
|
126
|
+
},
|
|
127
|
+
location: { href: '' },
|
|
128
|
+
};
|
|
129
|
+
expect(() => closeOAuthPopup(hostile)).not.toThrow();
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
describe('awaitOAuthPopupResult', () => {
|
|
134
|
+
let addSpy: jest.SpyInstance;
|
|
135
|
+
let removeSpy: jest.SpyInstance;
|
|
136
|
+
|
|
137
|
+
beforeEach(() => {
|
|
138
|
+
jest.useFakeTimers();
|
|
139
|
+
addSpy = jest.spyOn(window, 'addEventListener');
|
|
140
|
+
removeSpy = jest.spyOn(window, 'removeEventListener');
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
afterEach(() => {
|
|
144
|
+
jest.useRealTimers();
|
|
145
|
+
jest.restoreAllMocks();
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
/** Every exit path must leave zero listeners and zero timers behind. */
|
|
149
|
+
function expectFullCleanup(): void {
|
|
150
|
+
const registered = addSpy.mock.calls.filter(([type]) => type === 'message');
|
|
151
|
+
const removed = removeSpy.mock.calls.filter(([type]) => type === 'message');
|
|
152
|
+
expect(registered).toHaveLength(1);
|
|
153
|
+
expect(removed).toHaveLength(1);
|
|
154
|
+
expect(removed[0][1]).toBe(registered[0][1]);
|
|
155
|
+
expect(jest.getTimerCount()).toBe(0);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
it('resolves with the authorization code on a valid message', async () => {
|
|
159
|
+
const popup = fakePopup();
|
|
160
|
+
const promise = awaitOAuthPopupResult({
|
|
161
|
+
popup,
|
|
162
|
+
expectedOrigin: IDP_ORIGIN,
|
|
163
|
+
expectedState: STATE,
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
dispatchMessage(codeMessage(popup));
|
|
167
|
+
|
|
168
|
+
await expect(promise).resolves.toEqual({ kind: 'code', code: 'code-1', state: STATE });
|
|
169
|
+
expectFullCleanup();
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
it('resolves with a typed IdP error', async () => {
|
|
173
|
+
const popup = fakePopup();
|
|
174
|
+
const promise = awaitOAuthPopupResult({
|
|
175
|
+
popup,
|
|
176
|
+
expectedOrigin: IDP_ORIGIN,
|
|
177
|
+
expectedState: STATE,
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
dispatchMessage({
|
|
181
|
+
data: {
|
|
182
|
+
type: OXY_OAUTH_ERROR_MESSAGE_TYPE,
|
|
183
|
+
error: 'access_denied',
|
|
184
|
+
errorDescription: 'user declined',
|
|
185
|
+
state: STATE,
|
|
186
|
+
},
|
|
187
|
+
origin: IDP_ORIGIN,
|
|
188
|
+
source: popup,
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
await expect(promise).resolves.toEqual({
|
|
192
|
+
kind: 'oauth-error',
|
|
193
|
+
error: 'access_denied',
|
|
194
|
+
errorDescription: 'user declined',
|
|
195
|
+
});
|
|
196
|
+
expectFullCleanup();
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
it('resolves with a state mismatch when our popup answers another request', async () => {
|
|
200
|
+
const popup = fakePopup();
|
|
201
|
+
const promise = awaitOAuthPopupResult({
|
|
202
|
+
popup,
|
|
203
|
+
expectedOrigin: IDP_ORIGIN,
|
|
204
|
+
expectedState: STATE,
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
dispatchMessage(codeMessage(popup, 'a-different-state'));
|
|
208
|
+
|
|
209
|
+
await expect(promise).resolves.toEqual({ kind: 'state-mismatch' });
|
|
210
|
+
expectFullCleanup();
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
it.each([
|
|
214
|
+
['a foreign origin', () => codeMessage(fakePopup(), STATE, 'https://evil.example')],
|
|
215
|
+
['a foreign window', () => codeMessage(fakePopup())],
|
|
216
|
+
])('keeps waiting after a message from %s', async (_label, build) => {
|
|
217
|
+
const popup = fakePopup();
|
|
218
|
+
const promise = awaitOAuthPopupResult({
|
|
219
|
+
popup,
|
|
220
|
+
expectedOrigin: IDP_ORIGIN,
|
|
221
|
+
expectedState: STATE,
|
|
222
|
+
timeoutMs: 60_000,
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
dispatchMessage(build());
|
|
226
|
+
expect(await outcomeOrPending(promise)).toBe('pending');
|
|
227
|
+
|
|
228
|
+
// The real popup can still complete the flow afterwards.
|
|
229
|
+
dispatchMessage(codeMessage(popup));
|
|
230
|
+
await expect(promise).resolves.toEqual({ kind: 'code', code: 'code-1', state: STATE });
|
|
231
|
+
expectFullCleanup();
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
it('keeps waiting after a malformed payload from the real popup', async () => {
|
|
235
|
+
const popup = fakePopup();
|
|
236
|
+
const promise = awaitOAuthPopupResult({
|
|
237
|
+
popup,
|
|
238
|
+
expectedOrigin: IDP_ORIGIN,
|
|
239
|
+
expectedState: STATE,
|
|
240
|
+
timeoutMs: 60_000,
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
dispatchMessage({ data: { type: 'oxy:oauth:code' }, origin: IDP_ORIGIN, source: popup });
|
|
244
|
+
expect(await outcomeOrPending(promise)).toBe('pending');
|
|
245
|
+
|
|
246
|
+
dispatchMessage(codeMessage(popup));
|
|
247
|
+
await expect(promise).resolves.toEqual({ kind: 'code', code: 'code-1', state: STATE });
|
|
248
|
+
expectFullCleanup();
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
it('ignores a duplicate result: the first message wins and the listener is gone', async () => {
|
|
252
|
+
const popup = fakePopup();
|
|
253
|
+
const promise = awaitOAuthPopupResult({
|
|
254
|
+
popup,
|
|
255
|
+
expectedOrigin: IDP_ORIGIN,
|
|
256
|
+
expectedState: STATE,
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
dispatchMessage(codeMessage(popup));
|
|
260
|
+
await expect(promise).resolves.toEqual({ kind: 'code', code: 'code-1', state: STATE });
|
|
261
|
+
|
|
262
|
+
// A late redelivery (or a second, contradicting message) reaches nothing.
|
|
263
|
+
expect(() =>
|
|
264
|
+
dispatchMessage({
|
|
265
|
+
data: { type: OXY_OAUTH_ERROR_MESSAGE_TYPE, error: 'access_denied', state: STATE },
|
|
266
|
+
origin: IDP_ORIGIN,
|
|
267
|
+
source: popup,
|
|
268
|
+
}),
|
|
269
|
+
).not.toThrow();
|
|
270
|
+
await expect(promise).resolves.toEqual({ kind: 'code', code: 'code-1', state: STATE });
|
|
271
|
+
expectFullCleanup();
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
it('reports cancellation once the user closes the window', async () => {
|
|
275
|
+
const popup = fakePopup();
|
|
276
|
+
const promise = awaitOAuthPopupResult({
|
|
277
|
+
popup,
|
|
278
|
+
expectedOrigin: IDP_ORIGIN,
|
|
279
|
+
expectedState: STATE,
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
popup.setClosed();
|
|
283
|
+
jest.advanceTimersByTime(1000);
|
|
284
|
+
// The close is not reported instantly: an already-queued message may still win.
|
|
285
|
+
expect(await outcomeOrPending(promise)).toBe('pending');
|
|
286
|
+
|
|
287
|
+
jest.advanceTimersByTime(400);
|
|
288
|
+
await expect(promise).resolves.toEqual({ kind: 'closed' });
|
|
289
|
+
expectFullCleanup();
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
it('lets a result that arrived just before the close win the race', async () => {
|
|
293
|
+
const popup = fakePopup();
|
|
294
|
+
const promise = awaitOAuthPopupResult({
|
|
295
|
+
popup,
|
|
296
|
+
expectedOrigin: IDP_ORIGIN,
|
|
297
|
+
expectedState: STATE,
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
// The IdP posts its result and immediately closes itself.
|
|
301
|
+
popup.setClosed();
|
|
302
|
+
jest.advanceTimersByTime(1000);
|
|
303
|
+
dispatchMessage(codeMessage(popup));
|
|
304
|
+
jest.advanceTimersByTime(1000);
|
|
305
|
+
|
|
306
|
+
await expect(promise).resolves.toEqual({ kind: 'code', code: 'code-1', state: STATE });
|
|
307
|
+
expectFullCleanup();
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
it('times out when nothing ever answers', async () => {
|
|
311
|
+
const popup = fakePopup();
|
|
312
|
+
const promise = awaitOAuthPopupResult({
|
|
313
|
+
popup,
|
|
314
|
+
expectedOrigin: IDP_ORIGIN,
|
|
315
|
+
expectedState: STATE,
|
|
316
|
+
timeoutMs: 30_000,
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
jest.advanceTimersByTime(29_999);
|
|
320
|
+
expect(await outcomeOrPending(promise)).toBe('pending');
|
|
321
|
+
|
|
322
|
+
jest.advanceTimersByTime(1);
|
|
323
|
+
await expect(promise).resolves.toEqual({ kind: 'timed-out' });
|
|
324
|
+
expectFullCleanup();
|
|
325
|
+
});
|
|
326
|
+
});
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import {
|
|
2
|
+
OXY_OAUTH_CODE_MESSAGE_TYPE,
|
|
3
|
+
OXY_OAUTH_ERROR_MESSAGE_TYPE,
|
|
4
|
+
parseOAuthPopupMessage,
|
|
5
|
+
readOAuthPopupMessage,
|
|
6
|
+
} from '../oauthPopupMessages';
|
|
7
|
+
import type { OAuthPopupHandle } from '../types';
|
|
8
|
+
|
|
9
|
+
const IDP_ORIGIN = 'https://auth.oxy.so';
|
|
10
|
+
const STATE = 'state-abc';
|
|
11
|
+
|
|
12
|
+
/** A stand-in for the popup `Window`; identity is all the validator compares. */
|
|
13
|
+
function fakePopup(): OAuthPopupHandle {
|
|
14
|
+
return { closed: false, close: () => undefined, location: { href: '' } };
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Build a `message` event with attacker-controllable fields. jsdom's
|
|
19
|
+
* `MessageEvent` constructor refuses a non-`Window` `source`, so the event is
|
|
20
|
+
* assembled the way the browser hands it to the listener instead.
|
|
21
|
+
*/
|
|
22
|
+
function makeMessageEvent(init: {
|
|
23
|
+
data: unknown;
|
|
24
|
+
origin: string;
|
|
25
|
+
source: unknown;
|
|
26
|
+
}): MessageEvent {
|
|
27
|
+
const event = new Event('message');
|
|
28
|
+
Object.assign(event, init);
|
|
29
|
+
return event as MessageEvent;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
describe('parseOAuthPopupMessage', () => {
|
|
33
|
+
it('accepts a well-formed code message', () => {
|
|
34
|
+
expect(
|
|
35
|
+
parseOAuthPopupMessage({ type: OXY_OAUTH_CODE_MESSAGE_TYPE, code: 'c1', state: STATE }),
|
|
36
|
+
).toEqual({ type: OXY_OAUTH_CODE_MESSAGE_TYPE, code: 'c1', state: STATE });
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('accepts a well-formed error message and its optional fields', () => {
|
|
40
|
+
expect(
|
|
41
|
+
parseOAuthPopupMessage({
|
|
42
|
+
type: OXY_OAUTH_ERROR_MESSAGE_TYPE,
|
|
43
|
+
error: 'access_denied',
|
|
44
|
+
errorDescription: 'user said no',
|
|
45
|
+
state: STATE,
|
|
46
|
+
}),
|
|
47
|
+
).toEqual({
|
|
48
|
+
type: OXY_OAUTH_ERROR_MESSAGE_TYPE,
|
|
49
|
+
error: 'access_denied',
|
|
50
|
+
errorDescription: 'user said no',
|
|
51
|
+
state: STATE,
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it('drops optional error fields that are not non-empty strings', () => {
|
|
56
|
+
expect(
|
|
57
|
+
parseOAuthPopupMessage({
|
|
58
|
+
type: OXY_OAUTH_ERROR_MESSAGE_TYPE,
|
|
59
|
+
error: 'server_error',
|
|
60
|
+
errorDescription: 42,
|
|
61
|
+
state: '',
|
|
62
|
+
}),
|
|
63
|
+
).toEqual({ type: OXY_OAUTH_ERROR_MESSAGE_TYPE, error: 'server_error' });
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('never surfaces extra properties a sender smuggled in', () => {
|
|
67
|
+
const parsed = parseOAuthPopupMessage({
|
|
68
|
+
type: OXY_OAUTH_CODE_MESSAGE_TYPE,
|
|
69
|
+
code: 'c1',
|
|
70
|
+
state: STATE,
|
|
71
|
+
accessToken: 'leaked',
|
|
72
|
+
deviceSecret: 'leaked',
|
|
73
|
+
});
|
|
74
|
+
expect(parsed).toEqual({ type: OXY_OAUTH_CODE_MESSAGE_TYPE, code: 'c1', state: STATE });
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it.each([
|
|
78
|
+
['null', null],
|
|
79
|
+
['undefined', undefined],
|
|
80
|
+
['a string', 'oxy:oauth:code'],
|
|
81
|
+
['a number', 7],
|
|
82
|
+
['an array', [{ type: OXY_OAUTH_CODE_MESSAGE_TYPE, code: 'c', state: STATE }]],
|
|
83
|
+
['an unknown type', { type: 'oxy:oauth:token', code: 'c', state: STATE }],
|
|
84
|
+
['a code message with no code', { type: OXY_OAUTH_CODE_MESSAGE_TYPE, state: STATE }],
|
|
85
|
+
['a code message with an empty code', { type: OXY_OAUTH_CODE_MESSAGE_TYPE, code: '', state: STATE }],
|
|
86
|
+
['a code message with no state', { type: OXY_OAUTH_CODE_MESSAGE_TYPE, code: 'c' }],
|
|
87
|
+
['a code message with a non-string code', { type: OXY_OAUTH_CODE_MESSAGE_TYPE, code: 1, state: STATE }],
|
|
88
|
+
['an error message with no error', { type: OXY_OAUTH_ERROR_MESSAGE_TYPE, state: STATE }],
|
|
89
|
+
])('rejects %s', (_label, data) => {
|
|
90
|
+
expect(parseOAuthPopupMessage(data)).toBeNull();
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
describe('readOAuthPopupMessage', () => {
|
|
95
|
+
const popup = fakePopup();
|
|
96
|
+
const context = { expectedOrigin: IDP_ORIGIN, expectedState: STATE, popup };
|
|
97
|
+
|
|
98
|
+
it('returns the code when origin, source, shape and state all match', () => {
|
|
99
|
+
const verdict = readOAuthPopupMessage(
|
|
100
|
+
makeMessageEvent({
|
|
101
|
+
data: { type: OXY_OAUTH_CODE_MESSAGE_TYPE, code: 'c1', state: STATE },
|
|
102
|
+
origin: IDP_ORIGIN,
|
|
103
|
+
source: popup,
|
|
104
|
+
}),
|
|
105
|
+
context,
|
|
106
|
+
);
|
|
107
|
+
expect(verdict).toEqual({ kind: 'code', code: 'c1', state: STATE });
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it('ignores a message from another origin, even with a valid payload', () => {
|
|
111
|
+
const verdict = readOAuthPopupMessage(
|
|
112
|
+
makeMessageEvent({
|
|
113
|
+
data: { type: OXY_OAUTH_CODE_MESSAGE_TYPE, code: 'evil', state: STATE },
|
|
114
|
+
origin: 'https://evil.example',
|
|
115
|
+
source: popup,
|
|
116
|
+
}),
|
|
117
|
+
context,
|
|
118
|
+
);
|
|
119
|
+
expect(verdict).toEqual({ kind: 'ignore' });
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it('ignores a message from a window that is not the popup we opened', () => {
|
|
123
|
+
const verdict = readOAuthPopupMessage(
|
|
124
|
+
makeMessageEvent({
|
|
125
|
+
data: { type: OXY_OAUTH_CODE_MESSAGE_TYPE, code: 'evil', state: STATE },
|
|
126
|
+
origin: IDP_ORIGIN,
|
|
127
|
+
source: fakePopup(),
|
|
128
|
+
}),
|
|
129
|
+
context,
|
|
130
|
+
);
|
|
131
|
+
expect(verdict).toEqual({ kind: 'ignore' });
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it('ignores a message with no source at all', () => {
|
|
135
|
+
const verdict = readOAuthPopupMessage(
|
|
136
|
+
makeMessageEvent({
|
|
137
|
+
data: { type: OXY_OAUTH_CODE_MESSAGE_TYPE, code: 'c1', state: STATE },
|
|
138
|
+
origin: IDP_ORIGIN,
|
|
139
|
+
source: null,
|
|
140
|
+
}),
|
|
141
|
+
context,
|
|
142
|
+
);
|
|
143
|
+
expect(verdict).toEqual({ kind: 'ignore' });
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
it('ignores a malformed payload from the real popup', () => {
|
|
147
|
+
const verdict = readOAuthPopupMessage(
|
|
148
|
+
makeMessageEvent({ data: { hello: 'world' }, origin: IDP_ORIGIN, source: popup }),
|
|
149
|
+
context,
|
|
150
|
+
);
|
|
151
|
+
expect(verdict).toEqual({ kind: 'ignore' });
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
it('reports a state mismatch on a code message bound to another request', () => {
|
|
155
|
+
const verdict = readOAuthPopupMessage(
|
|
156
|
+
makeMessageEvent({
|
|
157
|
+
data: { type: OXY_OAUTH_CODE_MESSAGE_TYPE, code: 'c1', state: 'other-state' },
|
|
158
|
+
origin: IDP_ORIGIN,
|
|
159
|
+
source: popup,
|
|
160
|
+
}),
|
|
161
|
+
context,
|
|
162
|
+
);
|
|
163
|
+
expect(verdict).toEqual({ kind: 'state-mismatch' });
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it('accepts an error message that carries no state', () => {
|
|
167
|
+
const verdict = readOAuthPopupMessage(
|
|
168
|
+
makeMessageEvent({
|
|
169
|
+
data: { type: OXY_OAUTH_ERROR_MESSAGE_TYPE, error: 'access_denied' },
|
|
170
|
+
origin: IDP_ORIGIN,
|
|
171
|
+
source: popup,
|
|
172
|
+
}),
|
|
173
|
+
context,
|
|
174
|
+
);
|
|
175
|
+
expect(verdict).toEqual({ kind: 'oauth-error', error: 'access_denied' });
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
it('reports a state mismatch on an error message bound to another request', () => {
|
|
179
|
+
const verdict = readOAuthPopupMessage(
|
|
180
|
+
makeMessageEvent({
|
|
181
|
+
data: { type: OXY_OAUTH_ERROR_MESSAGE_TYPE, error: 'access_denied', state: 'other' },
|
|
182
|
+
origin: IDP_ORIGIN,
|
|
183
|
+
source: popup,
|
|
184
|
+
}),
|
|
185
|
+
context,
|
|
186
|
+
);
|
|
187
|
+
expect(verdict).toEqual({ kind: 'state-mismatch' });
|
|
188
|
+
});
|
|
189
|
+
});
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Both web transports MUST finish through the same completion function.
|
|
3
|
+
*
|
|
4
|
+
* A duplicated exchange/commit implementation is how the popup and redirect
|
|
5
|
+
* lanes would silently drift apart on `state` validation, PKCE replay, or the
|
|
6
|
+
* session commit — so this suite mocks `completeOAuthCode` and proves each lane
|
|
7
|
+
* routes through it and performs no exchange of its own.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
jest.mock('../completeOAuthCode', () => ({
|
|
11
|
+
completeOAuthCode: jest.fn(),
|
|
12
|
+
}));
|
|
13
|
+
jest.mock('../../components/oauthNavigation', () => ({
|
|
14
|
+
redirectToAuthorize: jest.fn(),
|
|
15
|
+
}));
|
|
16
|
+
|
|
17
|
+
import type { OxyServices } from '@oxyhq/core';
|
|
18
|
+
import {
|
|
19
|
+
OXY_OAUTH_CODE_VERIFIER_STORAGE_KEY,
|
|
20
|
+
OXY_OAUTH_STATE_STORAGE_KEY,
|
|
21
|
+
} from '@oxyhq/core';
|
|
22
|
+
import { tryCompleteOAuthReturn } from '../../utils/oauthReturn';
|
|
23
|
+
import { startWebOAuthSignIn, type WebOAuthTransportContext } from '../browserAuthTransport';
|
|
24
|
+
import { completeOAuthCode } from '../completeOAuthCode';
|
|
25
|
+
import { OXY_OAUTH_CODE_MESSAGE_TYPE } from '../oauthPopupMessages';
|
|
26
|
+
import type { CompleteOAuthCodeInput } from '../completeOAuthCode';
|
|
27
|
+
import type { OAuthPopupHandle } from '../types';
|
|
28
|
+
|
|
29
|
+
const mockCompleteOAuthCode = completeOAuthCode as jest.Mock;
|
|
30
|
+
|
|
31
|
+
const CLIENT_ID = 'oxy_dk_test';
|
|
32
|
+
const REDIRECT_URI = 'https://mention.earth';
|
|
33
|
+
const IDP_ORIGIN = 'https://auth.oxy.so';
|
|
34
|
+
|
|
35
|
+
function fakePopup(): OAuthPopupHandle {
|
|
36
|
+
return { closed: false, close: jest.fn(), location: { href: '' } };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function makeContext(mode: 'popup' | 'redirect'): WebOAuthTransportContext & {
|
|
40
|
+
exchangeOAuthCode: jest.Mock;
|
|
41
|
+
} {
|
|
42
|
+
const exchangeOAuthCode = jest.fn();
|
|
43
|
+
return {
|
|
44
|
+
mode,
|
|
45
|
+
oxyServices: { exchangeOAuthCode } as unknown as OxyServices,
|
|
46
|
+
clientId: CLIENT_ID,
|
|
47
|
+
authorizeBaseUrl: `${IDP_ORIGIN}/authorize`,
|
|
48
|
+
identityBound: false,
|
|
49
|
+
commitSession: jest.fn().mockResolvedValue(undefined),
|
|
50
|
+
exchangeOAuthCode,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async function waitForAuthorizeUrl(popup: OAuthPopupHandle): Promise<URL> {
|
|
55
|
+
for (let attempt = 0; attempt < 100; attempt += 1) {
|
|
56
|
+
if (popup.location.href) return new URL(popup.location.href);
|
|
57
|
+
await new Promise((resolve) => {
|
|
58
|
+
setTimeout(resolve, 5);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
throw new Error('the popup was never navigated to the authorize URL');
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
describe('shared OAuth completion path', () => {
|
|
65
|
+
beforeEach(() => {
|
|
66
|
+
mockCompleteOAuthCode.mockReset();
|
|
67
|
+
mockCompleteOAuthCode.mockResolvedValue({ ok: true });
|
|
68
|
+
globalThis.sessionStorage?.clear();
|
|
69
|
+
window.history.replaceState({}, '', '/');
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it('the popup transport completes through completeOAuthCode with its in-memory handshake', async () => {
|
|
73
|
+
const context = makeContext('popup');
|
|
74
|
+
const popup = fakePopup();
|
|
75
|
+
|
|
76
|
+
const pending = startWebOAuthSignIn(context, { redirectUri: REDIRECT_URI, popup });
|
|
77
|
+
const authorizeUrl = await waitForAuthorizeUrl(popup);
|
|
78
|
+
const state = authorizeUrl.searchParams.get('state');
|
|
79
|
+
const event = new Event('message');
|
|
80
|
+
Object.assign(event, {
|
|
81
|
+
data: { type: OXY_OAUTH_CODE_MESSAGE_TYPE, code: 'code-1', state },
|
|
82
|
+
origin: IDP_ORIGIN,
|
|
83
|
+
source: popup,
|
|
84
|
+
});
|
|
85
|
+
window.dispatchEvent(event);
|
|
86
|
+
|
|
87
|
+
await expect(pending).resolves.toEqual({ status: 'signed-in' });
|
|
88
|
+
|
|
89
|
+
expect(mockCompleteOAuthCode).toHaveBeenCalledTimes(1);
|
|
90
|
+
const input = mockCompleteOAuthCode.mock.calls[0][0] as CompleteOAuthCodeInput;
|
|
91
|
+
expect(input.code).toBe('code-1');
|
|
92
|
+
expect(input.clientId).toBe(CLIENT_ID);
|
|
93
|
+
expect(input.redirectUri).toBe(REDIRECT_URI);
|
|
94
|
+
expect(input.returnedState).toBe(state);
|
|
95
|
+
expect(input.handshake?.state).toBe(state);
|
|
96
|
+
expect(input.handshake?.codeVerifier).toEqual(expect.any(String));
|
|
97
|
+
// Nothing was persisted, so there is nothing for this lane to clean up.
|
|
98
|
+
expect(input.cleanup).toBeUndefined();
|
|
99
|
+
// The transport never exchanges the code itself.
|
|
100
|
+
expect(context.exchangeOAuthCode).not.toHaveBeenCalled();
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('the redirect return leg completes through completeOAuthCode with the persisted handshake', async () => {
|
|
104
|
+
const exchangeOAuthCode = jest.fn();
|
|
105
|
+
const oxyServices = { exchangeOAuthCode } as unknown as OxyServices;
|
|
106
|
+
sessionStorage.setItem(OXY_OAUTH_STATE_STORAGE_KEY, 'state-from-storage');
|
|
107
|
+
sessionStorage.setItem(OXY_OAUTH_CODE_VERIFIER_STORAGE_KEY, 'verifier-from-storage');
|
|
108
|
+
window.history.replaceState({}, '', '/feed?code=code-2&state=state-from-storage');
|
|
109
|
+
|
|
110
|
+
await expect(
|
|
111
|
+
tryCompleteOAuthReturn({
|
|
112
|
+
oxyServices,
|
|
113
|
+
clientId: CLIENT_ID,
|
|
114
|
+
authRedirectUri: REDIRECT_URI,
|
|
115
|
+
commitSession: jest.fn().mockResolvedValue(undefined),
|
|
116
|
+
}),
|
|
117
|
+
).resolves.toBe(true);
|
|
118
|
+
|
|
119
|
+
expect(mockCompleteOAuthCode).toHaveBeenCalledTimes(1);
|
|
120
|
+
const input = mockCompleteOAuthCode.mock.calls[0][0] as CompleteOAuthCodeInput;
|
|
121
|
+
expect(input.code).toBe('code-2');
|
|
122
|
+
expect(input.returnedState).toBe('state-from-storage');
|
|
123
|
+
expect(input.handshake).toEqual({
|
|
124
|
+
state: 'state-from-storage',
|
|
125
|
+
codeVerifier: 'verifier-from-storage',
|
|
126
|
+
});
|
|
127
|
+
expect(input.redirectUri).toBe(REDIRECT_URI);
|
|
128
|
+
// This lane DOES have persisted state + a dirty URL to clear.
|
|
129
|
+
expect(typeof input.cleanup).toBe('function');
|
|
130
|
+
// The return leg never exchanges the code itself.
|
|
131
|
+
expect(exchangeOAuthCode).not.toHaveBeenCalled();
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
it('reports the shared path failing rather than committing a session', async () => {
|
|
135
|
+
mockCompleteOAuthCode.mockResolvedValue({ ok: false, reason: 'state-mismatch' });
|
|
136
|
+
sessionStorage.setItem(OXY_OAUTH_STATE_STORAGE_KEY, 'state-from-storage');
|
|
137
|
+
sessionStorage.setItem(OXY_OAUTH_CODE_VERIFIER_STORAGE_KEY, 'verifier-from-storage');
|
|
138
|
+
window.history.replaceState({}, '', '/?code=code-3&state=state-from-storage');
|
|
139
|
+
|
|
140
|
+
await expect(
|
|
141
|
+
tryCompleteOAuthReturn({
|
|
142
|
+
oxyServices: { exchangeOAuthCode: jest.fn() } as unknown as OxyServices,
|
|
143
|
+
clientId: CLIENT_ID,
|
|
144
|
+
commitSession: jest.fn().mockResolvedValue(undefined),
|
|
145
|
+
}),
|
|
146
|
+
).resolves.toBe(false);
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
it('never reaches the shared path without a clientId', async () => {
|
|
150
|
+
window.history.replaceState({}, '', '/?code=code-4&state=state-from-storage');
|
|
151
|
+
|
|
152
|
+
await expect(
|
|
153
|
+
tryCompleteOAuthReturn({
|
|
154
|
+
oxyServices: { exchangeOAuthCode: jest.fn() } as unknown as OxyServices,
|
|
155
|
+
clientId: null,
|
|
156
|
+
commitSession: jest.fn().mockResolvedValue(undefined),
|
|
157
|
+
}),
|
|
158
|
+
).resolves.toBe(false);
|
|
159
|
+
expect(mockCompleteOAuthCode).not.toHaveBeenCalled();
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
it('never reaches the shared path when the IdP returned an error instead of a code', async () => {
|
|
163
|
+
window.history.replaceState({}, '', '/?error=access_denied&state=state-from-storage');
|
|
164
|
+
|
|
165
|
+
await expect(
|
|
166
|
+
tryCompleteOAuthReturn({
|
|
167
|
+
oxyServices: { exchangeOAuthCode: jest.fn() } as unknown as OxyServices,
|
|
168
|
+
clientId: CLIENT_ID,
|
|
169
|
+
commitSession: jest.fn().mockResolvedValue(undefined),
|
|
170
|
+
}),
|
|
171
|
+
).resolves.toBe(false);
|
|
172
|
+
expect(mockCompleteOAuthCode).not.toHaveBeenCalled();
|
|
173
|
+
});
|
|
174
|
+
});
|