@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
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ONE path from an OAuth authorization code to a committed session.
|
|
3
|
+
*
|
|
4
|
+
* Both web transports end here — the popup with an in-memory handshake, the
|
|
5
|
+
* redirect lane with one read back from `sessionStorage` — so state validation,
|
|
6
|
+
* the PKCE exchange, the session commit, and handshake cleanup exist exactly
|
|
7
|
+
* once. Duplicating any of those per transport is how the two lanes would drift
|
|
8
|
+
* apart on the security-critical steps.
|
|
9
|
+
*
|
|
10
|
+
* Ordering is deliberate and load-bearing:
|
|
11
|
+
* 1. validate `state` BEFORE anything is sent to the token endpoint,
|
|
12
|
+
* 2. exchange the code for a session,
|
|
13
|
+
* 3. run `cleanup` (drop the persisted handshake / strip `?code=` from the
|
|
14
|
+
* URL) BEFORE the commit, so a stale code can never re-enter the exchange,
|
|
15
|
+
* 4. commit the session.
|
|
16
|
+
*
|
|
17
|
+
* `cleanup` runs exactly once on EVERY exit path, including a state mismatch
|
|
18
|
+
* and a failed exchange.
|
|
19
|
+
*/
|
|
20
|
+
import type { OxyServices } from '@oxyhq/core';
|
|
21
|
+
import type { OAuthCompletionResult, OAuthHandshake, OAuthSessionCommitInput } from './types.js';
|
|
22
|
+
/** Inputs for {@link completeOAuthCode}. */
|
|
23
|
+
export interface CompleteOAuthCodeInput {
|
|
24
|
+
oxyServices: OxyServices;
|
|
25
|
+
/** The registered `ApplicationCredential` public key (`oxy_dk_…`). */
|
|
26
|
+
clientId: string;
|
|
27
|
+
/** The single-use authorization code the IdP issued. */
|
|
28
|
+
code: string;
|
|
29
|
+
/** The `state` the IdP returned, or `null` when it sent none. */
|
|
30
|
+
returnedState: string | null;
|
|
31
|
+
/**
|
|
32
|
+
* The handshake this RP started the authorize request with, or `null` when it
|
|
33
|
+
* is gone (never stored, expired, or a different tab's). A missing handshake
|
|
34
|
+
* is treated exactly like a mismatched `state`: no exchange is attempted.
|
|
35
|
+
*/
|
|
36
|
+
handshake: OAuthHandshake | null;
|
|
37
|
+
/** EXACT redirect URI sent on the authorize request — OAuth requires a match. */
|
|
38
|
+
redirectUri: string;
|
|
39
|
+
/** The provider's session commit funnel. */
|
|
40
|
+
commitSession: (input: OAuthSessionCommitInput) => Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Transport-specific teardown, invoked once after the exchange settles and
|
|
43
|
+
* before the commit. The redirect lane strips `?code=` and clears the
|
|
44
|
+
* persisted handshake; the popup lane has nothing persisted and omits it.
|
|
45
|
+
*/
|
|
46
|
+
cleanup?: () => void;
|
|
47
|
+
}
|
|
48
|
+
export declare function completeOAuthCode(input: CompleteOAuthCodeInput): Promise<OAuthCompletionResult>;
|
|
49
|
+
//# sourceMappingURL=completeOAuthCode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completeOAuthCode.d.ts","sourceRoot":"","sources":["../../../../../src/ui/oauth/completeOAuthCode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,KAAK,EAAE,qBAAqB,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,YAAS,CAAC;AAE9F,4CAA4C;AAC5C,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,WAAW,CAAC;IACzB,sEAAsE;IACtE,QAAQ,EAAE,MAAM,CAAC;IACjB,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B;;;;OAIG;IACH,SAAS,EAAE,cAAc,GAAG,IAAI,CAAC;IACjC,iFAAiF;IACjF,WAAW,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,aAAa,EAAE,CAAC,KAAK,EAAE,uBAAuB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjE;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,sBAAsB,GAC5B,OAAO,CAAC,qBAAqB,CAAC,CAuChC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The legacy, redirect-mode-only lanes that navigate the RP's TOP-LEVEL window
|
|
3
|
+
* to the IdP without a user gesture.
|
|
4
|
+
*
|
|
5
|
+
* `webAuthMode: 'popup'` exists to guarantee exactly one thing: the relying
|
|
6
|
+
* party never leaves its route. Two mechanics in this SDK break that guarantee,
|
|
7
|
+
* because each replaces the whole document on its own initiative:
|
|
8
|
+
*
|
|
9
|
+
* 1. **Cold-boot silent restore** — a full-page `prompt=none` authorize bounce
|
|
10
|
+
* to `auth.oxy.so` when the device-secret mint finds no local session
|
|
11
|
+
* (`maybeStartSilentOAuthRestore`, called from `runProviderColdBoot`).
|
|
12
|
+
* 2. **Post-sign-in hub sync** — a full-page hop to `auth.oxy.so/sync` that
|
|
13
|
+
* plants this device's credential on the IdP hub so OTHER origins can later
|
|
14
|
+
* run lane 1 (`syncHubAfterSignIn`, called from the `commitSession` funnel).
|
|
15
|
+
*
|
|
16
|
+
* Both belong to the redirect transport and are kept only for the migration
|
|
17
|
+
* window (issue #691, "Cold boot and cross-domain behavior"). In popup mode a
|
|
18
|
+
* domain with no local credential simply resolves SIGNED OUT, and the user's
|
|
19
|
+
* next explicit "Continue with Oxy" opens the popup — from a real user gesture,
|
|
20
|
+
* never automatically.
|
|
21
|
+
*
|
|
22
|
+
* NOT covered here, and correctly enabled in BOTH modes: navigations the user
|
|
23
|
+
* asked for. When the browser blocks the popup, `startWebOAuthSignIn` still
|
|
24
|
+
* falls back to a full-page redirect rather than dead-ending the sign-in, and
|
|
25
|
+
* `tryCompleteOAuthReturn` still consumes a `?code=` that is already on the URL.
|
|
26
|
+
*
|
|
27
|
+
* PHASE 7b: once the pilot flips the default transport to `'popup'`, this
|
|
28
|
+
* predicate and BOTH lanes above are deleted outright. Grepping this symbol
|
|
29
|
+
* finds every site that has to go.
|
|
30
|
+
*/
|
|
31
|
+
import type { WebAuthMode } from './types.js';
|
|
32
|
+
/**
|
|
33
|
+
* Whether a provider running `webAuthMode` may perform an SDK-initiated,
|
|
34
|
+
* non-gesture, full-page navigation to the IdP.
|
|
35
|
+
*
|
|
36
|
+
* `true` only for `'redirect'` — still the default and the compatibility path,
|
|
37
|
+
* whose behaviour must stay byte-for-byte unchanged.
|
|
38
|
+
*/
|
|
39
|
+
export declare function allowsAutomaticIdpRedirect(webAuthMode: WebAuthMode): boolean;
|
|
40
|
+
//# sourceMappingURL=legacyRedirectLanes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacyRedirectLanes.d.ts","sourceRoot":"","sources":["../../../../../src/ui/oauth/legacyRedirectLanes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAS,CAAC;AAE3C;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAE5E"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The RP half of an OAuth authorize request: a fresh CSRF `state` + PKCE pair,
|
|
3
|
+
* and the authorize URL built from them.
|
|
4
|
+
*
|
|
5
|
+
* Both web transports start here, and the ONLY difference between them is one
|
|
6
|
+
* parameter: `popup` asks the IdP for `response_mode=web_message` so the result
|
|
7
|
+
* comes back to `window.opener` instead of navigating the RP's tab. Everything
|
|
8
|
+
* else — `S256` PKCE, exact registered `redirect_uri`, random `state` — is
|
|
9
|
+
* identical, which is what lets both lanes converge on one completion path.
|
|
10
|
+
*/
|
|
11
|
+
import type { OAuthHandshake } from './types.js';
|
|
12
|
+
/** Inputs for {@link prepareAuthorizeRequest}. */
|
|
13
|
+
export interface PrepareAuthorizeRequestParams {
|
|
14
|
+
/** The registered `ApplicationCredential` public key (`oxy_dk_…`). */
|
|
15
|
+
clientId: string;
|
|
16
|
+
/** EXACT registered redirect URI. The token exchange must replay this value. */
|
|
17
|
+
redirectUri: string;
|
|
18
|
+
/** Authorize endpoint override; defaults to the production Oxy IdP. */
|
|
19
|
+
authorizeBaseUrl?: string;
|
|
20
|
+
/** Requested scope; defaults to the SDK's standard sign-in scope. */
|
|
21
|
+
scope?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Ask the IdP to deliver the result to `window.opener` via `postMessage`
|
|
24
|
+
* instead of redirecting. Set ONLY by the popup transport. It is a request,
|
|
25
|
+
* not a guarantee — an IdP with no opener still redirects.
|
|
26
|
+
*/
|
|
27
|
+
responseMode?: 'web_message';
|
|
28
|
+
}
|
|
29
|
+
/** A ready-to-use authorize request plus the secrets that finish it. */
|
|
30
|
+
export interface PreparedAuthorizeRequest {
|
|
31
|
+
/** Fully-built `auth.oxy.so/authorize` URL. */
|
|
32
|
+
authorizeUrl: string;
|
|
33
|
+
/**
|
|
34
|
+
* Exact origin of {@link authorizeUrl}. The popup transport accepts
|
|
35
|
+
* `postMessage` from this origin and no other.
|
|
36
|
+
*/
|
|
37
|
+
authorizeOrigin: string;
|
|
38
|
+
/** The `state` + PKCE verifier this request is bound to. */
|
|
39
|
+
handshake: OAuthHandshake;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Generate a fresh handshake and build the authorize URL around it.
|
|
43
|
+
*
|
|
44
|
+
* The verifier is returned to the caller and never stored here: the popup
|
|
45
|
+
* transport keeps it in memory for the lifetime of the attempt, and the
|
|
46
|
+
* redirect transport persists it through `persistOAuthHandshake` because a
|
|
47
|
+
* full-page navigation destroys the running document.
|
|
48
|
+
*/
|
|
49
|
+
export declare function prepareAuthorizeRequest(params: PrepareAuthorizeRequestParams): Promise<PreparedAuthorizeRequest>;
|
|
50
|
+
//# sourceMappingURL=oauthHandshake.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauthHandshake.d.ts","sourceRoot":"","sources":["../../../../../src/ui/oauth/oauthHandshake.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAS,CAAC;AAE9C,kDAAkD;AAClD,MAAM,WAAW,6BAA6B;IAC5C,sEAAsE;IACtE,QAAQ,EAAE,MAAM,CAAC;IACjB,gFAAgF;IAChF,WAAW,EAAE,MAAM,CAAC;IACpB,uEAAuE;IACvE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,YAAY,CAAC,EAAE,aAAa,CAAC;CAC9B;AAED,wEAAwE;AACxE,MAAM,WAAW,wBAAwB;IACvC,+CAA+C;IAC/C,YAAY,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,eAAe,EAAE,MAAM,CAAC;IACxB,4DAA4D;IAC5D,SAAS,EAAE,cAAc,CAAC;CAC3B;AAED;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,6BAA6B,GACpC,OAAO,CAAC,wBAAwB,CAAC,CAkBnC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Popup lifecycle for the web OAuth transport.
|
|
3
|
+
*
|
|
4
|
+
* Owns the window itself — opening it, navigating it, watching it, and tearing
|
|
5
|
+
* every listener and timer down — and nothing else: message validation lives in
|
|
6
|
+
* `oauthPopupMessages.ts`, and the code exchange in `completeOAuthCode.ts`.
|
|
7
|
+
*
|
|
8
|
+
* Three browser realities shape this module:
|
|
9
|
+
*
|
|
10
|
+
* - **Gesture attribution.** `window.open` only succeeds while the user's click
|
|
11
|
+
* is still being handled. Anything awaited first (resolving the application,
|
|
12
|
+
* generating PKCE) loses it and the popup is silently blocked. So the window
|
|
13
|
+
* is opened EMPTY up front and navigated once the authorize URL exists —
|
|
14
|
+
* the same shape as `passkeyHubPopup.ts`.
|
|
15
|
+
* - **No close event.** A cross-origin popup fires nothing when the user
|
|
16
|
+
* dismisses it; polling `closed` is the only mechanism (as in core's
|
|
17
|
+
* `AccountDialogController.watchPopup`).
|
|
18
|
+
* - **No cross-origin reads.** The popup's URL, title, and document are all
|
|
19
|
+
* opaque. The authorization result arrives ONLY as a `postMessage`.
|
|
20
|
+
*/
|
|
21
|
+
import type { OAuthPopupHandle, OAuthPopupOutcome } from './types.js';
|
|
22
|
+
/**
|
|
23
|
+
* Window name for the sign-in popup. Naming the target means a second press
|
|
24
|
+
* REUSES the same window instead of stacking a new one behind the first.
|
|
25
|
+
*/
|
|
26
|
+
export declare const OXY_OAUTH_POPUP_WINDOW_NAME = "oxy-oauth";
|
|
27
|
+
/**
|
|
28
|
+
* How long a popup sign-in may stay unanswered (ms).
|
|
29
|
+
*
|
|
30
|
+
* Generous on purpose: the IdP surface can involve scanning a QR and approving
|
|
31
|
+
* on a phone, so this tracks the authorize handle's own ~5-minute lifetime
|
|
32
|
+
* rather than a UI-scale timeout. It is a backstop against a wedged popup, not
|
|
33
|
+
* a pace-setter — a user who gives up closes the window and gets the faster
|
|
34
|
+
* `closed` outcome.
|
|
35
|
+
*/
|
|
36
|
+
export declare const DEFAULT_OAUTH_POPUP_TIMEOUT_MS = 300000;
|
|
37
|
+
/**
|
|
38
|
+
* Open a new, EMPTY sign-in popup.
|
|
39
|
+
*
|
|
40
|
+
* MUST be called SYNCHRONOUSLY from a user-gesture handler, before any `await`.
|
|
41
|
+
* Returns `null` when the browser blocked it, when `window.open` threw, and on
|
|
42
|
+
* hosts with no DOM (native / SSR) — never throws, because "no popup" is an
|
|
43
|
+
* ordinary outcome the caller answers by falling back to a redirect.
|
|
44
|
+
*/
|
|
45
|
+
export declare function openOAuthPopup(): OAuthPopupHandle | null;
|
|
46
|
+
/**
|
|
47
|
+
* Point an already-open popup at the authorize URL. Returns `false` when the
|
|
48
|
+
* assignment threw (a window closed between opening and navigating), so the
|
|
49
|
+
* caller can fall back to a redirect instead of waiting on a dead window.
|
|
50
|
+
*/
|
|
51
|
+
export declare function navigateOAuthPopup(popup: OAuthPopupHandle, url: string): boolean;
|
|
52
|
+
/** Close the popup if it is still open. Idempotent, null-safe, never throws. */
|
|
53
|
+
export declare function closeOAuthPopup(popup: OAuthPopupHandle | null): void;
|
|
54
|
+
/** Inputs for {@link awaitOAuthPopupResult}. */
|
|
55
|
+
export interface AwaitOAuthPopupOptions {
|
|
56
|
+
/** The exact window reference returned by {@link openOAuthPopup}. */
|
|
57
|
+
popup: OAuthPopupHandle;
|
|
58
|
+
/** Exact origin the IdP will post from (`new URL(authorizeUrl).origin`). */
|
|
59
|
+
expectedOrigin: string;
|
|
60
|
+
/** The CSRF `state` sent on the authorize request. */
|
|
61
|
+
expectedState: string;
|
|
62
|
+
/**
|
|
63
|
+
* EXACT registered redirect URI for this attempt. When the IdP cannot
|
|
64
|
+
* `postMessage` (no usable opener) it falls back to redirecting the popup;
|
|
65
|
+
* if that lands on the same origin, the result is read from the popup URL.
|
|
66
|
+
*/
|
|
67
|
+
redirectUri: string;
|
|
68
|
+
/** @default DEFAULT_OAUTH_POPUP_TIMEOUT_MS */
|
|
69
|
+
timeoutMs?: number;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Wait for the popup to deliver an authorization result.
|
|
73
|
+
*
|
|
74
|
+
* Settles EXACTLY once, with a typed outcome for every path — code, IdP error,
|
|
75
|
+
* state mismatch, user-closed, timeout — and removes its listener, its close
|
|
76
|
+
* poll, and both timers before resolving, whatever the outcome. Messages that
|
|
77
|
+
* arrive after settling reach nothing, so a duplicate delivery is inert.
|
|
78
|
+
*
|
|
79
|
+
* Never rejects: closing the window and running out of time are expected
|
|
80
|
+
* outcomes, not exceptions.
|
|
81
|
+
*/
|
|
82
|
+
export declare function awaitOAuthPopupResult(options: AwaitOAuthPopupOptions): Promise<OAuthPopupOutcome>;
|
|
83
|
+
//# sourceMappingURL=oauthPopup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauthPopup.d.ts","sourceRoot":"","sources":["../../../../../src/ui/oauth/oauthPopup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,YAAS,CAAC;AAEnE;;;GAGG;AACH,eAAO,MAAM,2BAA2B,cAAc,CAAC;AAKvD;;;;;;;;GAQG;AACH,eAAO,MAAM,8BAA8B,SAAU,CAAC;AAkCtD;;;;;;;GAOG;AACH,wBAAgB,cAAc,IAAI,gBAAgB,GAAG,IAAI,CASxD;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,gBAAgB,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAQhF;AAED,gFAAgF;AAChF,wBAAgB,eAAe,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,GAAG,IAAI,CAOpE;AA2CD,gDAAgD;AAChD,MAAM,WAAW,sBAAsB;IACrC,qEAAqE;IACrE,KAAK,EAAE,gBAAgB,CAAC;IACxB,4EAA4E;IAC5E,cAAc,EAAE,MAAM,CAAC;IACvB,sDAAsD;IACtD,aAAa,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,iBAAiB,CAAC,CAmF5B"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime validation for the popup OAuth `postMessage` channel.
|
|
3
|
+
*
|
|
4
|
+
* Everything arriving on `window`'s `message` event is untrusted: any frame on
|
|
5
|
+
* the page, any other popup, and any browser extension can post to us. This
|
|
6
|
+
* module is the ONLY place that decides whether an incoming event is a genuine
|
|
7
|
+
* authorization response, and it answers with a value — never a thrown error.
|
|
8
|
+
*
|
|
9
|
+
* A message is accepted only when ALL of these hold:
|
|
10
|
+
* 1. `event.origin` is EXACTLY the authorize endpoint's origin,
|
|
11
|
+
* 2. `event.source` is the exact `Window` reference we opened,
|
|
12
|
+
* 3. `event.data` matches one of the two frozen message shapes,
|
|
13
|
+
* 4. the `state` it carries matches the one this RP sent.
|
|
14
|
+
*
|
|
15
|
+
* Failing (1)–(3) is indistinguishable from unrelated page traffic, so the
|
|
16
|
+
* message is IGNORED and the flow keeps waiting. Failing (4) means our own
|
|
17
|
+
* popup answered a different request than the one in flight, which is terminal:
|
|
18
|
+
* it is reported as a mismatch rather than left to hang until the timeout.
|
|
19
|
+
*/
|
|
20
|
+
import type { OAuthPopupHandle, OxyOAuthMessage } from './types.js';
|
|
21
|
+
/** `postMessage` discriminator for a successful authorization. */
|
|
22
|
+
export declare const OXY_OAUTH_CODE_MESSAGE_TYPE = "oxy:oauth:code";
|
|
23
|
+
/** `postMessage` discriminator for a typed OAuth failure. */
|
|
24
|
+
export declare const OXY_OAUTH_ERROR_MESSAGE_TYPE = "oxy:oauth:error";
|
|
25
|
+
/** Verdict for one incoming `message` event. */
|
|
26
|
+
export type OAuthPopupMessageVerdict =
|
|
27
|
+
/** Not ours (wrong origin/source) or not a valid message — keep waiting. */
|
|
28
|
+
{
|
|
29
|
+
kind: 'ignore';
|
|
30
|
+
} | {
|
|
31
|
+
kind: 'code';
|
|
32
|
+
code: string;
|
|
33
|
+
state: string;
|
|
34
|
+
} | {
|
|
35
|
+
kind: 'oauth-error';
|
|
36
|
+
error: string;
|
|
37
|
+
errorDescription?: string;
|
|
38
|
+
}
|
|
39
|
+
/** Well-formed, from our popup, but bound to a different authorize request. */
|
|
40
|
+
| {
|
|
41
|
+
kind: 'state-mismatch';
|
|
42
|
+
};
|
|
43
|
+
/** What {@link readOAuthPopupMessage} validates an event against. */
|
|
44
|
+
export interface OAuthPopupMessageContext {
|
|
45
|
+
/** Exact origin of the authorize endpoint (`new URL(authorizeUrl).origin`). */
|
|
46
|
+
expectedOrigin: string;
|
|
47
|
+
/** The CSRF `state` this RP sent on the authorize request. */
|
|
48
|
+
expectedState: string;
|
|
49
|
+
/** The exact popup reference `window.open()` returned. */
|
|
50
|
+
popup: OAuthPopupHandle;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Parse untrusted `event.data` into one of the two frozen message shapes, or
|
|
54
|
+
* `null` when it is anything else (including `null`, primitives, arrays, and
|
|
55
|
+
* objects with missing/wrong-typed fields).
|
|
56
|
+
*
|
|
57
|
+
* Unknown extra properties are tolerated but never read: only the fields below
|
|
58
|
+
* are ever surfaced, so a hostile sender cannot smuggle values past this point.
|
|
59
|
+
*/
|
|
60
|
+
export declare function parseOAuthPopupMessage(data: unknown): OxyOAuthMessage | null;
|
|
61
|
+
/**
|
|
62
|
+
* Classify one `message` event against the in-flight authorize request.
|
|
63
|
+
*
|
|
64
|
+
* Never throws. See the module header for the acceptance rules.
|
|
65
|
+
*/
|
|
66
|
+
export declare function readOAuthPopupMessage(event: MessageEvent, context: OAuthPopupMessageContext): OAuthPopupMessageVerdict;
|
|
67
|
+
//# sourceMappingURL=oauthPopupMessages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauthPopupMessages.d.ts","sourceRoot":"","sources":["../../../../../src/ui/oauth/oauthPopupMessages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,YAAS,CAAC;AAEjE,kEAAkE;AAClE,eAAO,MAAM,2BAA2B,mBAAmB,CAAC;AAE5D,6DAA6D;AAC7D,eAAO,MAAM,4BAA4B,oBAAoB,CAAC;AAE9D,gDAAgD;AAChD,MAAM,MAAM,wBAAwB;AAClC,4EAA4E;AAC1E;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE,GAClB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC7C;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAE;AACnE,+EAA+E;GAC7E;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE,CAAC;AAE/B,qEAAqE;AACrE,MAAM,WAAW,wBAAwB;IACvC,+EAA+E;IAC/E,cAAc,EAAE,MAAM,CAAC;IACvB,8DAA8D;IAC9D,aAAa,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,KAAK,EAAE,gBAAgB,CAAC;CACzB;AAkBD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,OAAO,GAAG,eAAe,GAAG,IAAI,CAsB5E;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,YAAY,EACnB,OAAO,EAAE,wBAAwB,GAChC,wBAAwB,CA+B1B"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed contracts shared by the browser "Sign in with Oxy" OAuth transports.
|
|
3
|
+
*
|
|
4
|
+
* Two transports deliver the same authorization code to the same completion
|
|
5
|
+
* path (see `completeOAuthCode.ts`):
|
|
6
|
+
*
|
|
7
|
+
* - `redirect` — the historical full-page hand-off to `auth.oxy.so/authorize`.
|
|
8
|
+
* The RP tab navigates away and comes back to its registered `redirect_uri`
|
|
9
|
+
* with `?code=…&state=…`; cold boot finishes the exchange.
|
|
10
|
+
* - `popup` — a small `auth.oxy.so` window opened from the user's click. The RP
|
|
11
|
+
* stays mounted with its route and unsaved state intact; the IdP delivers the
|
|
12
|
+
* result to `window.opener` via `postMessage` and closes itself.
|
|
13
|
+
*
|
|
14
|
+
* Only the authorization code, the CSRF `state`, and a typed OAuth error ever
|
|
15
|
+
* cross the `postMessage` channel. Access tokens, device secrets, and the PKCE
|
|
16
|
+
* `code_verifier` NEVER do — the opener keeps the verifier and performs the code
|
|
17
|
+
* exchange itself.
|
|
18
|
+
*/
|
|
19
|
+
/** How a web relying party hands the user to the IdP for third-party sign-in. */
|
|
20
|
+
export type WebAuthMode = 'popup' | 'redirect';
|
|
21
|
+
/**
|
|
22
|
+
* Minimal structural handle over a popup `Window` — exactly what the popup
|
|
23
|
+
* transport needs: navigate it once the authorize URL is built, detect the user
|
|
24
|
+
* closing it (`closed`, polled — there is no cross-origin close event), and
|
|
25
|
+
* close it programmatically on completion. Satisfied directly by the value
|
|
26
|
+
* `window.open()` returns.
|
|
27
|
+
*
|
|
28
|
+
* Deliberately NOT `Window`: the transport must never read cross-origin
|
|
29
|
+
* properties off the popup, and a narrow handle makes that impossible to do by
|
|
30
|
+
* accident (and trivial to fake in tests).
|
|
31
|
+
*/
|
|
32
|
+
export interface OAuthPopupHandle {
|
|
33
|
+
readonly closed: boolean;
|
|
34
|
+
close(): void;
|
|
35
|
+
location: {
|
|
36
|
+
href: string;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The RP-side OAuth handshake for one authorize request: the CSRF `state` sent
|
|
41
|
+
* to the IdP and the PKCE `code_verifier` replayed on the token exchange.
|
|
42
|
+
*
|
|
43
|
+
* In `redirect` mode it is persisted to `sessionStorage` across the full-page
|
|
44
|
+
* navigation; in `popup` mode it never leaves memory.
|
|
45
|
+
*/
|
|
46
|
+
export interface OAuthHandshake {
|
|
47
|
+
/** Opaque CSRF token echoed back by the IdP and validated before any exchange. */
|
|
48
|
+
state: string;
|
|
49
|
+
/** The PKCE secret. Never crosses `postMessage`, a URL, or storage in popup mode. */
|
|
50
|
+
codeVerifier: string;
|
|
51
|
+
}
|
|
52
|
+
/** Successful authorization delivered by the IdP over `postMessage`. */
|
|
53
|
+
export interface OxyOAuthCodeMessage {
|
|
54
|
+
type: 'oxy:oauth:code';
|
|
55
|
+
code: string;
|
|
56
|
+
state: string;
|
|
57
|
+
}
|
|
58
|
+
/** Typed OAuth failure delivered by the IdP over `postMessage`. */
|
|
59
|
+
export interface OxyOAuthErrorMessage {
|
|
60
|
+
type: 'oxy:oauth:error';
|
|
61
|
+
error: string;
|
|
62
|
+
errorDescription?: string;
|
|
63
|
+
state?: string;
|
|
64
|
+
}
|
|
65
|
+
/** The ONLY two message shapes that may cross the popup channel. */
|
|
66
|
+
export type OxyOAuthMessage = OxyOAuthCodeMessage | OxyOAuthErrorMessage;
|
|
67
|
+
/** Session material handed to the provider's commit funnel after an exchange. */
|
|
68
|
+
export interface OAuthSessionCommitInput {
|
|
69
|
+
sessionId: string;
|
|
70
|
+
accessToken?: string;
|
|
71
|
+
deviceId?: string;
|
|
72
|
+
deviceSecret?: string;
|
|
73
|
+
userId: string;
|
|
74
|
+
expiresAt?: string;
|
|
75
|
+
user?: {
|
|
76
|
+
id: string;
|
|
77
|
+
username?: string;
|
|
78
|
+
avatar?: string;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Terminal outcome of one popup sign-in attempt. Every expected path — the user
|
|
83
|
+
* closing the window, a timeout, an IdP error — is a value, never a thrown
|
|
84
|
+
* exception.
|
|
85
|
+
*/
|
|
86
|
+
export type OAuthPopupOutcome =
|
|
87
|
+
/** The IdP delivered an authorization code whose `state` matched. */
|
|
88
|
+
{
|
|
89
|
+
kind: 'code';
|
|
90
|
+
code: string;
|
|
91
|
+
state: string;
|
|
92
|
+
}
|
|
93
|
+
/** The IdP delivered a typed OAuth error (`access_denied`, `login_required`, …). */
|
|
94
|
+
| {
|
|
95
|
+
kind: 'oauth-error';
|
|
96
|
+
error: string;
|
|
97
|
+
errorDescription?: string;
|
|
98
|
+
}
|
|
99
|
+
/** A well-formed message from our popup carried the wrong `state`. */
|
|
100
|
+
| {
|
|
101
|
+
kind: 'state-mismatch';
|
|
102
|
+
}
|
|
103
|
+
/** The user dismissed the popup without completing sign-in. */
|
|
104
|
+
| {
|
|
105
|
+
kind: 'closed';
|
|
106
|
+
}
|
|
107
|
+
/** No result arrived within the allotted window. */
|
|
108
|
+
| {
|
|
109
|
+
kind: 'timed-out';
|
|
110
|
+
}
|
|
111
|
+
/** No DOM message host (SSR / native) — the popup transport does not apply. */
|
|
112
|
+
| {
|
|
113
|
+
kind: 'unsupported';
|
|
114
|
+
};
|
|
115
|
+
/** Why the shared completion path could not produce a session. */
|
|
116
|
+
export type OAuthCompletionFailure = 'state-mismatch' | 'exchange-failed';
|
|
117
|
+
/** Result of the ONE completion path both transports run. */
|
|
118
|
+
export type OAuthCompletionResult = {
|
|
119
|
+
ok: true;
|
|
120
|
+
} | {
|
|
121
|
+
ok: false;
|
|
122
|
+
reason: OAuthCompletionFailure;
|
|
123
|
+
};
|
|
124
|
+
/** Why the transport fell back to a full-page redirect. */
|
|
125
|
+
export type WebOAuthRedirectReason =
|
|
126
|
+
/** `webAuthMode: 'redirect'` — the configured transport. */
|
|
127
|
+
'redirect-mode'
|
|
128
|
+
/** The browser refused `window.open` (blocker, or no gesture attribution). */
|
|
129
|
+
| 'popup-blocked'
|
|
130
|
+
/** The popup opened but could not be navigated to the authorize URL. */
|
|
131
|
+
| 'popup-navigation-failed';
|
|
132
|
+
/** Why a web sign-in attempt failed outright. */
|
|
133
|
+
export type WebOAuthFailureReason =
|
|
134
|
+
/** The handshake could not be persisted for the redirect return (no/blocked storage). */
|
|
135
|
+
'handshake-storage'
|
|
136
|
+
/** The `state` returned by the IdP did not match the one we sent. */
|
|
137
|
+
| 'state-mismatch'
|
|
138
|
+
/** `POST /auth/oauth/token` or the session commit failed. */
|
|
139
|
+
| 'exchange-failed'
|
|
140
|
+
/** The IdP reported a typed OAuth error. */
|
|
141
|
+
| 'idp-error';
|
|
142
|
+
/** Why a web sign-in attempt was not applicable at all. */
|
|
143
|
+
export type WebOAuthUnsupportedReason =
|
|
144
|
+
/** Not a browser (native / SSR) — native uses `openAuthorizeUrlNative`. */
|
|
145
|
+
'no-browser'
|
|
146
|
+
/** `sessionMode: 'identity'` has no third-party OAuth lane by construction. */
|
|
147
|
+
| 'identity-bound'
|
|
148
|
+
/** No `clientId` is configured on the provider. */
|
|
149
|
+
| 'missing-client-id';
|
|
150
|
+
/** Terminal, typed outcome of a web third-party sign-in attempt. */
|
|
151
|
+
export type WebOAuthSignInResult =
|
|
152
|
+
/** A session was committed; the RP is authenticated without a reload. */
|
|
153
|
+
{
|
|
154
|
+
status: 'signed-in';
|
|
155
|
+
}
|
|
156
|
+
/** The tab is navigating to the IdP; nothing else will resolve in this document. */
|
|
157
|
+
| {
|
|
158
|
+
status: 'redirecting';
|
|
159
|
+
via: WebOAuthRedirectReason;
|
|
160
|
+
}
|
|
161
|
+
/** The user dismissed the popup. */
|
|
162
|
+
| {
|
|
163
|
+
status: 'cancelled';
|
|
164
|
+
}
|
|
165
|
+
/** No result arrived within the allotted window. */
|
|
166
|
+
| {
|
|
167
|
+
status: 'timed-out';
|
|
168
|
+
} | {
|
|
169
|
+
status: 'failed';
|
|
170
|
+
reason: WebOAuthFailureReason;
|
|
171
|
+
description?: string;
|
|
172
|
+
} | {
|
|
173
|
+
status: 'unsupported';
|
|
174
|
+
reason: WebOAuthUnsupportedReason;
|
|
175
|
+
};
|
|
176
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/ui/oauth/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,iFAAiF;AACjF,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,UAAU,CAAC;AAE/C;;;;;;;;;;GAUG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,KAAK,IAAI,IAAI,CAAC;IACd,QAAQ,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,cAAc;IAC7B,kFAAkF;IAClF,KAAK,EAAE,MAAM,CAAC;IACd,qFAAqF;IACrF,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,wEAAwE;AACxE,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,gBAAgB,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,mEAAmE;AACnE,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,iBAAiB,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,oEAAoE;AACpE,MAAM,MAAM,eAAe,GAAG,mBAAmB,GAAG,oBAAoB,CAAC;AAEzE,iFAAiF;AACjF,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3D;AAED;;;;GAIG;AACH,MAAM,MAAM,iBAAiB;AAC3B,qEAAqE;AACnE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AAC/C,oFAAoF;GAClF;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAE;AACnE,sEAAsE;GACpE;IAAE,IAAI,EAAE,gBAAgB,CAAA;CAAE;AAC5B,+DAA+D;GAC7D;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE;AACpB,oDAAoD;GAClD;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE;AACvB,+EAA+E;GAC7E;IAAE,IAAI,EAAE,aAAa,CAAA;CAAE,CAAC;AAE5B,kEAAkE;AAClE,MAAM,MAAM,sBAAsB,GAAG,gBAAgB,GAAG,iBAAiB,CAAC;AAE1E,6DAA6D;AAC7D,MAAM,MAAM,qBAAqB,GAC7B;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GACZ;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,sBAAsB,CAAA;CAAE,CAAC;AAElD,2DAA2D;AAC3D,MAAM,MAAM,sBAAsB;AAChC,4DAA4D;AAC1D,eAAe;AACjB,8EAA8E;GAC5E,eAAe;AACjB,wEAAwE;GACtE,yBAAyB,CAAC;AAE9B,iDAAiD;AACjD,MAAM,MAAM,qBAAqB;AAC/B,yFAAyF;AACvF,mBAAmB;AACrB,qEAAqE;GACnE,gBAAgB;AAClB,6DAA6D;GAC3D,iBAAiB;AACnB,4CAA4C;GAC1C,WAAW,CAAC;AAEhB,2DAA2D;AAC3D,MAAM,MAAM,yBAAyB;AACnC,2EAA2E;AACzE,YAAY;AACd,+EAA+E;GAC7E,gBAAgB;AAClB,mDAAmD;GACjD,mBAAmB,CAAC;AAExB,oEAAoE;AACpE,MAAM,MAAM,oBAAoB;AAC9B,yEAAyE;AACvE;IAAE,MAAM,EAAE,WAAW,CAAA;CAAE;AACzB,oFAAoF;GAClF;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,GAAG,EAAE,sBAAsB,CAAA;CAAE;AACxD,oCAAoC;GAClC;IAAE,MAAM,EAAE,WAAW,CAAA;CAAE;AACzB,oDAAoD;GAClD;IAAE,MAAM,EAAE,WAAW,CAAA;CAAE,GACvB;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,qBAAqB,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GACzE;IAAE,MAAM,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,yBAAyB,CAAA;CAAE,CAAC"}
|
|
@@ -13,8 +13,6 @@ export declare const LogoIcon: () => null;
|
|
|
13
13
|
export declare const LogoText: () => null;
|
|
14
14
|
export declare const FollowButton: () => null;
|
|
15
15
|
export declare const OxyPayButton: () => null;
|
|
16
|
-
export declare const FontLoader: () => null;
|
|
17
|
-
export declare const setupFonts: () => Promise<boolean>;
|
|
18
16
|
export declare const useOxy: () => {};
|
|
19
17
|
export declare const useAuth: () => {};
|
|
20
18
|
export declare const useFollow: () => {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../../src/ui/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,eAAO,MAAM,WAAW,YAAgB,CAAC;AACzC,eAAO,MAAM,eAAe,YAAgB,CAAC;AAC7C,eAAO,MAAM,QAAQ,YAAgB,CAAC;AACtC,eAAO,MAAM,QAAQ,YAAgB,CAAC;AACtC,eAAO,MAAM,YAAY,YAAgB,CAAC;AAC1C,eAAO,MAAM,YAAY,YAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../../src/ui/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,eAAO,MAAM,WAAW,YAAgB,CAAC;AACzC,eAAO,MAAM,eAAe,YAAgB,CAAC;AAC7C,eAAO,MAAM,QAAQ,YAAgB,CAAC;AACtC,eAAO,MAAM,QAAQ,YAAgB,CAAC;AACtC,eAAO,MAAM,YAAY,YAAgB,CAAC;AAC1C,eAAO,MAAM,YAAY,YAAgB,CAAC;AAG1C,eAAO,MAAM,MAAM,UAAW,CAAC;AAG/B,eAAO,MAAM,OAAO,UAAW,CAAC;AAChC,eAAO,MAAM,SAAS,UAAW,CAAC;AAClC,eAAO,MAAM,UAAU;;;CAA0B,CAAC;AAGlD,eAAO,MAAM,aAAa,YAAgB,CAAC;AAG3C,eAAO,MAAM,YAAY,UAAW,CAAC;AACrC,eAAO,MAAM,eAAe,UAAW,CAAC;AAGxC,eAAO,MAAM,KAAK;;;;;;;CAUjB,CAAC;AAGF,OAAO,EACH,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,GACtB,MAAM,0BAAuB,CAAC;AAC/B,YAAY,EAAE,sBAAsB,EAAE,MAAM,0BAAuB,CAAC"}
|
|
@@ -5,17 +5,13 @@
|
|
|
5
5
|
* (`deviceId` + `deviceSecret`) per origin (web) / per device (native), and the
|
|
6
6
|
* SDK re-mints the access token from that credential on cold boot. `@oxyhq/core`
|
|
7
7
|
* owns the store shape + logic (`createWebAuthStateStore` /
|
|
8
|
-
* `createNativeAuthStateStore`); this module only
|
|
8
|
+
* `createNativeAuthStateStore`); this module only selects the platform storage
|
|
9
9
|
* seam:
|
|
10
10
|
*
|
|
11
11
|
* - web → `createWebAuthStateStore()` (localStorage, in-memory fallback).
|
|
12
12
|
* - native → `createNativeAuthStateStore(secureKV)` for the SESSION blob over
|
|
13
|
-
* `
|
|
14
|
-
*
|
|
15
|
-
* `expo-secure-store` is loaded via a runtime-computed dynamic import (the same
|
|
16
|
-
* optional-native-module pattern `OxyProvider` uses for netinfo / keyboard
|
|
17
|
-
* controller), so the web bundle never pulls it and a device without it falls
|
|
18
|
-
* back to AsyncStorage rather than crashing.
|
|
13
|
+
* the shared `createNativeSecureKeyValueStorage()` adapter
|
|
14
|
+
* (`expo-secure-store`, AsyncStorage fallback).
|
|
19
15
|
*/
|
|
20
16
|
import { type AuthStateStore } from '@oxyhq/core';
|
|
21
17
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authStore.d.ts","sourceRoot":"","sources":["../../../../../src/ui/session/authStore.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"authStore.d.ts","sourceRoot":"","sources":["../../../../../src/ui/session/authStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,aAAa,CAAC;AAIrB;;;;;;GAMG;AACH,wBAAgB,4BAA4B,IAAI,cAAc,CAM7D"}
|
|
@@ -25,8 +25,15 @@ import { SessionClient, createSessionClientHost, type OxyServices, type SessionS
|
|
|
25
25
|
*
|
|
26
26
|
* The realtime socket uses bearer when authenticated, or deviceId+deviceSecret
|
|
27
27
|
* when signed out (after the one-shot join redirect).
|
|
28
|
+
*
|
|
29
|
+
* `getPinnedAccountId` reports the account an IDENTITY-BOUND provider
|
|
30
|
+
* (`sessionMode: 'identity'`) is pinned to, and `null` for every account-mode
|
|
31
|
+
* provider — which is exactly the value `SessionClient` and the transport read
|
|
32
|
+
* when the option is absent, so account mode is unchanged. While it reports an
|
|
33
|
+
* account, the client tracks device state truthfully but never re-binds its
|
|
34
|
+
* bearer to the device's mutable active account.
|
|
28
35
|
*/
|
|
29
|
-
export declare function createSessionClient(oxyServices: OxyServices, onUnauthenticated?: (origin: SessionStateOrigin) => void): {
|
|
36
|
+
export declare function createSessionClient(oxyServices: OxyServices, onUnauthenticated?: (origin: SessionStateOrigin) => void, getPinnedAccountId?: () => string | null): {
|
|
30
37
|
client: SessionClient;
|
|
31
38
|
host: ReturnType<typeof createSessionClientHost>;
|
|
32
39
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createSessionClient.d.ts","sourceRoot":"","sources":["../../../../../src/ui/session/createSessionClient.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC;AAGrB
|
|
1
|
+
{"version":3,"file":"createSessionClient.d.ts","sourceRoot":"","sources":["../../../../../src/ui/session/createSessionClient.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,KAAK,WAAW,EAChB,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC;AAGrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,mBAAmB,CACjC,WAAW,EAAE,WAAW,EACxB,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,EACxD,kBAAkB,CAAC,EAAE,MAAM,MAAM,GAAG,IAAI,GACvC;IACD,MAAM,EAAE,aAAa,CAAC;IACtB,IAAI,EAAE,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC;CAClD,CAUA"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identity-bound sessions — the PLATFORM half of `sessionMode: 'identity'`.
|
|
3
|
+
*
|
|
4
|
+
* `@oxyhq/core` owns everything platform-agnostic about an identity-bound
|
|
5
|
+
* session: the pin store shapes, `resolveIdentityPin`,
|
|
6
|
+
* `establishIdentitySession`, and the pinned cold-boot / re-mint lanes. What it
|
|
7
|
+
* deliberately leaves out is WHICH pin store a given runtime should use, so this
|
|
8
|
+
* module supplies it — web `localStorage` vs the same native SecureStore adapter
|
|
9
|
+
* the device credential already persists through — and adds the one piece of
|
|
10
|
+
* state the provider needs on top: a memoised, SYNCHRONOUSLY readable pinned
|
|
11
|
+
* account id.
|
|
12
|
+
*
|
|
13
|
+
* Why the memo matters: `SessionClient.getPinnedAccountId` is a synchronous read
|
|
14
|
+
* on the socket/apply path, while resolving the pin is asynchronous (a storage
|
|
15
|
+
* read plus a keychain read, through `resolveIdentityPin`). The provider
|
|
16
|
+
* resolves it before the cold boot and after every (re-)established identity
|
|
17
|
+
* session; every read after that is free.
|
|
18
|
+
*/
|
|
19
|
+
import { type IdentityBinding } from '@oxyhq/core';
|
|
20
|
+
/**
|
|
21
|
+
* The provider-scoped identity binding: the core {@link IdentityBinding} handed
|
|
22
|
+
* to the cold boot and the re-mint handler, plus the resolved pin the projection
|
|
23
|
+
* and `SessionClient` bind to.
|
|
24
|
+
*/
|
|
25
|
+
export interface IdentitySessionBinding {
|
|
26
|
+
/** Handed to `runSessionColdBoot` and `installAuthRefreshHandler`. */
|
|
27
|
+
readonly binding: IdentityBinding;
|
|
28
|
+
/**
|
|
29
|
+
* The last resolved pinned account id, read synchronously. `null` until the
|
|
30
|
+
* first resolve lands, and after a resolve that found no usable pin.
|
|
31
|
+
*/
|
|
32
|
+
getPinnedAccountId(): string | null;
|
|
33
|
+
/**
|
|
34
|
+
* Resolve the pin, reusing the memo once a pinned account is known.
|
|
35
|
+
* Concurrent callers share one in-flight resolve.
|
|
36
|
+
*/
|
|
37
|
+
ensurePinnedAccountId(): Promise<string | null>;
|
|
38
|
+
/**
|
|
39
|
+
* Drop the memo and re-resolve. Used after a lane that may have rewritten or
|
|
40
|
+
* cleared the pin (the cold boot, or a re-established identity session).
|
|
41
|
+
*/
|
|
42
|
+
refreshPinnedAccountId(): Promise<string | null>;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Thrown by every account-graph mutation while the provider runs in
|
|
46
|
+
* `sessionMode: 'identity'`.
|
|
47
|
+
*
|
|
48
|
+
* An identity-bound app's user is the owner of the local identity key — fixed,
|
|
49
|
+
* for the lifetime of that key. Switching it is not a temporarily-unavailable
|
|
50
|
+
* operation that could be retried, it is not part of this mode's contract at
|
|
51
|
+
* all, so the surfaces reject loudly rather than resolving to a no-op that would
|
|
52
|
+
* read to the caller as a successful switch.
|
|
53
|
+
*/
|
|
54
|
+
export declare class IdentityBoundSessionError extends Error {
|
|
55
|
+
readonly operation: string;
|
|
56
|
+
readonly name = "IdentityBoundSessionError";
|
|
57
|
+
readonly code = "identity_bound_session";
|
|
58
|
+
constructor(operation: string);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Build the identity binding for this runtime. Called ONCE per provider mount,
|
|
62
|
+
* and ONLY when `sessionMode: 'identity'` — account-mode providers never
|
|
63
|
+
* construct a pin store.
|
|
64
|
+
*/
|
|
65
|
+
export declare function createIdentitySessionBinding(): IdentitySessionBinding;
|
|
66
|
+
//# sourceMappingURL=identityBinding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identityBinding.d.ts","sourceRoot":"","sources":["../../../../../src/ui/session/identityBinding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,aAAa,CAAC;AAIrB;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,sEAAsE;IACtE,QAAQ,CAAC,OAAO,EAAE,eAAe,CAAC;IAClC;;;OAGG;IACH,kBAAkB,IAAI,MAAM,GAAG,IAAI,CAAC;IACpC;;;OAGG;IACH,qBAAqB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAChD;;;OAGG;IACH,sBAAsB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;CAClD;AAED;;;;;;;;;GASG;AACH,qBAAa,yBAA0B,SAAQ,KAAK;IAGtC,QAAQ,CAAC,SAAS,EAAE,MAAM;IAFtC,SAAkB,IAAI,+BAA+B;IACrD,QAAQ,CAAC,IAAI,4BAA4B;gBACpB,SAAS,EAAE,MAAM;CAKvC;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,IAAI,sBAAsB,CAsCrE"}
|