@oxyhq/services 22.12.4 → 22.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -46
- package/lib/commonjs/index.js +18 -12
- package/lib/commonjs/index.js.map +1 -1
- 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/OxyAccountDialogScreen.js +27 -4
- package/lib/commonjs/ui/components/OxyAccountDialogScreen.js.map +1 -1
- package/lib/commonjs/ui/components/OxyAuthChooser.js +72 -1123
- 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/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 +144 -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 +63 -0
- package/lib/commonjs/ui/components/authChooser/TroubleDisclosure.js.map +1 -0
- package/lib/commonjs/ui/components/authChooser/primitives.js +169 -0
- package/lib/commonjs/ui/components/authChooser/primitives.js.map +1 -0
- package/lib/commonjs/ui/components/authChooser/requestSurfaces.js +149 -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 +59 -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/context/OxyContext.js +205 -30
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/context/commitSessionFlow.js +46 -0
- 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 +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 +170 -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 +276 -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/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 +5 -4
- 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 +72 -46
- package/lib/commonjs/ui/utils/oauthReturn.js.map +1 -1
- package/lib/module/index.js +9 -4
- package/lib/module/index.js.map +1 -1
- 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/OxyAccountDialogScreen.js +27 -4
- package/lib/module/ui/components/OxyAccountDialogScreen.js.map +1 -1
- package/lib/module/ui/components/OxyAuthChooser.js +76 -1128
- 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/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 +139 -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 +59 -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 +139 -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 +55 -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/context/OxyContext.js +208 -33
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/context/commitSessionFlow.js +45 -0
- 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 +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 +167 -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 +268 -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/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 +6 -5
- 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 +73 -47
- package/lib/module/ui/utils/oauthReturn.js.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +4 -1
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- 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 +21 -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/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 +43 -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 +54 -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 +85 -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/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/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 +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 +83 -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/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/oauthReturn.d.ts +30 -16
- package/lib/typescript/commonjs/ui/utils/oauthReturn.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +4 -1
- package/lib/typescript/module/index.d.ts.map +1 -1
- 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 +21 -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/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 +43 -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 +54 -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 +85 -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/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/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 +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 +83 -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/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/oauthReturn.d.ts +30 -16
- package/lib/typescript/module/ui/utils/oauthReturn.d.ts.map +1 -1
- package/package.json +6 -8
- package/src/index.ts +19 -5
- 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/OxyAccountDialogScreen.tsx +33 -4
- package/src/ui/components/OxyAuthChooser.tsx +100 -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/__tests__/OxyConsentScreen.test.tsx +27 -0
- package/src/ui/components/authChooser/AccountsMenuView.tsx +569 -0
- package/src/ui/components/authChooser/SignInEntryView.tsx +115 -0
- package/src/ui/components/authChooser/SignInRequestView.tsx +163 -0
- package/src/ui/components/authChooser/SignUpView.tsx +174 -0
- package/src/ui/components/authChooser/TroubleDisclosure.tsx +81 -0
- package/src/ui/components/authChooser/primitives.tsx +144 -0
- package/src/ui/components/authChooser/requestSurfaces.tsx +116 -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 +101 -0
- package/src/ui/components/authChooser/useUsernameAvailability.ts +60 -0
- package/src/ui/context/OxyContext.tsx +226 -24
- package/src/ui/context/__tests__/commitSessionFlow.test.ts +102 -0
- package/src/ui/context/commitSessionFlow.ts +64 -0
- package/src/ui/context/hooks/useAuthOperations.ts +26 -1
- 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 +352 -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 +193 -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 +277 -0
- package/src/ui/oauth/oauthPopupMessages.ts +136 -0
- package/src/ui/oauth/types.ts +150 -0
- 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/__tests__/crossOriginRestore.test.ts +17 -0
- package/src/ui/utils/crossOriginRestore.ts +9 -13
- package/src/ui/utils/deliveryPlatform.ts +65 -0
- package/src/ui/utils/oauthReturn.ts +79 -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
|
@@ -4,12 +4,16 @@
|
|
|
4
4
|
* `@oxyhq/core` owns the platform-agnostic `SessionClient`, its host adapter,
|
|
5
5
|
* and the pure `DeviceSessionState → services` projection helpers; those are
|
|
6
6
|
* re-exported straight from core here so `OxyContext` has one import site.
|
|
7
|
-
* `@oxyhq/services` supplies only the
|
|
7
|
+
* `@oxyhq/services` supplies only the platform pieces: the thin
|
|
8
8
|
* `createSessionClient` factory (injects socket.io-client `io` + the
|
|
9
|
-
* device-first token transport)
|
|
9
|
+
* device-first token transport), the `AuthStateStore` factory, and — for
|
|
10
|
+
* `sessionMode: 'identity'` — the identity binding (platform pin store + the
|
|
11
|
+
* memoised pinned account id).
|
|
10
12
|
*/
|
|
11
13
|
export { createSessionClient } from './createSessionClient.js';
|
|
12
14
|
export { createTokenTransport } from './tokenTransport.js';
|
|
13
15
|
export { createPlatformAuthStateStore } from './authStore.js';
|
|
16
|
+
export { createIdentitySessionBinding, IdentityBoundSessionError } from './identityBinding.js';
|
|
17
|
+
export type { IdentitySessionBinding } from './identityBinding.js';
|
|
14
18
|
export { createSessionClientHost, accountIdsOf, activeSessionIdOf, activeUserOf, deviceStateToClientSessions, } from '@oxyhq/core';
|
|
15
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/ui/session/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/ui/session/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAAuB,CAAC;AAC5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAkB,CAAC;AACxD,OAAO,EAAE,4BAA4B,EAAE,MAAM,gBAAa,CAAC;AAC3D,OAAO,EAAE,4BAA4B,EAAE,yBAAyB,EAAE,MAAM,sBAAmB,CAAC;AAC5F,YAAY,EAAE,sBAAsB,EAAE,MAAM,sBAAmB,CAAC;AAChE,OAAO,EACL,uBAAuB,EACvB,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,2BAA2B,GAC5B,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The native secure key/value seam every durable `@oxyhq/core` store in this
|
|
3
|
+
* package is built on.
|
|
4
|
+
*
|
|
5
|
+
* `@oxyhq/core` owns the store LOGIC (`createNativeAuthStateStore` for the
|
|
6
|
+
* zero-cookie device credential, `createNativeIdentityPinStore` for the identity
|
|
7
|
+
* pin) and takes its persistence as an injected `NativeKeyValueStorage`. This
|
|
8
|
+
* module supplies that injection ONCE, so those stores can never drift onto
|
|
9
|
+
* different backings — a device credential in SecureStore and a pin in
|
|
10
|
+
* AsyncStorage would resolve differently after a keystore reset.
|
|
11
|
+
*
|
|
12
|
+
* `expo-secure-store` is loaded via a runtime-computed dynamic import (the same
|
|
13
|
+
* optional-native-module pattern `OxyProvider` uses for netinfo / keyboard
|
|
14
|
+
* controller), so the web bundle never pulls it and a device without it falls
|
|
15
|
+
* back to AsyncStorage rather than crashing.
|
|
16
|
+
*/
|
|
17
|
+
import type { NativeKeyValueStorage } from '@oxyhq/core';
|
|
18
|
+
/**
|
|
19
|
+
* A native `NativeKeyValueStorage` that prefers `expo-secure-store` (encrypted
|
|
20
|
+
* at rest) and falls back to AsyncStorage when SecureStore is not installed.
|
|
21
|
+
* The SecureStore module is resolved lazily on first access so construction
|
|
22
|
+
* stays synchronous.
|
|
23
|
+
*/
|
|
24
|
+
export declare function createNativeSecureKeyValueStorage(): NativeKeyValueStorage;
|
|
25
|
+
//# sourceMappingURL=nativeSecureStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeSecureStorage.d.ts","sourceRoot":"","sources":["../../../../../src/ui/session/nativeSecureStorage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AA0CzD;;;;;GAKG;AACH,wBAAgB,iCAAiC,IAAI,qBAAqB,CAiCzE"}
|
|
@@ -21,6 +21,13 @@ import { type OxyServices, type TokenTransport } from '@oxyhq/core';
|
|
|
21
21
|
*
|
|
22
22
|
* A failure is logged and swallowed: this method must never throw out (it runs
|
|
23
23
|
* inside the socket state handler).
|
|
24
|
+
*
|
|
25
|
+
* `getPinnedAccountId` is the identity-bound escape hatch. Converging the bearer
|
|
26
|
+
* on `state.activeAccountId` is precisely what an identity-bound client must
|
|
27
|
+
* never do — its token is minted for the PINNED account by the cold boot /
|
|
28
|
+
* re-mint lane. `SessionClient` already bypasses the transport entirely while
|
|
29
|
+
* pinned; this guard is the services-side half of that contract, so no future
|
|
30
|
+
* wiring can reintroduce the convergence from this end.
|
|
24
31
|
*/
|
|
25
|
-
export declare function createTokenTransport(oxyServices: OxyServices): TokenTransport;
|
|
32
|
+
export declare function createTokenTransport(oxyServices: OxyServices, getPinnedAccountId?: () => string | null): TokenTransport;
|
|
26
33
|
//# sourceMappingURL=tokenTransport.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokenTransport.d.ts","sourceRoot":"","sources":["../../../../../src/ui/session/tokenTransport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAG5E
|
|
1
|
+
{"version":3,"file":"tokenTransport.d.ts","sourceRoot":"","sources":["../../../../../src/ui/session/tokenTransport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAG5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,WAAW,EACxB,kBAAkB,CAAC,EAAE,MAAM,MAAM,GAAG,IAAI,GACvC,cAAc,CAiChB"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { ReactNode, RefObject } from 'react';
|
|
2
2
|
import type { QueryClient } from '@tanstack/react-query';
|
|
3
3
|
import type { RouteName } from '../navigation/routes.js';
|
|
4
|
+
import type { SessionMode } from '@oxyhq/core';
|
|
5
|
+
import type { WebAuthMode } from '../oauth/types.js';
|
|
4
6
|
export interface StepController {
|
|
5
7
|
canGoBack: () => boolean;
|
|
6
8
|
goBack: () => void;
|
|
@@ -59,6 +61,48 @@ export interface OxyProviderProps {
|
|
|
59
61
|
* so a local/staging deployment targets its own IdP instead of production.
|
|
60
62
|
*/
|
|
61
63
|
authorizeBaseUrl?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Who owns this app's session.
|
|
66
|
+
*
|
|
67
|
+
* - `'account'` (default) — the device's ACTIVE account. Every ordinary Oxy
|
|
68
|
+
* app: any app sharing the device's `DeviceSession` can switch the active
|
|
69
|
+
* account and this one follows, sign-in surfaces and the account switcher
|
|
70
|
+
* are available, and `accounts` lists the account graph.
|
|
71
|
+
* - `'identity'` — the owner of this device's PRIMARY identity key, for as
|
|
72
|
+
* long as that key exists. The provider pins its authenticated user AND
|
|
73
|
+
* its bearer to the account that key authenticates as, so an account
|
|
74
|
+
* switch made by any sibling app changes the shared device state but never
|
|
75
|
+
* this app's user or token. Built for the identity vault (Commons).
|
|
76
|
+
*
|
|
77
|
+
* In `'identity'` mode the account-graph surfaces are disabled at the source
|
|
78
|
+
* rather than hidden in the UI: `accounts` stays empty and is never fetched,
|
|
79
|
+
* `switchToAccount` / `switchSession` reject with `IdentityBoundSessionError`,
|
|
80
|
+
* `accountDialogController` is `null` and `openAccountDialog()` does nothing,
|
|
81
|
+
* and the two web OAuth cold-boot lanes (authorization-code return + silent
|
|
82
|
+
* cross-origin restore) are skipped — all of them commit whichever account
|
|
83
|
+
* the IdP resolves, which is not necessarily the local key's owner.
|
|
84
|
+
*
|
|
85
|
+
* Read once at mount, like `baseURL` / `oxyServices`: changing it on a
|
|
86
|
+
* mounted provider does not re-bind the session.
|
|
87
|
+
* @default 'account'
|
|
88
|
+
*/
|
|
89
|
+
sessionMode?: SessionMode;
|
|
90
|
+
/**
|
|
91
|
+
* How a WEB third-party "Sign in with Oxy" hands the user to the IdP.
|
|
92
|
+
*
|
|
93
|
+
* - `'redirect'` (default) — a full-page navigation to `auth.oxy.so`, which
|
|
94
|
+
* returns to the registered `redirect_uri` with `?code=`. The tab unmounts
|
|
95
|
+
* and remounts, so route and unsaved state are lost.
|
|
96
|
+
* - `'popup'` — a small `auth.oxy.so` window opened from the user's click.
|
|
97
|
+
* The app stays MOUNTED and becomes authenticated without a reload; the
|
|
98
|
+
* IdP delivers only the authorization code + `state` back to the opener
|
|
99
|
+
* via `postMessage` (never a token, device secret, or PKCE verifier). A
|
|
100
|
+
* blocked popup falls back to the redirect automatically.
|
|
101
|
+
*
|
|
102
|
+
* Native is unaffected — it always uses an in-app auth session.
|
|
103
|
+
* @default 'redirect'
|
|
104
|
+
*/
|
|
105
|
+
webAuthMode?: WebAuthMode;
|
|
62
106
|
queryClient?: QueryClient;
|
|
63
107
|
/** Sync device credentials to auth.oxy.so after interactive sign-in. @default true */
|
|
64
108
|
hubSync?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../../../src/ui/types/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../../../src/ui/types/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAiB,WAAW,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAgB,CAAC;AAElD,MAAM,WAAW,cAAc;IAC3B,SAAS,EAAE,MAAM,OAAO,CAAC;IACzB,MAAM,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAE5B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACxE,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,mFAAmF;IACnF,SAAS,CAAC,EAAE,MAAM,OAAO,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,eAAe,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC9C;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAGrC,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IAGlC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACrD,YAAY,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAGjE,aAAa,CAAC,EAAE,SAAS,CAAC;IAG1B,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAGnD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,OAAO,CAAC;IAMtB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,gBAAgB;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;;;;;;;;;;;;OAcG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,sFAAsF;IACtF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;CACzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crossOriginRestore.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/crossOriginRestore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"crossOriginRestore.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/crossOriginRestore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAuB/C,8EAA8E;AAC9E,wBAAgB,2BAA2B,IAAI,OAAO,CAOrD;AAED,iFAAiF;AACjF,wBAAgB,+BAA+B,IAAI,IAAI,CAKtD;AAED,qEAAqE;AACrE,wBAAgB,6BAA6B,IAAI,IAAI,CAMpD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAIrE;AAED,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;GAGG;AACH,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,yBAAyB,GAC9B,OAAO,CAAC,OAAO,CAAC,CAgDlB;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,gBAAgB,GAAG,kBAAkB,GAAG,IAAI,CA0BtF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Classify the surface a "Sign in with Oxy" request is initiated from, for
|
|
3
|
+
* `AccountDialogController`'s `platform` option (issue #691, Phase 4/5).
|
|
4
|
+
*
|
|
5
|
+
* `@oxyhq/core` deliberately refuses to do this itself — it never touches a
|
|
6
|
+
* platform global — so the consumer that OWNS the environment classifies it and
|
|
7
|
+
* hands the verdict in. The verdict feeds `selectCommonsDelivery`, where it
|
|
8
|
+
* decides one thing only: whether this device may take the `'open-commons'`
|
|
9
|
+
* deep-link route. Getting it wrong in the "mobile" direction is the costly
|
|
10
|
+
* error (a custom-scheme navigation that does not resolve is a dead end with no
|
|
11
|
+
* automatic way back), so every ambiguous signal resolves AWAY from `'mobile'`.
|
|
12
|
+
*
|
|
13
|
+
* No user-agent string is parsed. The two signals used are declarative and
|
|
14
|
+
* standardized:
|
|
15
|
+
* 1. `navigator.userAgentData.mobile` — the User-Agent Client Hints boolean.
|
|
16
|
+
* Authoritative where implemented (Chromium), in both directions.
|
|
17
|
+
* 2. The PRIMARY pointer (`(pointer: coarse)`) plus a touch digitizer.
|
|
18
|
+
* A phone/tablet reports a coarse primary pointer; a touchscreen laptop
|
|
19
|
+
* still reports its mouse as primary, so it is not misclassified.
|
|
20
|
+
*/
|
|
21
|
+
import type { CommonsDeliveryPlatform } from '@oxyhq/core';
|
|
22
|
+
/**
|
|
23
|
+
* Which surface this app is running on, as `selectCommonsDelivery` models it.
|
|
24
|
+
*
|
|
25
|
+
* - Native (Expo/RN) is always `'mobile'`: it is an Oxy app installed on a
|
|
26
|
+
* phone/tablet, exactly the case where a verified Commons link can resolve
|
|
27
|
+
* on this very device.
|
|
28
|
+
* - A web browser is classified from the signals above.
|
|
29
|
+
* - Anything else — a browser-like environment with neither signal — is
|
|
30
|
+
* `'unknown'`, a first-class value that never opts into the deep link.
|
|
31
|
+
*/
|
|
32
|
+
export declare function resolveDeliveryPlatform(): CommonsDeliveryPlatform;
|
|
33
|
+
//# sourceMappingURL=deliveryPlatform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deliveryPlatform.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/deliveryPlatform.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAiB3D;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,IAAI,uBAAuB,CAgBjE"}
|
|
@@ -1,27 +1,41 @@
|
|
|
1
1
|
import type { OxyServices } from '@oxyhq/core';
|
|
2
|
-
|
|
3
|
-
sessionId: string;
|
|
4
|
-
accessToken?: string;
|
|
5
|
-
deviceId?: string;
|
|
6
|
-
deviceSecret?: string;
|
|
7
|
-
userId: string;
|
|
8
|
-
expiresAt?: string;
|
|
9
|
-
user?: {
|
|
10
|
-
id: string;
|
|
11
|
-
username?: string;
|
|
12
|
-
avatar?: string;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
2
|
+
import type { OAuthSessionCommitInput } from '../oauth/types.js';
|
|
15
3
|
/**
|
|
16
|
-
* When the RP lands with `?code=` after
|
|
17
|
-
*
|
|
4
|
+
* When the RP lands with `?code=` after signing in at auth.oxy.so, exchange the
|
|
5
|
+
* code for a device-first session before cold boot runs.
|
|
6
|
+
*
|
|
7
|
+
* This is the REDIRECT transport's return leg. It owns only what is specific to
|
|
8
|
+
* a full-page round trip — reading the code off the URL, recovering the
|
|
9
|
+
* handshake `sessionStorage` carried across the navigation, and cleaning both up
|
|
10
|
+
* afterwards — and delegates state validation, the PKCE exchange, and the
|
|
11
|
+
* session commit to `completeOAuthCode`, the same function the popup transport
|
|
12
|
+
* runs.
|
|
18
13
|
*/
|
|
19
14
|
export declare function tryCompleteOAuthReturn(opts: {
|
|
20
15
|
oxyServices: OxyServices;
|
|
21
16
|
clientId?: string | null;
|
|
22
17
|
authRedirectUri?: string;
|
|
23
|
-
commitSession: (input:
|
|
18
|
+
commitSession: (input: OAuthSessionCommitInput) => Promise<void>;
|
|
24
19
|
}): Promise<boolean>;
|
|
20
|
+
/**
|
|
21
|
+
* Rewrite the address bar after an authorize round trip, and tell the router.
|
|
22
|
+
*
|
|
23
|
+
* Prefers the page the visit started on (see `persistOAuthReturnPath`) over the
|
|
24
|
+
* bare origin the IdP redirected to, falling back to `fallbackUrl` when nothing
|
|
25
|
+
* was recorded.
|
|
26
|
+
*
|
|
27
|
+
* The `popstate` dispatch is the load-bearing part. `history.replaceState`
|
|
28
|
+
* fires no event, and cold boot runs *inside* the mounted app — by the time
|
|
29
|
+
* this executes, a history-based router (React Router, Vue Router, …) has
|
|
30
|
+
* already read `location` and rendered the route for `/`. Without a
|
|
31
|
+
* notification the address bar would show the restored deep link while the page
|
|
32
|
+
* still displayed the home page. `popstate` is the event the History API
|
|
33
|
+
* defines for exactly this, and it is what those routers subscribe to.
|
|
34
|
+
*
|
|
35
|
+
* Only dispatched when the URL actually changed, so the common no-op case does
|
|
36
|
+
* not push a spurious event at every listener on the page.
|
|
37
|
+
*/
|
|
38
|
+
export declare function replaceUrlAfterOAuthReturn(fallbackUrl: string): void;
|
|
25
39
|
/**
|
|
26
40
|
* When auth.oxy.so hub-sync redeem fails, the IdP redirects back with
|
|
27
41
|
* `?hub_sync=failed`. Strip the param and log so cold boot can continue
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauthReturn.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/oauthReturn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"oauthReturn.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/oauthReturn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAS/C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAgB,CAAC;AAG9D;;;;;;;;;;GAUG;AACH,wBAAsB,sBAAsB,CAAC,IAAI,EAAE;IACjD,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,CAAC,KAAK,EAAE,uBAAuB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAClE,GAAG,OAAO,CAAC,OAAO,CAAC,CA6CnB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAuBpE;AAeD;;;;GAIG;AACH,wBAAgB,qBAAqB,IAAI,OAAO,CAgB/C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oxyhq/services",
|
|
3
|
-
"version": "22.
|
|
3
|
+
"version": "22.13.0",
|
|
4
4
|
"description": "OxyHQ Expo/React Native SDK — UI components, screens, and native features",
|
|
5
5
|
"main": "lib/commonjs/index.js",
|
|
6
6
|
"module": "lib/module/index.js",
|
|
@@ -126,8 +126,8 @@
|
|
|
126
126
|
}
|
|
127
127
|
},
|
|
128
128
|
"dependencies": {
|
|
129
|
-
"@oxyhq/contracts": "0.
|
|
130
|
-
"@oxyhq/core": "^12.
|
|
129
|
+
"@oxyhq/contracts": "0.18.0",
|
|
130
|
+
"@oxyhq/core": "^12.11.0",
|
|
131
131
|
"@simplewebauthn/browser": "^13.3.0",
|
|
132
132
|
"color": "^4.2.3"
|
|
133
133
|
},
|
|
@@ -136,7 +136,7 @@
|
|
|
136
136
|
"@commitlint/cli": "^17.6.5",
|
|
137
137
|
"@commitlint/config-conventional": "^17.6.5",
|
|
138
138
|
"@expo/vector-icons": "^15.0.3",
|
|
139
|
-
"@oxyhq/core": "12.
|
|
139
|
+
"@oxyhq/core": "12.11.0",
|
|
140
140
|
"@react-native-async-storage/async-storage": "^2.0.0",
|
|
141
141
|
"@react-native-community/netinfo": "^11.4.1",
|
|
142
142
|
"@react-native/babel-preset": "^0.86.0",
|
|
@@ -152,7 +152,6 @@
|
|
|
152
152
|
"@types/react": "*",
|
|
153
153
|
"copyfiles": "^2.4.1",
|
|
154
154
|
"expo-file-system": "~57.0.1",
|
|
155
|
-
"expo-font": "~57.0.1",
|
|
156
155
|
"expo-haptics": "~57.0.1",
|
|
157
156
|
"expo-image": "~57.0.1",
|
|
158
157
|
"expo-linear-gradient": "~57.0.1",
|
|
@@ -176,8 +175,8 @@
|
|
|
176
175
|
},
|
|
177
176
|
"peerDependencies": {
|
|
178
177
|
"@expo/vector-icons": "^15.0.3",
|
|
179
|
-
"@oxyhq/bloom": "^0.
|
|
180
|
-
"@oxyhq/core": "^12.
|
|
178
|
+
"@oxyhq/bloom": "^0.54.1",
|
|
179
|
+
"@oxyhq/core": "^12.11.0",
|
|
181
180
|
"@react-native-async-storage/async-storage": "^2.0.0",
|
|
182
181
|
"@react-native-community/netinfo": "^11.4.1",
|
|
183
182
|
"@tanstack/query-async-storage-persister": "^5.101",
|
|
@@ -189,7 +188,6 @@
|
|
|
189
188
|
"expo": ">=56.0.0",
|
|
190
189
|
"expo-document-picker": ">=56.0.0",
|
|
191
190
|
"expo-file-system": ">=56.0.0",
|
|
192
|
-
"expo-font": ">=13.0.0",
|
|
193
191
|
"expo-haptics": ">=56.0.0",
|
|
194
192
|
"expo-image": ">=2.0.0",
|
|
195
193
|
"expo-image-manipulator": ">=56.0.0",
|
package/src/index.ts
CHANGED
|
@@ -36,11 +36,10 @@ export { useOxy } from './ui/context/OxyContext';
|
|
|
36
36
|
export type { OxyContextState } from './ui/context/OxyContext';
|
|
37
37
|
export { useAuth } from './ui/hooks/useAuth';
|
|
38
38
|
export type { AuthState, AuthActions, UseAuthReturn } from './ui/hooks/useAuth';
|
|
39
|
-
|
|
40
|
-
//
|
|
41
|
-
//
|
|
42
|
-
|
|
43
|
-
export { FontLoader, setupFonts } from './ui/components/FontLoader';
|
|
39
|
+
// Thrown by `switchToAccount` / `switchSession` while `OxyProvider` runs with
|
|
40
|
+
// `sessionMode="identity"` — an identity-bound app authenticates as the owner of
|
|
41
|
+
// the local identity key and cannot switch accounts.
|
|
42
|
+
export { IdentityBoundSessionError } from './ui/session/identityBinding';
|
|
44
43
|
|
|
45
44
|
// ---------------------------------------------------------------------------
|
|
46
45
|
// Zustand stores
|
|
@@ -210,6 +209,21 @@ export {
|
|
|
210
209
|
} from '@oxyhq/core';
|
|
211
210
|
export { default as OxySignInButton } from './ui/components/OxySignInButton';
|
|
212
211
|
export type { OxySignInButtonProps, OxyOAuthResult } from './ui/components/OxySignInButton';
|
|
212
|
+
|
|
213
|
+
// Web OAuth transport (popup / redirect). RPs that ship their own sign-in
|
|
214
|
+
// button call `useOxy().startWebOAuthSignIn(...)`; only the popup opener is
|
|
215
|
+
// exported, because it MUST run synchronously inside the press handler to keep
|
|
216
|
+
// the browser's user-gesture attribution.
|
|
217
|
+
export { openOAuthPopup } from './ui/oauth/oauthPopup';
|
|
218
|
+
export type { StartWebOAuthSignInOptions } from './ui/oauth/browserAuthTransport';
|
|
219
|
+
export type {
|
|
220
|
+
WebAuthMode,
|
|
221
|
+
WebOAuthSignInResult,
|
|
222
|
+
WebOAuthRedirectReason,
|
|
223
|
+
WebOAuthFailureReason,
|
|
224
|
+
WebOAuthUnsupportedReason,
|
|
225
|
+
OAuthPopupHandle,
|
|
226
|
+
} from './ui/oauth/types';
|
|
213
227
|
export { OxyAuthPrompt } from './ui/components/OxyAuthPrompt';
|
|
214
228
|
export type { OxyAuthPromptProps } from './ui/components/OxyAuthPrompt';
|
|
215
229
|
export { OxyOAuthCallback } from './ui/components/OxyOAuthCallback';
|
|
@@ -0,0 +1,281 @@
|
|
|
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
|
+
});
|