@oxyhq/services 5.26.3 → 5.27.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/dist/web/oxy-services.esm.js +2 -0
- package/dist/web/oxy-services.esm.js.map +1 -0
- package/dist/web/types/assets/icons/OxyServices.d.ts +28 -0
- package/dist/web/types/assets/illustrations/HighFive.d.ts +8 -0
- package/dist/web/types/constants/version.d.ts +13 -0
- package/dist/web/types/core/AuthManager.d.ts +143 -0
- package/dist/web/types/core/CrossDomainAuth.d.ts +160 -0
- package/dist/web/types/core/HttpService.d.ts +163 -0
- package/dist/web/types/core/OxyServices.base.d.ts +126 -0
- package/dist/web/types/core/OxyServices.d.ts +81 -0
- package/dist/web/types/core/OxyServices.errors.d.ts +11 -0
- package/dist/web/types/core/index.d.ts +20 -0
- package/dist/web/types/core/mixins/OxyServices.analytics.d.ts +66 -0
- package/dist/web/types/core/mixins/OxyServices.assets.d.ts +135 -0
- package/dist/web/types/core/mixins/OxyServices.auth.d.ts +186 -0
- package/dist/web/types/core/mixins/OxyServices.developer.d.ts +99 -0
- package/dist/web/types/core/mixins/OxyServices.devices.d.ts +96 -0
- package/dist/web/types/core/mixins/OxyServices.features.d.ts +228 -0
- package/dist/web/types/core/mixins/OxyServices.fedcm.d.ts +200 -0
- package/dist/web/types/core/mixins/OxyServices.karma.d.ts +85 -0
- package/dist/web/types/core/mixins/OxyServices.language.d.ts +81 -0
- package/dist/web/types/core/mixins/OxyServices.location.d.ts +64 -0
- package/dist/web/types/core/mixins/OxyServices.payment.d.ts +111 -0
- package/dist/web/types/core/mixins/OxyServices.popup.d.ts +205 -0
- package/dist/web/types/core/mixins/OxyServices.privacy.d.ts +122 -0
- package/dist/web/types/core/mixins/OxyServices.redirect.d.ts +245 -0
- package/dist/web/types/core/mixins/OxyServices.security.d.ts +78 -0
- package/dist/web/types/core/mixins/OxyServices.user.d.ts +184 -0
- package/dist/web/types/core/mixins/OxyServices.utility.d.ts +93 -0
- package/dist/web/types/core/mixins/index.d.ts +30 -0
- package/dist/web/types/core/mixins/mixinHelpers.d.ts +31 -0
- package/dist/web/types/crypto/index.d.ts +11 -0
- package/dist/web/types/crypto/keyManager.d.ts +189 -0
- package/dist/web/types/crypto/polyfill.d.ts +12 -0
- package/dist/web/types/crypto/recoveryPhrase.d.ts +58 -0
- package/dist/web/types/crypto/signatureService.d.ts +86 -0
- package/dist/web/types/i18n/index.d.ts +3 -0
- package/dist/web/types/index.d.ts +62 -0
- package/dist/web/types/lib/sonner-safe.d.ts +8 -0
- package/dist/web/types/lib/sonner.d.ts +11 -0
- package/dist/web/types/lib/sonner.web.d.ts +14 -0
- package/dist/web/types/models/interfaces.d.ts +415 -0
- package/dist/web/types/models/session.d.ts +27 -0
- package/dist/web/types/node/index.d.ts +9 -0
- package/dist/web/types/shared/index.d.ts +28 -0
- package/dist/web/types/shared/utils/colorUtils.d.ts +104 -0
- package/dist/web/types/shared/utils/debugUtils.d.ts +48 -0
- package/dist/web/types/shared/utils/errorUtils.d.ts +97 -0
- package/dist/web/types/shared/utils/index.d.ts +13 -0
- package/dist/web/types/shared/utils/networkUtils.d.ts +139 -0
- package/dist/web/types/shared/utils/themeUtils.d.ts +90 -0
- package/dist/web/types/ui/client.d.ts +33 -0
- package/dist/web/types/ui/components/ActivityIndicator.d.ts +44 -0
- package/dist/web/types/ui/components/AnimationExample.d.ts +3 -0
- package/dist/web/types/ui/components/AutoHeightScrollView.d.ts +22 -0
- package/dist/web/types/ui/components/Avatar.d.ts +60 -0
- package/dist/web/types/ui/components/BottomSheet.d.ts +28 -0
- package/dist/web/types/ui/components/BottomSheetRouter.d.ts +8 -0
- package/dist/web/types/ui/components/CrossFadeIcon.d.ts +26 -0
- package/dist/web/types/ui/components/EmptyState.d.ts +7 -0
- package/dist/web/types/ui/components/ErrorBoundary.d.ts +30 -0
- package/dist/web/types/ui/components/FollowButton.d.ts +17 -0
- package/dist/web/types/ui/components/FontLoader.d.ts +14 -0
- package/dist/web/types/ui/components/GroupedItem.d.ts +23 -0
- package/dist/web/types/ui/components/GroupedSection.d.ts +24 -0
- package/dist/web/types/ui/components/Header.d.ts +37 -0
- package/dist/web/types/ui/components/HelperText.d.ts +46 -0
- package/dist/web/types/ui/components/Icon.d.ts +59 -0
- package/dist/web/types/ui/components/IconButton/IconButton.d.ts +98 -0
- package/dist/web/types/ui/components/IconButton/utils.d.ts +18 -0
- package/dist/web/types/ui/components/LoadingState.d.ts +8 -0
- package/dist/web/types/ui/components/OxyLogo.d.ts +28 -0
- package/dist/web/types/ui/components/OxyPayButton.d.ts +28 -0
- package/dist/web/types/ui/components/OxyProvider.d.ts +33 -0
- package/dist/web/types/ui/components/OxySignInButton.d.ts +64 -0
- package/dist/web/types/ui/components/ProfileCard.d.ts +17 -0
- package/dist/web/types/ui/components/QuickActions.d.ts +14 -0
- package/dist/web/types/ui/components/Section.d.ts +11 -0
- package/dist/web/types/ui/components/SectionTitle.d.ts +9 -0
- package/dist/web/types/ui/components/SettingRow.d.ts +19 -0
- package/dist/web/types/ui/components/SignInModal.d.ts +17 -0
- package/dist/web/types/ui/components/StepBasedScreen.d.ts +25 -0
- package/dist/web/types/ui/components/Surface.d.ts +75 -0
- package/dist/web/types/ui/components/TextField/Addons/Outline.d.ts +15 -0
- package/dist/web/types/ui/components/TextField/Addons/Underline.d.ts +18 -0
- package/dist/web/types/ui/components/TextField/Adornment/TextFieldAdornment.d.ts +44 -0
- package/dist/web/types/ui/components/TextField/Adornment/TextFieldAffix.d.ts +72 -0
- package/dist/web/types/ui/components/TextField/Adornment/TextFieldIcon.d.ts +77 -0
- package/dist/web/types/ui/components/TextField/Adornment/enums.d.ts +12 -0
- package/dist/web/types/ui/components/TextField/Adornment/types.d.ts +11 -0
- package/dist/web/types/ui/components/TextField/Adornment/utils.d.ts +11 -0
- package/dist/web/types/ui/components/TextField/Label/InputLabel.d.ts +4 -0
- package/dist/web/types/ui/components/TextField/Label/LabelBackground.d.ts +3 -0
- package/dist/web/types/ui/components/TextField/TextFieldFlat.d.ts +3 -0
- package/dist/web/types/ui/components/TextField/TextFieldOutlined.d.ts +3 -0
- package/dist/web/types/ui/components/TextField/constants.d.ts +31 -0
- package/dist/web/types/ui/components/TextField/helpers.d.ts +96 -0
- package/dist/web/types/ui/components/TextField/types.d.ts +155 -0
- package/dist/web/types/ui/components/TextField.d.ts +191 -0
- package/dist/web/types/ui/components/TouchableRipple/Pressable.d.ts +12 -0
- package/dist/web/types/ui/components/TouchableRipple/TouchableRipple.d.ts +61 -0
- package/dist/web/types/ui/components/TouchableRipple/utils.d.ts +10 -0
- package/dist/web/types/ui/components/Typography/AnimatedText.d.ts +34 -0
- package/dist/web/types/ui/components/Typography/types.d.ts +18 -0
- package/dist/web/types/ui/components/WebOxyProvider.d.ts +51 -0
- package/dist/web/types/ui/components/feedback/FormInput.d.ts +19 -0
- package/dist/web/types/ui/components/feedback/ProgressIndicator.d.ts +10 -0
- package/dist/web/types/ui/components/feedback/constants.d.ts +4 -0
- package/dist/web/types/ui/components/feedback/feedbackStyles.d.ts +279 -0
- package/dist/web/types/ui/components/feedback/index.d.ts +6 -0
- package/dist/web/types/ui/components/feedback/types.d.ts +45 -0
- package/dist/web/types/ui/components/feedback/useFeedbackForm.d.ts +8 -0
- package/dist/web/types/ui/components/fileManagement/AnimatedButton.d.ts +15 -0
- package/dist/web/types/ui/components/fileManagement/FileDetailsModal.d.ts +14 -0
- package/dist/web/types/ui/components/fileManagement/FileViewer.d.ts +17 -0
- package/dist/web/types/ui/components/fileManagement/UploadPreview.d.ts +20 -0
- package/dist/web/types/ui/components/fileManagement/styles.d.ts +859 -0
- package/dist/web/types/ui/components/icon/FAIRWalletIcon.d.ts +8 -0
- package/dist/web/types/ui/components/icon/OxyIcon.d.ts +9 -0
- package/dist/web/types/ui/components/icon/index.d.ts +3 -0
- package/dist/web/types/ui/components/index.d.ts +16 -0
- package/dist/web/types/ui/components/internal/GroupedPillButtons.d.ts +17 -0
- package/dist/web/types/ui/components/internal/PinInput.d.ts +22 -0
- package/dist/web/types/ui/components/modals/DeleteAccountModal.d.ts +18 -0
- package/dist/web/types/ui/components/modals/index.d.ts +1 -0
- package/dist/web/types/ui/components/payment/PaymentDetailsStep.d.ts +20 -0
- package/dist/web/types/ui/components/payment/PaymentMethodStep.d.ts +13 -0
- package/dist/web/types/ui/components/payment/PaymentReviewStep.d.ts +15 -0
- package/dist/web/types/ui/components/payment/PaymentSuccessStep.d.ts +9 -0
- package/dist/web/types/ui/components/payment/PaymentSummaryStep.d.ts +14 -0
- package/dist/web/types/ui/components/payment/constants.d.ts +6 -0
- package/dist/web/types/ui/components/payment/index.d.ts +8 -0
- package/dist/web/types/ui/components/payment/paymentStyles.d.ts +395 -0
- package/dist/web/types/ui/components/payment/types.d.ts +39 -0
- package/dist/web/types/ui/components/photogrid/JustifiedPhotoGrid.d.ts +26 -0
- package/dist/web/types/ui/components/styles/overlay.d.ts +3 -0
- package/dist/web/types/ui/components/styles/shadow.d.ts +2 -0
- package/dist/web/types/ui/components/theming.d.ts +7 -0
- package/dist/web/types/ui/components/types.d.ts +79 -0
- package/dist/web/types/ui/components/utils/forwardRef.d.ts +11 -0
- package/dist/web/types/ui/components/utils/hasTouchHandler.d.ts +5 -0
- package/dist/web/types/ui/components/utils/roundLayoutSize.d.ts +1 -0
- package/dist/web/types/ui/components/utils/splitStyles.d.ts +19 -0
- package/dist/web/types/ui/constants/iconColors.d.ts +129 -0
- package/dist/web/types/ui/constants/spacing.d.ts +32 -0
- package/dist/web/types/ui/constants/theme.d.ts +96 -0
- package/dist/web/types/ui/context/OxyContext.d.ts +74 -0
- package/dist/web/types/ui/context/ThemeContext.d.ts +18 -0
- package/dist/web/types/ui/context/hooks/useAuthOperations.d.ts +39 -0
- package/dist/web/types/ui/context/hooks/useDeviceManagement.d.ts +26 -0
- package/dist/web/types/ui/context/hooks/useLanguageManagement.d.ts +24 -0
- package/dist/web/types/ui/context/hooks/useSessionManagement.d.ts +40 -0
- package/dist/web/types/ui/hooks/index.d.ts +6 -0
- package/dist/web/types/ui/hooks/mutations/index.d.ts +8 -0
- package/dist/web/types/ui/hooks/mutations/mutationFactory.d.ts +75 -0
- package/dist/web/types/ui/hooks/mutations/useAccountMutations.d.ts +68 -0
- package/dist/web/types/ui/hooks/mutations/useServicesMutations.d.ts +22 -0
- package/dist/web/types/ui/hooks/queries/index.d.ts +10 -0
- package/dist/web/types/ui/hooks/queries/queryKeys.d.ts +64 -0
- package/dist/web/types/ui/hooks/queries/useAccountQueries.d.ts +42 -0
- package/dist/web/types/ui/hooks/queries/useSecurityQueries.d.ts +14 -0
- package/dist/web/types/ui/hooks/queries/useServicesQueries.d.ts +31 -0
- package/dist/web/types/ui/hooks/queryClient.d.ts +18 -0
- package/dist/web/types/ui/hooks/useAssets.d.ts +34 -0
- package/dist/web/types/ui/hooks/useAsyncAction.d.ts +50 -0
- package/dist/web/types/ui/hooks/useAuth.d.ts +73 -0
- package/dist/web/types/ui/hooks/useColorScheme.d.ts +7 -0
- package/dist/web/types/ui/hooks/useDeviceManagement.d.ts +26 -0
- package/dist/web/types/ui/hooks/useFileDownloadUrl.d.ts +18 -0
- package/dist/web/types/ui/hooks/useFileFiltering.d.ts +28 -0
- package/dist/web/types/ui/hooks/useFollow.d.ts +61 -0
- package/dist/web/types/ui/hooks/useFollow.types.d.ts +32 -0
- package/dist/web/types/ui/hooks/useI18n.d.ts +4 -0
- package/dist/web/types/ui/hooks/useLanguageManagement.d.ts +24 -0
- package/dist/web/types/ui/hooks/useProfileEditing.d.ts +35 -0
- package/dist/web/types/ui/hooks/useQueryClient.d.ts +6 -0
- package/dist/web/types/ui/hooks/useSessionManagement.d.ts +40 -0
- package/dist/web/types/ui/hooks/useSessionSocket.d.ts +13 -0
- package/dist/web/types/ui/hooks/useSettingToggle.d.ts +56 -0
- package/dist/web/types/ui/hooks/useStorage.d.ts +15 -0
- package/dist/web/types/ui/hooks/useThemeColors.d.ts +93 -0
- package/dist/web/types/ui/hooks/useThemeStyles.d.ts +44 -0
- package/dist/web/types/ui/hooks/useWebSSO.d.ts +57 -0
- package/dist/web/types/ui/index.d.ts +7 -0
- package/dist/web/types/ui/isFrontend.d.ts +2 -0
- package/dist/web/types/ui/navigation/bottomSheetManager.d.ts +26 -0
- package/dist/web/types/ui/navigation/routes.d.ts +5 -0
- package/dist/web/types/ui/screens/AccountCenterScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/AccountOverviewScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/AccountSettingsScreen.d.ts +7 -0
- package/dist/web/types/ui/screens/AccountSwitcherScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/AccountVerificationScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/AppInfoScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/EditProfileFieldScreen.d.ts +12 -0
- package/dist/web/types/ui/screens/FAQScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/FeedbackScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/FileManagementScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/FollowersListScreen.d.ts +8 -0
- package/dist/web/types/ui/screens/FollowingListScreen.d.ts +8 -0
- package/dist/web/types/ui/screens/HelpSupportScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/HistoryViewScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/LanguageSelectorScreen.d.ts +6 -0
- package/dist/web/types/ui/screens/LearnMoreUsernamesScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/LegalDocumentsScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/OxyAuthScreen.d.ts +16 -0
- package/dist/web/types/ui/screens/PaymentGatewayScreen.d.ts +14 -0
- package/dist/web/types/ui/screens/PremiumSubscriptionScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/PrivacySettingsScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/ProfileScreen.d.ts +8 -0
- package/dist/web/types/ui/screens/SavesCollectionsScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/SearchSettingsScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/SessionManagementScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/UserLinksScreen.d.ts +14 -0
- package/dist/web/types/ui/screens/UserListScreen.d.ts +10 -0
- package/dist/web/types/ui/screens/WelcomeNewUserScreen.d.ts +12 -0
- package/dist/web/types/ui/screens/karma/KarmaAboutScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/karma/KarmaCenterScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/karma/KarmaFAQScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/karma/KarmaLeaderboardScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/karma/KarmaRewardsScreen.d.ts +4 -0
- package/dist/web/types/ui/screens/karma/KarmaRulesScreen.d.ts +4 -0
- package/dist/web/types/ui/server.d.ts +42 -0
- package/dist/web/types/ui/stores/accountStore.d.ts +33 -0
- package/dist/web/types/ui/stores/assetStore.d.ts +53 -0
- package/dist/web/types/ui/stores/authStore.d.ts +16 -0
- package/dist/web/types/ui/stores/fileStore.d.ts +30 -0
- package/dist/web/types/ui/stores/followStore.d.ts +24 -0
- package/dist/web/types/ui/styles/authStyles.d.ts +331 -0
- package/dist/web/types/ui/styles/fonts.d.ts +20 -0
- package/dist/web/types/ui/styles/index.d.ts +4 -0
- package/dist/web/types/ui/styles/spacing.d.ts +48 -0
- package/dist/web/types/ui/styles/theme.d.ts +67 -0
- package/dist/web/types/ui/types/fileManagement.d.ts +40 -0
- package/dist/web/types/ui/types/navigation.d.ts +36 -0
- package/dist/web/types/ui/utils/authHelpers.d.ts +98 -0
- package/dist/web/types/ui/utils/avatarUtils.d.ts +33 -0
- package/dist/web/types/ui/utils/colorUtils.d.ts +9 -0
- package/dist/web/types/ui/utils/confirmAction.d.ts +6 -0
- package/dist/web/types/ui/utils/errorHandlers.d.ts +34 -0
- package/dist/web/types/ui/utils/fileManagement.d.ts +86 -0
- package/dist/web/types/ui/utils/iconNames.d.ts +111 -0
- package/dist/web/types/ui/utils/sessionHelpers.d.ts +63 -0
- package/dist/web/types/ui/utils/storageHelpers.d.ts +27 -0
- package/dist/web/types/ui/utils/themeUtils.d.ts +10 -0
- package/dist/web/types/ui/utils/userUtils.d.ts +28 -0
- package/dist/web/types/utils/apiUtils.d.ts +53 -0
- package/dist/web/types/utils/asyncUtils.d.ts +58 -0
- package/dist/web/types/utils/cache.d.ts +127 -0
- package/dist/web/types/utils/deviceManager.d.ts +65 -0
- package/dist/web/types/utils/errorUtils.d.ts +46 -0
- package/dist/web/types/utils/hookUtils.d.ts +101 -0
- package/dist/web/types/utils/index.d.ts +6 -0
- package/dist/web/types/utils/languageUtils.d.ts +37 -0
- package/dist/web/types/utils/loggerUtils.d.ts +48 -0
- package/dist/web/types/utils/platform.d.ts +40 -0
- package/dist/web/types/utils/platformInit.d.ts +8 -0
- package/dist/web/types/utils/requestUtils.d.ts +123 -0
- package/dist/web/types/utils/sessionUtils.d.ts +54 -0
- package/dist/web/types/utils/validationUtils.d.ts +85 -0
- package/dist/web/types/web/WebOxyContext.d.ts +151 -0
- package/dist/web/types/web/index.d.ts +52 -0
- package/dist/web/types/web.d.ts +53 -0
- package/package.json +77 -35
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import type { OxyServicesBase } from '../OxyServices.base';
|
|
2
|
+
import type { SessionLoginResponse } from '../../models/session';
|
|
3
|
+
export interface RedirectAuthOptions {
|
|
4
|
+
redirectUri?: string;
|
|
5
|
+
mode?: 'login' | 'signup';
|
|
6
|
+
preserveUrl?: boolean;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Redirect-based Cross-Domain Authentication Mixin
|
|
10
|
+
*
|
|
11
|
+
* Implements traditional OAuth2 redirect flow as a fallback when popup or
|
|
12
|
+
* FedCM are not available or fail (e.g., mobile browsers, popup blockers).
|
|
13
|
+
*
|
|
14
|
+
* Flow:
|
|
15
|
+
* 1. Save current URL
|
|
16
|
+
* 2. Redirect to auth.oxy.so/login
|
|
17
|
+
* 3. User signs in
|
|
18
|
+
* 4. Redirect back with token in URL
|
|
19
|
+
* 5. Extract token, restore session, clean URL
|
|
20
|
+
*
|
|
21
|
+
* Features:
|
|
22
|
+
* - Works on all browsers (including old mobile browsers)
|
|
23
|
+
* - Automatic URL cleanup after auth
|
|
24
|
+
* - State preservation option
|
|
25
|
+
* - CSRF protection via state parameter
|
|
26
|
+
*
|
|
27
|
+
* Trade-offs:
|
|
28
|
+
* - Loses JavaScript app state (full page navigation)
|
|
29
|
+
* - Visible redirect (user sees navigation)
|
|
30
|
+
* - Slower perceived performance
|
|
31
|
+
*/
|
|
32
|
+
export declare function OxyServicesRedirectAuthMixin<T extends typeof OxyServicesBase>(Base: T): {
|
|
33
|
+
new (...args: any[]): {
|
|
34
|
+
/**
|
|
35
|
+
* Sign in using full page redirect
|
|
36
|
+
*
|
|
37
|
+
* Redirects the user to auth.oxy.so for authentication. After successful
|
|
38
|
+
* sign-in, the user will be redirected back to the current page (or custom
|
|
39
|
+
* redirect URI) with authentication tokens in the URL.
|
|
40
|
+
*
|
|
41
|
+
* Call handleAuthCallback() on app startup to complete the flow.
|
|
42
|
+
*
|
|
43
|
+
* @param options - Redirect configuration options
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* // Initiate sign-in
|
|
48
|
+
* const handleSignIn = () => {
|
|
49
|
+
* oxyServices.signInWithRedirect();
|
|
50
|
+
* };
|
|
51
|
+
*
|
|
52
|
+
* // Handle callback on app startup
|
|
53
|
+
* useEffect(() => {
|
|
54
|
+
* const session = oxyServices.handleAuthCallback();
|
|
55
|
+
* if (session) {
|
|
56
|
+
* setUser(session.user);
|
|
57
|
+
* }
|
|
58
|
+
* }, []);
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
signInWithRedirect(options?: RedirectAuthOptions): void;
|
|
62
|
+
/**
|
|
63
|
+
* Sign up using full page redirect
|
|
64
|
+
*
|
|
65
|
+
* Same as signInWithRedirect but opens the signup page by default.
|
|
66
|
+
*/
|
|
67
|
+
signUpWithRedirect(options?: RedirectAuthOptions): void;
|
|
68
|
+
/**
|
|
69
|
+
* Handle authentication callback
|
|
70
|
+
*
|
|
71
|
+
* Call this on app startup to check if the current page load is a
|
|
72
|
+
* redirect back from the authentication server. If it is, this method
|
|
73
|
+
* will extract the tokens, store them, and clean up the URL.
|
|
74
|
+
*
|
|
75
|
+
* @returns Session data if this is a callback, null otherwise
|
|
76
|
+
* @throws {OxyAuthenticationError} If state validation fails (CSRF attack)
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```typescript
|
|
80
|
+
* // In your app's root component or startup logic
|
|
81
|
+
* useEffect(() => {
|
|
82
|
+
* try {
|
|
83
|
+
* const session = oxyServices.handleAuthCallback();
|
|
84
|
+
* if (session) {
|
|
85
|
+
* console.log('Logged in:', session.user);
|
|
86
|
+
* setUser(session.user);
|
|
87
|
+
* } else {
|
|
88
|
+
* // Not a callback, check for existing session
|
|
89
|
+
* const restored = oxyServices.restoreSession();
|
|
90
|
+
* if (!restored) {
|
|
91
|
+
* // No session, show login button
|
|
92
|
+
* }
|
|
93
|
+
* }
|
|
94
|
+
* } catch (error) {
|
|
95
|
+
* console.error('Auth callback failed:', error);
|
|
96
|
+
* }
|
|
97
|
+
* }, []);
|
|
98
|
+
* ```
|
|
99
|
+
*/
|
|
100
|
+
handleAuthCallback(): SessionLoginResponse | null;
|
|
101
|
+
/**
|
|
102
|
+
* Restore session from storage
|
|
103
|
+
*
|
|
104
|
+
* Attempts to restore a previously authenticated session from localStorage.
|
|
105
|
+
* Call this on app startup if handleAuthCallback() returns null.
|
|
106
|
+
*
|
|
107
|
+
* @returns True if session was restored, false otherwise
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```typescript
|
|
111
|
+
* useEffect(() => {
|
|
112
|
+
* const session = oxyServices.handleAuthCallback();
|
|
113
|
+
* if (!session) {
|
|
114
|
+
* const restored = oxyServices.restoreSession();
|
|
115
|
+
* if (!restored) {
|
|
116
|
+
* // No session, user needs to sign in
|
|
117
|
+
* setShowLogin(true);
|
|
118
|
+
* }
|
|
119
|
+
* }
|
|
120
|
+
* }, []);
|
|
121
|
+
* ```
|
|
122
|
+
*/
|
|
123
|
+
restoreSession(): boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Clear stored session
|
|
126
|
+
*
|
|
127
|
+
* Removes all authentication data from storage. Call this on logout.
|
|
128
|
+
*/
|
|
129
|
+
clearStoredSession(): void;
|
|
130
|
+
/**
|
|
131
|
+
* Get stored session ID
|
|
132
|
+
*/
|
|
133
|
+
getStoredSessionId(): string | null;
|
|
134
|
+
/**
|
|
135
|
+
* Build authentication URL with query parameters
|
|
136
|
+
*
|
|
137
|
+
* @private
|
|
138
|
+
*/
|
|
139
|
+
buildAuthUrl(params: {
|
|
140
|
+
mode: string;
|
|
141
|
+
redirectUri: string;
|
|
142
|
+
state: string;
|
|
143
|
+
nonce: string;
|
|
144
|
+
clientId: string;
|
|
145
|
+
}): string;
|
|
146
|
+
/**
|
|
147
|
+
* Store tokens in localStorage
|
|
148
|
+
*
|
|
149
|
+
* @private
|
|
150
|
+
*/
|
|
151
|
+
storeTokens(accessToken: string, sessionId: string): void;
|
|
152
|
+
/**
|
|
153
|
+
* Generate cryptographically secure state for CSRF protection
|
|
154
|
+
*
|
|
155
|
+
* @private
|
|
156
|
+
*/
|
|
157
|
+
generateState(): string;
|
|
158
|
+
/**
|
|
159
|
+
* Generate nonce for replay attack prevention
|
|
160
|
+
*
|
|
161
|
+
* @private
|
|
162
|
+
*/
|
|
163
|
+
generateNonce(): string;
|
|
164
|
+
/**
|
|
165
|
+
* Store auth state in session storage
|
|
166
|
+
*
|
|
167
|
+
* @private
|
|
168
|
+
*/
|
|
169
|
+
storeAuthState(state: string, nonce: string): void;
|
|
170
|
+
/**
|
|
171
|
+
* Get stored state
|
|
172
|
+
*
|
|
173
|
+
* @private
|
|
174
|
+
*/
|
|
175
|
+
getStoredState(): string | null;
|
|
176
|
+
/**
|
|
177
|
+
* Clear auth state from storage
|
|
178
|
+
*
|
|
179
|
+
* @private
|
|
180
|
+
*/
|
|
181
|
+
clearAuthState(): void;
|
|
182
|
+
/**
|
|
183
|
+
* Save pre-authentication URL to restore later
|
|
184
|
+
*
|
|
185
|
+
* @private
|
|
186
|
+
*/
|
|
187
|
+
savePreAuthUrl(url: string): void;
|
|
188
|
+
/**
|
|
189
|
+
* Clean authentication parameters from URL
|
|
190
|
+
*
|
|
191
|
+
* @private
|
|
192
|
+
*/
|
|
193
|
+
cleanAuthCallbackUrl(url: URL): void;
|
|
194
|
+
httpService: import("../HttpService").HttpService;
|
|
195
|
+
cloudURL: string;
|
|
196
|
+
config: import("../OxyServices.base").OxyConfig;
|
|
197
|
+
makeRequest<T_1>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("../HttpService").RequestOptions): Promise<T_1>;
|
|
198
|
+
getBaseURL(): string;
|
|
199
|
+
getClient(): import("../HttpService").HttpService;
|
|
200
|
+
getMetrics(): {
|
|
201
|
+
totalRequests: number;
|
|
202
|
+
successfulRequests: number;
|
|
203
|
+
failedRequests: number;
|
|
204
|
+
cacheHits: number;
|
|
205
|
+
cacheMisses: number;
|
|
206
|
+
averageResponseTime: number;
|
|
207
|
+
};
|
|
208
|
+
clearCache(): void;
|
|
209
|
+
clearCacheEntry(key: string): void;
|
|
210
|
+
getCacheStats(): {
|
|
211
|
+
size: number;
|
|
212
|
+
hits: number;
|
|
213
|
+
misses: number;
|
|
214
|
+
hitRate: number;
|
|
215
|
+
};
|
|
216
|
+
getCloudURL(): string;
|
|
217
|
+
setTokens(accessToken: string, refreshToken?: string): void;
|
|
218
|
+
clearTokens(): void;
|
|
219
|
+
getCurrentUserId(): string | null;
|
|
220
|
+
hasValidToken(): boolean;
|
|
221
|
+
getAccessToken(): string | null;
|
|
222
|
+
waitForAuth(timeoutMs?: number): Promise<boolean>;
|
|
223
|
+
withAuthRetry<T_1>(operation: () => Promise<T_1>, operationName: string, options?: {
|
|
224
|
+
maxRetries?: number;
|
|
225
|
+
retryDelay?: number;
|
|
226
|
+
authTimeoutMs?: number;
|
|
227
|
+
}): Promise<T_1>;
|
|
228
|
+
validate(): Promise<boolean>;
|
|
229
|
+
handleError(error: unknown): Error;
|
|
230
|
+
healthCheck(): Promise<{
|
|
231
|
+
status: string;
|
|
232
|
+
users?: number;
|
|
233
|
+
timestamp?: string;
|
|
234
|
+
[key: string]: any;
|
|
235
|
+
}>;
|
|
236
|
+
};
|
|
237
|
+
readonly AUTH_URL: "https://auth.oxy.so";
|
|
238
|
+
readonly TOKEN_STORAGE_KEY: "oxy_access_token";
|
|
239
|
+
readonly SESSION_STORAGE_KEY: "oxy_session_id";
|
|
240
|
+
readonly STATE_STORAGE_KEY: "oxy_auth_state";
|
|
241
|
+
readonly PRE_AUTH_URL_KEY: "oxy_pre_auth_url";
|
|
242
|
+
readonly NONCE_STORAGE_KEY: "oxy_auth_nonce";
|
|
243
|
+
__resetTokensForTests(): void;
|
|
244
|
+
} & T;
|
|
245
|
+
export { OxyServicesRedirectAuthMixin as RedirectAuthMixin };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Security Methods Mixin
|
|
3
|
+
*/
|
|
4
|
+
import type { OxyServicesBase } from '../OxyServices.base';
|
|
5
|
+
import type { SecurityActivity, SecurityActivityResponse, SecurityEventType } from '../../models/interfaces';
|
|
6
|
+
export declare function OxyServicesSecurityMixin<T extends typeof OxyServicesBase>(Base: T): {
|
|
7
|
+
new (...args: any[]): {
|
|
8
|
+
/**
|
|
9
|
+
* Get user's security activity with pagination
|
|
10
|
+
* @param limit - Number of results (default: 50, max: 100)
|
|
11
|
+
* @param offset - Pagination offset (default: 0)
|
|
12
|
+
* @param eventType - Optional filter by event type
|
|
13
|
+
* @returns Security activity response with pagination
|
|
14
|
+
*/
|
|
15
|
+
getSecurityActivity(limit?: number, offset?: number, eventType?: SecurityEventType): Promise<SecurityActivityResponse>;
|
|
16
|
+
/**
|
|
17
|
+
* Get recent security activity (convenience method)
|
|
18
|
+
* @param limit - Number of recent events to fetch (default: 10)
|
|
19
|
+
* @returns Array of recent security activities
|
|
20
|
+
*/
|
|
21
|
+
getRecentSecurityActivity(limit?: number): Promise<SecurityActivity[]>;
|
|
22
|
+
/**
|
|
23
|
+
* Log private key exported event
|
|
24
|
+
* @param deviceId - Optional device ID for tracking
|
|
25
|
+
* @returns Promise that resolves when event is logged
|
|
26
|
+
*/
|
|
27
|
+
logPrivateKeyExported(deviceId?: string): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Log backup created event
|
|
30
|
+
* @param deviceId - Optional device ID for tracking
|
|
31
|
+
* @returns Promise that resolves when event is logged
|
|
32
|
+
*/
|
|
33
|
+
logBackupCreated(deviceId?: string): Promise<void>;
|
|
34
|
+
httpService: import("../HttpService").HttpService;
|
|
35
|
+
cloudURL: string;
|
|
36
|
+
config: import("../OxyServices.base").OxyConfig;
|
|
37
|
+
makeRequest<T_1>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("../HttpService").RequestOptions): Promise<T_1>;
|
|
38
|
+
getBaseURL(): string;
|
|
39
|
+
getClient(): import("../HttpService").HttpService;
|
|
40
|
+
getMetrics(): {
|
|
41
|
+
totalRequests: number;
|
|
42
|
+
successfulRequests: number;
|
|
43
|
+
failedRequests: number;
|
|
44
|
+
cacheHits: number;
|
|
45
|
+
cacheMisses: number;
|
|
46
|
+
averageResponseTime: number;
|
|
47
|
+
};
|
|
48
|
+
clearCache(): void;
|
|
49
|
+
clearCacheEntry(key: string): void;
|
|
50
|
+
getCacheStats(): {
|
|
51
|
+
size: number;
|
|
52
|
+
hits: number;
|
|
53
|
+
misses: number;
|
|
54
|
+
hitRate: number;
|
|
55
|
+
};
|
|
56
|
+
getCloudURL(): string;
|
|
57
|
+
setTokens(accessToken: string, refreshToken?: string): void;
|
|
58
|
+
clearTokens(): void;
|
|
59
|
+
getCurrentUserId(): string | null;
|
|
60
|
+
hasValidToken(): boolean;
|
|
61
|
+
getAccessToken(): string | null;
|
|
62
|
+
waitForAuth(timeoutMs?: number): Promise<boolean>;
|
|
63
|
+
withAuthRetry<T_1>(operation: () => Promise<T_1>, operationName: string, options?: {
|
|
64
|
+
maxRetries?: number;
|
|
65
|
+
retryDelay?: number;
|
|
66
|
+
authTimeoutMs?: number;
|
|
67
|
+
}): Promise<T_1>;
|
|
68
|
+
validate(): Promise<boolean>;
|
|
69
|
+
handleError(error: unknown): Error;
|
|
70
|
+
healthCheck(): Promise<{
|
|
71
|
+
status: string;
|
|
72
|
+
users?: number;
|
|
73
|
+
timestamp?: string;
|
|
74
|
+
[key: string]: any;
|
|
75
|
+
}>;
|
|
76
|
+
};
|
|
77
|
+
__resetTokensForTests(): void;
|
|
78
|
+
} & T;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* User Management Methods Mixin
|
|
3
|
+
*/
|
|
4
|
+
import type { User, Notification, SearchProfilesResponse } from '../../models/interfaces';
|
|
5
|
+
import type { OxyServicesBase } from '../OxyServices.base';
|
|
6
|
+
import { type PaginationParams } from '../../utils/apiUtils';
|
|
7
|
+
export declare function OxyServicesUserMixin<T extends typeof OxyServicesBase>(Base: T): {
|
|
8
|
+
new (...args: any[]): {
|
|
9
|
+
/**
|
|
10
|
+
* Get profile by username
|
|
11
|
+
*/
|
|
12
|
+
getProfileByUsername(username: string): Promise<User>;
|
|
13
|
+
/**
|
|
14
|
+
* Search user profiles
|
|
15
|
+
*/
|
|
16
|
+
searchProfiles(query: string, pagination?: PaginationParams): Promise<SearchProfilesResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* Get profile recommendations
|
|
19
|
+
*/
|
|
20
|
+
getProfileRecommendations(): Promise<Array<{
|
|
21
|
+
id: string;
|
|
22
|
+
username: string;
|
|
23
|
+
name?: {
|
|
24
|
+
first?: string;
|
|
25
|
+
last?: string;
|
|
26
|
+
full?: string;
|
|
27
|
+
};
|
|
28
|
+
description?: string;
|
|
29
|
+
_count?: {
|
|
30
|
+
followers: number;
|
|
31
|
+
following: number;
|
|
32
|
+
};
|
|
33
|
+
[key: string]: any;
|
|
34
|
+
}>>;
|
|
35
|
+
/**
|
|
36
|
+
* Get user by ID
|
|
37
|
+
*/
|
|
38
|
+
getUserById(userId: string): Promise<User>;
|
|
39
|
+
/**
|
|
40
|
+
* Get current user
|
|
41
|
+
*/
|
|
42
|
+
getCurrentUser(): Promise<User>;
|
|
43
|
+
/**
|
|
44
|
+
* Update user profile
|
|
45
|
+
* TanStack Query handles offline queuing automatically
|
|
46
|
+
*/
|
|
47
|
+
updateProfile(updates: Record<string, any>): Promise<User>;
|
|
48
|
+
/**
|
|
49
|
+
* Get privacy settings for a user
|
|
50
|
+
* @param userId - The user ID (defaults to current user)
|
|
51
|
+
*/
|
|
52
|
+
getPrivacySettings(userId?: string): Promise<any>;
|
|
53
|
+
/**
|
|
54
|
+
* Update privacy settings
|
|
55
|
+
* @param settings - Partial privacy settings object
|
|
56
|
+
* @param userId - The user ID (defaults to current user)
|
|
57
|
+
*/
|
|
58
|
+
updatePrivacySettings(settings: Record<string, any>, userId?: string): Promise<any>;
|
|
59
|
+
/**
|
|
60
|
+
* Request account verification
|
|
61
|
+
*/
|
|
62
|
+
requestAccountVerification(reason: string, evidence?: string): Promise<{
|
|
63
|
+
message: string;
|
|
64
|
+
requestId: string;
|
|
65
|
+
}>;
|
|
66
|
+
/**
|
|
67
|
+
* Download account data export
|
|
68
|
+
*/
|
|
69
|
+
downloadAccountData(format?: "json" | "csv"): Promise<Blob>;
|
|
70
|
+
/**
|
|
71
|
+
* Delete account permanently
|
|
72
|
+
* @param password - User password for confirmation
|
|
73
|
+
* @param confirmText - Confirmation text (usually username)
|
|
74
|
+
*/
|
|
75
|
+
deleteAccount(password: string, confirmText: string): Promise<{
|
|
76
|
+
message: string;
|
|
77
|
+
}>;
|
|
78
|
+
/**
|
|
79
|
+
* Follow a user
|
|
80
|
+
*/
|
|
81
|
+
followUser(userId: string): Promise<{
|
|
82
|
+
success: boolean;
|
|
83
|
+
message: string;
|
|
84
|
+
}>;
|
|
85
|
+
/**
|
|
86
|
+
* Unfollow a user
|
|
87
|
+
*/
|
|
88
|
+
unfollowUser(userId: string): Promise<{
|
|
89
|
+
success: boolean;
|
|
90
|
+
message: string;
|
|
91
|
+
}>;
|
|
92
|
+
/**
|
|
93
|
+
* Get follow status
|
|
94
|
+
*/
|
|
95
|
+
getFollowStatus(userId: string): Promise<{
|
|
96
|
+
isFollowing: boolean;
|
|
97
|
+
}>;
|
|
98
|
+
/**
|
|
99
|
+
* Get user followers
|
|
100
|
+
*/
|
|
101
|
+
getUserFollowers(userId: string, pagination?: PaginationParams): Promise<{
|
|
102
|
+
followers: User[];
|
|
103
|
+
total: number;
|
|
104
|
+
hasMore: boolean;
|
|
105
|
+
}>;
|
|
106
|
+
/**
|
|
107
|
+
* Get user following
|
|
108
|
+
*/
|
|
109
|
+
getUserFollowing(userId: string, pagination?: PaginationParams): Promise<{
|
|
110
|
+
following: User[];
|
|
111
|
+
total: number;
|
|
112
|
+
hasMore: boolean;
|
|
113
|
+
}>;
|
|
114
|
+
/**
|
|
115
|
+
* Get notifications
|
|
116
|
+
*/
|
|
117
|
+
getNotifications(): Promise<Notification[]>;
|
|
118
|
+
/**
|
|
119
|
+
* Get unread notification count
|
|
120
|
+
*/
|
|
121
|
+
getUnreadCount(): Promise<number>;
|
|
122
|
+
/**
|
|
123
|
+
* Create notification
|
|
124
|
+
*/
|
|
125
|
+
createNotification(data: Partial<Notification>): Promise<Notification>;
|
|
126
|
+
/**
|
|
127
|
+
* Mark notification as read
|
|
128
|
+
*/
|
|
129
|
+
markNotificationAsRead(notificationId: string): Promise<void>;
|
|
130
|
+
/**
|
|
131
|
+
* Mark all notifications as read
|
|
132
|
+
*/
|
|
133
|
+
markAllNotificationsAsRead(): Promise<void>;
|
|
134
|
+
/**
|
|
135
|
+
* Delete notification
|
|
136
|
+
*/
|
|
137
|
+
deleteNotification(notificationId: string): Promise<void>;
|
|
138
|
+
httpService: import("../HttpService").HttpService;
|
|
139
|
+
cloudURL: string;
|
|
140
|
+
config: import("../OxyServices.base").OxyConfig;
|
|
141
|
+
makeRequest<T_1>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("../HttpService").RequestOptions): Promise<T_1>;
|
|
142
|
+
getBaseURL(): string;
|
|
143
|
+
getClient(): import("../HttpService").HttpService;
|
|
144
|
+
getMetrics(): {
|
|
145
|
+
totalRequests: number;
|
|
146
|
+
successfulRequests: number;
|
|
147
|
+
failedRequests: number;
|
|
148
|
+
cacheHits: number;
|
|
149
|
+
cacheMisses: number;
|
|
150
|
+
averageResponseTime: number;
|
|
151
|
+
};
|
|
152
|
+
clearCache(): void;
|
|
153
|
+
clearCacheEntry(key: string): void;
|
|
154
|
+
getCacheStats(): {
|
|
155
|
+
size: number;
|
|
156
|
+
hits: number;
|
|
157
|
+
misses: number;
|
|
158
|
+
hitRate: number;
|
|
159
|
+
};
|
|
160
|
+
getCloudURL(): string;
|
|
161
|
+
setTokens(accessToken: string, refreshToken?: string): void;
|
|
162
|
+
clearTokens(): void;
|
|
163
|
+
getCurrentUserId(): string | null;
|
|
164
|
+
hasValidToken(): boolean;
|
|
165
|
+
getAccessToken(): string | null;
|
|
166
|
+
waitForAuth(timeoutMs?: number): Promise<boolean>;
|
|
167
|
+
withAuthRetry<T_1>(operation: () => Promise<T_1>, operationName: string, options?: {
|
|
168
|
+
maxRetries?: number;
|
|
169
|
+
retryDelay?: number;
|
|
170
|
+
authTimeoutMs?: number;
|
|
171
|
+
}): Promise<T_1>;
|
|
172
|
+
validate(): Promise<boolean>;
|
|
173
|
+
handleError(error: unknown): Error;
|
|
174
|
+
healthCheck(): Promise<{
|
|
175
|
+
status: string;
|
|
176
|
+
users?: number;
|
|
177
|
+
timestamp? /**
|
|
178
|
+
* Get user followers
|
|
179
|
+
*/: string;
|
|
180
|
+
[key: string]: any;
|
|
181
|
+
}>;
|
|
182
|
+
};
|
|
183
|
+
__resetTokensForTests(): void;
|
|
184
|
+
} & T;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { ApiError } from '../../models/interfaces';
|
|
2
|
+
import type { OxyServicesBase } from '../OxyServices.base';
|
|
3
|
+
export declare function OxyServicesUtilityMixin<T extends typeof OxyServicesBase>(Base: T): {
|
|
4
|
+
new (...args: any[]): {
|
|
5
|
+
/**
|
|
6
|
+
* Fetch link metadata
|
|
7
|
+
*/
|
|
8
|
+
fetchLinkMetadata(url: string): Promise<{
|
|
9
|
+
url: string;
|
|
10
|
+
title: string;
|
|
11
|
+
description: string;
|
|
12
|
+
image?: string;
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* Simple Express.js authentication middleware
|
|
16
|
+
*
|
|
17
|
+
* Built-in authentication middleware that validates JWT tokens and adds user data to requests.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* // Basic usage - just add it to your routes
|
|
22
|
+
* app.use('/api/protected', oxyServices.auth());
|
|
23
|
+
*
|
|
24
|
+
* // With debug logging
|
|
25
|
+
* app.use('/api/protected', oxyServices.auth({ debug: true }));
|
|
26
|
+
*
|
|
27
|
+
* // With custom error handling
|
|
28
|
+
* app.use('/api/protected', oxyServices.auth({
|
|
29
|
+
* onError: (error) => console.error('Auth failed:', error)
|
|
30
|
+
* }));
|
|
31
|
+
*
|
|
32
|
+
* // Load full user data
|
|
33
|
+
* app.use('/api/protected', oxyServices.auth({ loadUser: true }));
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @param options Optional configuration
|
|
37
|
+
* @param options.debug Enable debug logging (default: false)
|
|
38
|
+
* @param options.onError Custom error handler
|
|
39
|
+
* @param options.loadUser Load full user data (default: false for performance)
|
|
40
|
+
* @param options.session Use session-based validation (default: false)
|
|
41
|
+
* @returns Express middleware function
|
|
42
|
+
*/
|
|
43
|
+
auth(options?: {
|
|
44
|
+
debug?: boolean;
|
|
45
|
+
onError?: (error: ApiError) => any;
|
|
46
|
+
loadUser?: boolean;
|
|
47
|
+
session?: boolean;
|
|
48
|
+
}): (req: any, res: any, next: any) => any;
|
|
49
|
+
httpService: import("../HttpService").HttpService;
|
|
50
|
+
cloudURL: string;
|
|
51
|
+
config: import("../OxyServices.base").OxyConfig;
|
|
52
|
+
makeRequest<T_1>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("../HttpService").RequestOptions): Promise<T_1>;
|
|
53
|
+
getBaseURL(): string;
|
|
54
|
+
getClient(): import("../HttpService").HttpService;
|
|
55
|
+
getMetrics(): {
|
|
56
|
+
totalRequests: number;
|
|
57
|
+
successfulRequests: number;
|
|
58
|
+
failedRequests: number;
|
|
59
|
+
cacheHits: number;
|
|
60
|
+
cacheMisses: number;
|
|
61
|
+
averageResponseTime: number;
|
|
62
|
+
};
|
|
63
|
+
clearCache(): void;
|
|
64
|
+
clearCacheEntry(key: string): void;
|
|
65
|
+
getCacheStats(): {
|
|
66
|
+
size: number;
|
|
67
|
+
hits: number;
|
|
68
|
+
misses: number;
|
|
69
|
+
hitRate: number;
|
|
70
|
+
};
|
|
71
|
+
getCloudURL(): string;
|
|
72
|
+
setTokens(accessToken: string, refreshToken?: string): void;
|
|
73
|
+
clearTokens(): void;
|
|
74
|
+
getCurrentUserId(): string | null;
|
|
75
|
+
hasValidToken(): boolean;
|
|
76
|
+
getAccessToken(): string | null;
|
|
77
|
+
waitForAuth(timeoutMs?: number): Promise<boolean>;
|
|
78
|
+
withAuthRetry<T_1>(operation: () => Promise<T_1>, operationName: string, options?: {
|
|
79
|
+
maxRetries?: number;
|
|
80
|
+
retryDelay?: number;
|
|
81
|
+
authTimeoutMs?: number;
|
|
82
|
+
}): Promise<T_1>;
|
|
83
|
+
validate(): Promise<boolean>;
|
|
84
|
+
handleError(error: unknown): Error;
|
|
85
|
+
healthCheck(): Promise<{
|
|
86
|
+
status: string;
|
|
87
|
+
users?: number;
|
|
88
|
+
timestamp?: string;
|
|
89
|
+
[key: string]: any;
|
|
90
|
+
}>;
|
|
91
|
+
};
|
|
92
|
+
__resetTokensForTests(): void;
|
|
93
|
+
} & T;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized mixin exports and composition helper
|
|
3
|
+
*
|
|
4
|
+
* This module provides a clean way to compose all mixins
|
|
5
|
+
* and ensures consistent ordering for better maintainability
|
|
6
|
+
*/
|
|
7
|
+
type MixinFunction = (Base: any) => any;
|
|
8
|
+
/**
|
|
9
|
+
* Mixin pipeline - applied in order from first to last.
|
|
10
|
+
*
|
|
11
|
+
* Order matters for dependencies:
|
|
12
|
+
* 1. Base auth mixin first (required by all others)
|
|
13
|
+
* 2. Cross-domain auth mixins (FedCM, Popup, Redirect)
|
|
14
|
+
* 3. User mixin (requires auth)
|
|
15
|
+
* 4. Feature mixins (can depend on user)
|
|
16
|
+
* 5. Utility mixin last (augments all)
|
|
17
|
+
*
|
|
18
|
+
* To add a new mixin: insert it at the appropriate position in this array.
|
|
19
|
+
*/
|
|
20
|
+
declare const MIXIN_PIPELINE: MixinFunction[];
|
|
21
|
+
/**
|
|
22
|
+
* Composes all OxyServices mixins using a pipeline pattern.
|
|
23
|
+
*
|
|
24
|
+
* This is equivalent to the nested calls but more readable and maintainable.
|
|
25
|
+
* Adding a new mixin: just add it to MIXIN_PIPELINE at the appropriate position.
|
|
26
|
+
*
|
|
27
|
+
* @returns The fully composed OxyServices class with all mixins applied
|
|
28
|
+
*/
|
|
29
|
+
export declare function composeOxyServices(): any;
|
|
30
|
+
export { MIXIN_PIPELINE };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper utilities for mixin classes
|
|
3
|
+
* Provides common patterns to reduce code duplication
|
|
4
|
+
*/
|
|
5
|
+
import type { OxyServicesBase } from '../OxyServices.base';
|
|
6
|
+
/**
|
|
7
|
+
* Wraps an async method with standard error handling
|
|
8
|
+
* Reduces boilerplate in mixin methods
|
|
9
|
+
*/
|
|
10
|
+
export declare function withErrorHandling<T>(operation: () => Promise<T>, handleError: (error: any) => Error): Promise<T>;
|
|
11
|
+
/**
|
|
12
|
+
* Creates a standard API request method with error handling
|
|
13
|
+
* Reduces duplication across mixin methods
|
|
14
|
+
*/
|
|
15
|
+
export declare function createApiMethod<T>(makeRequest: OxyServicesBase['makeRequest'], handleError: OxyServicesBase['handleError'], method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE', url: string | ((...args: any[]) => string), options?: {
|
|
16
|
+
cache?: boolean;
|
|
17
|
+
cacheTTL?: number;
|
|
18
|
+
retry?: boolean;
|
|
19
|
+
transformData?: (data: any) => any;
|
|
20
|
+
transformResponse?: (response: any) => T;
|
|
21
|
+
}): (...args: any[]) => Promise<T>;
|
|
22
|
+
/**
|
|
23
|
+
* Cache time constants (in milliseconds)
|
|
24
|
+
*/
|
|
25
|
+
export declare const CACHE_TIMES: {
|
|
26
|
+
readonly SHORT: number;
|
|
27
|
+
readonly MEDIUM: number;
|
|
28
|
+
readonly LONG: number;
|
|
29
|
+
readonly VERY_LONG: number;
|
|
30
|
+
readonly EXTRA_LONG: number;
|
|
31
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Oxy Crypto Module
|
|
3
|
+
*
|
|
4
|
+
* Provides cryptographic identity management for the Oxy ecosystem.
|
|
5
|
+
* Handles key generation, secure storage, digital signatures, and recovery phrases.
|
|
6
|
+
*/
|
|
7
|
+
import './polyfill';
|
|
8
|
+
export { KeyManager, type KeyPair } from './keyManager';
|
|
9
|
+
export { SignatureService, type SignedMessage, type AuthChallenge } from './signatureService';
|
|
10
|
+
export { RecoveryPhraseService, type RecoveryPhraseResult } from './recoveryPhrase';
|
|
11
|
+
export { KeyManager as default } from './keyManager';
|