@oxyhq/core 1.0.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 +50 -0
- package/dist/cjs/AuthManager.js +361 -0
- package/dist/cjs/CrossDomainAuth.js +258 -0
- package/dist/cjs/HttpService.js +618 -0
- package/dist/cjs/OxyServices.base.js +263 -0
- package/dist/cjs/OxyServices.errors.js +22 -0
- package/dist/cjs/OxyServices.js +63 -0
- package/dist/cjs/constants/version.js +16 -0
- package/dist/cjs/crypto/index.js +20 -0
- package/dist/cjs/crypto/keyManager.js +887 -0
- package/dist/cjs/crypto/polyfill.js +64 -0
- package/dist/cjs/crypto/recoveryPhrase.js +169 -0
- package/dist/cjs/crypto/signatureService.js +296 -0
- package/dist/cjs/i18n/index.js +73 -0
- package/dist/cjs/i18n/locales/ar-SA.json +120 -0
- package/dist/cjs/i18n/locales/ca-ES.json +120 -0
- package/dist/cjs/i18n/locales/de-DE.json +120 -0
- package/dist/cjs/i18n/locales/en-US.json +956 -0
- package/dist/cjs/i18n/locales/es-ES.json +944 -0
- package/dist/cjs/i18n/locales/fr-FR.json +120 -0
- package/dist/cjs/i18n/locales/it-IT.json +120 -0
- package/dist/cjs/i18n/locales/ja-JP.json +119 -0
- package/dist/cjs/i18n/locales/ko-KR.json +120 -0
- package/dist/cjs/i18n/locales/locales/ar-SA.json +120 -0
- package/dist/cjs/i18n/locales/locales/ca-ES.json +120 -0
- package/dist/cjs/i18n/locales/locales/de-DE.json +120 -0
- package/dist/cjs/i18n/locales/locales/en-US.json +956 -0
- package/dist/cjs/i18n/locales/locales/es-ES.json +944 -0
- package/dist/cjs/i18n/locales/locales/fr-FR.json +120 -0
- package/dist/cjs/i18n/locales/locales/it-IT.json +120 -0
- package/dist/cjs/i18n/locales/locales/ja-JP.json +119 -0
- package/dist/cjs/i18n/locales/locales/ko-KR.json +120 -0
- package/dist/cjs/i18n/locales/locales/pt-PT.json +120 -0
- package/dist/cjs/i18n/locales/locales/zh-CN.json +120 -0
- package/dist/cjs/i18n/locales/pt-PT.json +120 -0
- package/dist/cjs/i18n/locales/zh-CN.json +120 -0
- package/dist/cjs/index.js +153 -0
- package/dist/cjs/mixins/OxyServices.analytics.js +49 -0
- package/dist/cjs/mixins/OxyServices.assets.js +380 -0
- package/dist/cjs/mixins/OxyServices.auth.js +259 -0
- package/dist/cjs/mixins/OxyServices.developer.js +97 -0
- package/dist/cjs/mixins/OxyServices.devices.js +116 -0
- package/dist/cjs/mixins/OxyServices.features.js +309 -0
- package/dist/cjs/mixins/OxyServices.fedcm.js +435 -0
- package/dist/cjs/mixins/OxyServices.karma.js +108 -0
- package/dist/cjs/mixins/OxyServices.language.js +154 -0
- package/dist/cjs/mixins/OxyServices.location.js +43 -0
- package/dist/cjs/mixins/OxyServices.payment.js +158 -0
- package/dist/cjs/mixins/OxyServices.popup.js +371 -0
- package/dist/cjs/mixins/OxyServices.privacy.js +162 -0
- package/dist/cjs/mixins/OxyServices.redirect.js +345 -0
- package/dist/cjs/mixins/OxyServices.security.js +81 -0
- package/dist/cjs/mixins/OxyServices.user.js +355 -0
- package/dist/cjs/mixins/OxyServices.utility.js +156 -0
- package/dist/cjs/mixins/index.js +79 -0
- package/dist/cjs/mixins/mixinHelpers.js +53 -0
- package/dist/cjs/models/interfaces.js +20 -0
- package/dist/cjs/models/session.js +2 -0
- package/dist/cjs/shared/index.js +70 -0
- package/dist/cjs/shared/utils/colorUtils.js +153 -0
- package/dist/cjs/shared/utils/debugUtils.js +73 -0
- package/dist/cjs/shared/utils/errorUtils.js +183 -0
- package/dist/cjs/shared/utils/index.js +49 -0
- package/dist/cjs/shared/utils/networkUtils.js +183 -0
- package/dist/cjs/shared/utils/themeUtils.js +106 -0
- package/dist/cjs/utils/apiUtils.js +61 -0
- package/dist/cjs/utils/asyncUtils.js +194 -0
- package/dist/cjs/utils/cache.js +226 -0
- package/dist/cjs/utils/deviceManager.js +205 -0
- package/dist/cjs/utils/errorUtils.js +154 -0
- package/dist/cjs/utils/index.js +26 -0
- package/dist/cjs/utils/languageUtils.js +165 -0
- package/dist/cjs/utils/loggerUtils.js +126 -0
- package/dist/cjs/utils/platform.js +144 -0
- package/dist/cjs/utils/requestUtils.js +209 -0
- package/dist/cjs/utils/sessionUtils.js +181 -0
- package/dist/cjs/utils/validationUtils.js +173 -0
- package/dist/esm/AuthManager.js +356 -0
- package/dist/esm/CrossDomainAuth.js +253 -0
- package/dist/esm/HttpService.js +614 -0
- package/dist/esm/OxyServices.base.js +259 -0
- package/dist/esm/OxyServices.errors.js +17 -0
- package/dist/esm/OxyServices.js +59 -0
- package/dist/esm/constants/version.js +13 -0
- package/dist/esm/crypto/index.js +13 -0
- package/dist/esm/crypto/keyManager.js +850 -0
- package/dist/esm/crypto/polyfill.js +61 -0
- package/dist/esm/crypto/recoveryPhrase.js +132 -0
- package/dist/esm/crypto/signatureService.js +259 -0
- package/dist/esm/i18n/index.js +69 -0
- package/dist/esm/i18n/locales/ar-SA.json +120 -0
- package/dist/esm/i18n/locales/ca-ES.json +120 -0
- package/dist/esm/i18n/locales/de-DE.json +120 -0
- package/dist/esm/i18n/locales/en-US.json +956 -0
- package/dist/esm/i18n/locales/es-ES.json +944 -0
- package/dist/esm/i18n/locales/fr-FR.json +120 -0
- package/dist/esm/i18n/locales/it-IT.json +120 -0
- package/dist/esm/i18n/locales/ja-JP.json +119 -0
- package/dist/esm/i18n/locales/ko-KR.json +120 -0
- package/dist/esm/i18n/locales/locales/ar-SA.json +120 -0
- package/dist/esm/i18n/locales/locales/ca-ES.json +120 -0
- package/dist/esm/i18n/locales/locales/de-DE.json +120 -0
- package/dist/esm/i18n/locales/locales/en-US.json +956 -0
- package/dist/esm/i18n/locales/locales/es-ES.json +944 -0
- package/dist/esm/i18n/locales/locales/fr-FR.json +120 -0
- package/dist/esm/i18n/locales/locales/it-IT.json +120 -0
- package/dist/esm/i18n/locales/locales/ja-JP.json +119 -0
- package/dist/esm/i18n/locales/locales/ko-KR.json +120 -0
- package/dist/esm/i18n/locales/locales/pt-PT.json +120 -0
- package/dist/esm/i18n/locales/locales/zh-CN.json +120 -0
- package/dist/esm/i18n/locales/pt-PT.json +120 -0
- package/dist/esm/i18n/locales/zh-CN.json +120 -0
- package/dist/esm/index.js +55 -0
- package/dist/esm/mixins/OxyServices.analytics.js +46 -0
- package/dist/esm/mixins/OxyServices.assets.js +377 -0
- package/dist/esm/mixins/OxyServices.auth.js +256 -0
- package/dist/esm/mixins/OxyServices.developer.js +94 -0
- package/dist/esm/mixins/OxyServices.devices.js +113 -0
- package/dist/esm/mixins/OxyServices.features.js +306 -0
- package/dist/esm/mixins/OxyServices.fedcm.js +433 -0
- package/dist/esm/mixins/OxyServices.karma.js +105 -0
- package/dist/esm/mixins/OxyServices.language.js +118 -0
- package/dist/esm/mixins/OxyServices.location.js +40 -0
- package/dist/esm/mixins/OxyServices.payment.js +155 -0
- package/dist/esm/mixins/OxyServices.popup.js +369 -0
- package/dist/esm/mixins/OxyServices.privacy.js +159 -0
- package/dist/esm/mixins/OxyServices.redirect.js +343 -0
- package/dist/esm/mixins/OxyServices.security.js +78 -0
- package/dist/esm/mixins/OxyServices.user.js +352 -0
- package/dist/esm/mixins/OxyServices.utility.js +153 -0
- package/dist/esm/mixins/index.js +76 -0
- package/dist/esm/mixins/mixinHelpers.js +48 -0
- package/dist/esm/models/interfaces.js +17 -0
- package/dist/esm/models/session.js +1 -0
- package/dist/esm/shared/index.js +31 -0
- package/dist/esm/shared/utils/colorUtils.js +143 -0
- package/dist/esm/shared/utils/debugUtils.js +65 -0
- package/dist/esm/shared/utils/errorUtils.js +170 -0
- package/dist/esm/shared/utils/index.js +15 -0
- package/dist/esm/shared/utils/networkUtils.js +173 -0
- package/dist/esm/shared/utils/themeUtils.js +98 -0
- package/dist/esm/utils/apiUtils.js +55 -0
- package/dist/esm/utils/asyncUtils.js +179 -0
- package/dist/esm/utils/cache.js +218 -0
- package/dist/esm/utils/deviceManager.js +168 -0
- package/dist/esm/utils/errorUtils.js +146 -0
- package/dist/esm/utils/index.js +7 -0
- package/dist/esm/utils/languageUtils.js +158 -0
- package/dist/esm/utils/loggerUtils.js +115 -0
- package/dist/esm/utils/platform.js +102 -0
- package/dist/esm/utils/requestUtils.js +203 -0
- package/dist/esm/utils/sessionUtils.js +171 -0
- package/dist/esm/utils/validationUtils.js +153 -0
- package/dist/types/AuthManager.d.ts +143 -0
- package/dist/types/CrossDomainAuth.d.ts +160 -0
- package/dist/types/HttpService.d.ts +163 -0
- package/dist/types/OxyServices.base.d.ts +126 -0
- package/dist/types/OxyServices.d.ts +81 -0
- package/dist/types/OxyServices.errors.d.ts +11 -0
- package/dist/types/constants/version.d.ts +13 -0
- package/dist/types/crypto/index.d.ts +11 -0
- package/dist/types/crypto/keyManager.d.ts +189 -0
- package/dist/types/crypto/polyfill.d.ts +11 -0
- package/dist/types/crypto/recoveryPhrase.d.ts +58 -0
- package/dist/types/crypto/signatureService.d.ts +86 -0
- package/dist/types/i18n/index.d.ts +3 -0
- package/dist/types/index.d.ts +50 -0
- package/dist/types/mixins/OxyServices.analytics.d.ts +66 -0
- package/dist/types/mixins/OxyServices.assets.d.ts +135 -0
- package/dist/types/mixins/OxyServices.auth.d.ts +186 -0
- package/dist/types/mixins/OxyServices.developer.d.ts +99 -0
- package/dist/types/mixins/OxyServices.devices.d.ts +96 -0
- package/dist/types/mixins/OxyServices.features.d.ts +228 -0
- package/dist/types/mixins/OxyServices.fedcm.d.ts +200 -0
- package/dist/types/mixins/OxyServices.karma.d.ts +85 -0
- package/dist/types/mixins/OxyServices.language.d.ts +81 -0
- package/dist/types/mixins/OxyServices.location.d.ts +64 -0
- package/dist/types/mixins/OxyServices.payment.d.ts +111 -0
- package/dist/types/mixins/OxyServices.popup.d.ts +205 -0
- package/dist/types/mixins/OxyServices.privacy.d.ts +122 -0
- package/dist/types/mixins/OxyServices.redirect.d.ts +245 -0
- package/dist/types/mixins/OxyServices.security.d.ts +78 -0
- package/dist/types/mixins/OxyServices.user.d.ts +182 -0
- package/dist/types/mixins/OxyServices.utility.d.ts +93 -0
- package/dist/types/mixins/index.d.ts +30 -0
- package/dist/types/mixins/mixinHelpers.d.ts +31 -0
- package/dist/types/models/interfaces.d.ts +415 -0
- package/dist/types/models/session.d.ts +27 -0
- package/dist/types/shared/index.d.ts +28 -0
- package/dist/types/shared/utils/colorUtils.d.ts +104 -0
- package/dist/types/shared/utils/debugUtils.d.ts +48 -0
- package/dist/types/shared/utils/errorUtils.d.ts +97 -0
- package/dist/types/shared/utils/index.d.ts +13 -0
- package/dist/types/shared/utils/networkUtils.d.ts +139 -0
- package/dist/types/shared/utils/themeUtils.d.ts +90 -0
- package/dist/types/utils/apiUtils.d.ts +53 -0
- package/dist/types/utils/asyncUtils.d.ts +58 -0
- package/dist/types/utils/cache.d.ts +127 -0
- package/dist/types/utils/deviceManager.d.ts +65 -0
- package/dist/types/utils/errorUtils.d.ts +46 -0
- package/dist/types/utils/index.d.ts +6 -0
- package/dist/types/utils/languageUtils.d.ts +37 -0
- package/dist/types/utils/loggerUtils.d.ts +48 -0
- package/dist/types/utils/platform.d.ts +40 -0
- package/dist/types/utils/requestUtils.d.ts +123 -0
- package/dist/types/utils/sessionUtils.d.ts +54 -0
- package/dist/types/utils/validationUtils.d.ts +85 -0
- package/package.json +84 -0
- package/src/AuthManager.ts +436 -0
- package/src/CrossDomainAuth.ts +307 -0
- package/src/HttpService.ts +752 -0
- package/src/OxyServices.base.ts +334 -0
- package/src/OxyServices.errors.ts +26 -0
- package/src/OxyServices.ts +129 -0
- package/src/constants/version.ts +15 -0
- package/src/crypto/index.ts +25 -0
- package/src/crypto/keyManager.ts +962 -0
- package/src/crypto/polyfill.ts +70 -0
- package/src/crypto/recoveryPhrase.ts +166 -0
- package/src/crypto/signatureService.ts +323 -0
- package/src/i18n/index.ts +75 -0
- package/src/i18n/locales/ar-SA.json +120 -0
- package/src/i18n/locales/ca-ES.json +120 -0
- package/src/i18n/locales/de-DE.json +120 -0
- package/src/i18n/locales/en-US.json +956 -0
- package/src/i18n/locales/es-ES.json +944 -0
- package/src/i18n/locales/fr-FR.json +120 -0
- package/src/i18n/locales/it-IT.json +120 -0
- package/src/i18n/locales/ja-JP.json +119 -0
- package/src/i18n/locales/ko-KR.json +120 -0
- package/src/i18n/locales/pt-PT.json +120 -0
- package/src/i18n/locales/zh-CN.json +120 -0
- package/src/index.ts +153 -0
- package/src/mixins/OxyServices.analytics.ts +53 -0
- package/src/mixins/OxyServices.assets.ts +412 -0
- package/src/mixins/OxyServices.auth.ts +358 -0
- package/src/mixins/OxyServices.developer.ts +114 -0
- package/src/mixins/OxyServices.devices.ts +119 -0
- package/src/mixins/OxyServices.features.ts +428 -0
- package/src/mixins/OxyServices.fedcm.ts +494 -0
- package/src/mixins/OxyServices.karma.ts +111 -0
- package/src/mixins/OxyServices.language.ts +127 -0
- package/src/mixins/OxyServices.location.ts +46 -0
- package/src/mixins/OxyServices.payment.ts +163 -0
- package/src/mixins/OxyServices.popup.ts +443 -0
- package/src/mixins/OxyServices.privacy.ts +182 -0
- package/src/mixins/OxyServices.redirect.ts +397 -0
- package/src/mixins/OxyServices.security.ts +103 -0
- package/src/mixins/OxyServices.user.ts +392 -0
- package/src/mixins/OxyServices.utility.ts +191 -0
- package/src/mixins/index.ts +91 -0
- package/src/mixins/mixinHelpers.ts +69 -0
- package/src/models/interfaces.ts +511 -0
- package/src/models/session.ts +30 -0
- package/src/shared/index.ts +82 -0
- package/src/shared/utils/colorUtils.ts +155 -0
- package/src/shared/utils/debugUtils.ts +73 -0
- package/src/shared/utils/errorUtils.ts +181 -0
- package/src/shared/utils/index.ts +59 -0
- package/src/shared/utils/networkUtils.ts +248 -0
- package/src/shared/utils/themeUtils.ts +115 -0
- package/src/types/bip39.d.ts +32 -0
- package/src/types/buffer.d.ts +97 -0
- package/src/types/color.d.ts +20 -0
- package/src/types/elliptic.d.ts +62 -0
- package/src/utils/apiUtils.ts +88 -0
- package/src/utils/asyncUtils.ts +252 -0
- package/src/utils/cache.ts +264 -0
- package/src/utils/deviceManager.ts +198 -0
- package/src/utils/errorUtils.ts +216 -0
- package/src/utils/index.ts +21 -0
- package/src/utils/languageUtils.ts +174 -0
- package/src/utils/loggerUtils.ts +153 -0
- package/src/utils/platform.ts +117 -0
- package/src/utils/requestUtils.ts +237 -0
- package/src/utils/sessionUtils.ts +206 -0
- package/src/utils/validationUtils.ts +174 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import type { OxyServicesBase } from '../OxyServices.base';
|
|
2
|
+
import type { SessionLoginResponse } from '../models/session';
|
|
3
|
+
export interface FedCMAuthOptions {
|
|
4
|
+
nonce?: string;
|
|
5
|
+
context?: 'signin' | 'signup' | 'continue' | 'use';
|
|
6
|
+
}
|
|
7
|
+
export interface FedCMConfig {
|
|
8
|
+
enabled: boolean;
|
|
9
|
+
configURL: string;
|
|
10
|
+
clientId?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Federated Credential Management (FedCM) Authentication Mixin
|
|
14
|
+
*
|
|
15
|
+
* Implements the modern browser-native identity federation API that enables
|
|
16
|
+
* Google-style cross-domain authentication without third-party cookies.
|
|
17
|
+
*
|
|
18
|
+
* Browser Support:
|
|
19
|
+
* - Chrome 108+
|
|
20
|
+
* - Safari 16.4+
|
|
21
|
+
* - Edge 108+
|
|
22
|
+
* - Firefox: Not yet supported (fallback required)
|
|
23
|
+
*
|
|
24
|
+
* Key Features:
|
|
25
|
+
* - No redirects or popups required
|
|
26
|
+
* - Browser-native UI prompts
|
|
27
|
+
* - Privacy-preserving (IdP can't track users)
|
|
28
|
+
* - Automatic SSO across domains
|
|
29
|
+
* - Silent re-authentication support
|
|
30
|
+
*
|
|
31
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/FedCM_API
|
|
32
|
+
*/
|
|
33
|
+
export declare function OxyServicesFedCMMixin<T extends typeof OxyServicesBase>(Base: T): {
|
|
34
|
+
new (...args: any[]): {
|
|
35
|
+
/**
|
|
36
|
+
* Instance method to check FedCM support
|
|
37
|
+
*/
|
|
38
|
+
isFedCMSupported(): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Sign in using FedCM (Federated Credential Management API)
|
|
41
|
+
*
|
|
42
|
+
* This provides a Google-style authentication experience:
|
|
43
|
+
* - Browser shows native "Sign in with Oxy" prompt
|
|
44
|
+
* - No redirect or popup required
|
|
45
|
+
* - User approves → credential exchange happens in browser
|
|
46
|
+
* - All apps automatically get SSO after first sign-in
|
|
47
|
+
*
|
|
48
|
+
* @param options - Authentication options
|
|
49
|
+
* @returns Session with access token and user data
|
|
50
|
+
* @throws {OxyAuthenticationError} If FedCM not supported or user cancels
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```typescript
|
|
54
|
+
* try {
|
|
55
|
+
* const session = await oxyServices.signInWithFedCM();
|
|
56
|
+
* console.log('Signed in:', session.user);
|
|
57
|
+
* } catch (error) {
|
|
58
|
+
* // Fallback to popup or redirect auth
|
|
59
|
+
* await oxyServices.signInWithPopup();
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
signInWithFedCM(options?: FedCMAuthOptions): Promise<SessionLoginResponse>;
|
|
64
|
+
/**
|
|
65
|
+
* Silent sign-in using FedCM
|
|
66
|
+
*
|
|
67
|
+
* Attempts to automatically re-authenticate the user without any UI.
|
|
68
|
+
* This is what enables "instant sign-in" across all Oxy domains after
|
|
69
|
+
* the user has signed in once.
|
|
70
|
+
*
|
|
71
|
+
* The browser will:
|
|
72
|
+
* 1. Check if user has previously signed in to Oxy
|
|
73
|
+
* 2. Check if user is still signed in at auth.oxy.so
|
|
74
|
+
* 3. If yes, automatically provide credential without prompting
|
|
75
|
+
*
|
|
76
|
+
* @returns Session if user is already signed in, null otherwise
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```typescript
|
|
80
|
+
* // On app startup
|
|
81
|
+
* useEffect(() => {
|
|
82
|
+
* const checkAuth = async () => {
|
|
83
|
+
* const session = await oxyServices.silentSignInWithFedCM();
|
|
84
|
+
* if (session) {
|
|
85
|
+
* setUser(session.user);
|
|
86
|
+
* } else {
|
|
87
|
+
* // Show sign-in button
|
|
88
|
+
* }
|
|
89
|
+
* };
|
|
90
|
+
* checkAuth();
|
|
91
|
+
* }, []);
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
silentSignInWithFedCM(): Promise<SessionLoginResponse | null>;
|
|
95
|
+
/**
|
|
96
|
+
* Request identity credential from browser using FedCM API
|
|
97
|
+
*
|
|
98
|
+
* Uses a global lock to prevent concurrent requests, as FedCM only
|
|
99
|
+
* allows one navigator.credentials.get request at a time.
|
|
100
|
+
*
|
|
101
|
+
* Interactive requests (optional/required) wait for any silent request to finish first.
|
|
102
|
+
*
|
|
103
|
+
* @private
|
|
104
|
+
*/
|
|
105
|
+
requestIdentityCredential(options: {
|
|
106
|
+
configURL: string;
|
|
107
|
+
clientId: string;
|
|
108
|
+
nonce: string;
|
|
109
|
+
context?: string;
|
|
110
|
+
mediation?: "silent" | "optional" | "required";
|
|
111
|
+
}): Promise<{
|
|
112
|
+
token: string;
|
|
113
|
+
} | null>;
|
|
114
|
+
/**
|
|
115
|
+
* Exchange FedCM ID token for Oxy session
|
|
116
|
+
*
|
|
117
|
+
* The ID token is a JWT issued by auth.oxy.so that proves the user's
|
|
118
|
+
* identity. We exchange it for a full Oxy session with access token.
|
|
119
|
+
*
|
|
120
|
+
* @private
|
|
121
|
+
*/
|
|
122
|
+
exchangeIdTokenForSession(idToken: string): Promise<SessionLoginResponse>;
|
|
123
|
+
/**
|
|
124
|
+
* Revoke FedCM credential (sign out)
|
|
125
|
+
*
|
|
126
|
+
* This tells the browser to forget the FedCM credential for this app.
|
|
127
|
+
* The user will need to re-authenticate next time.
|
|
128
|
+
*/
|
|
129
|
+
revokeFedCMCredential(): Promise<void>;
|
|
130
|
+
/**
|
|
131
|
+
* Get configuration for FedCM
|
|
132
|
+
*
|
|
133
|
+
* @returns FedCM configuration with browser support info
|
|
134
|
+
*/
|
|
135
|
+
getFedCMConfig(): FedCMConfig;
|
|
136
|
+
/**
|
|
137
|
+
* Generate a cryptographically secure nonce for FedCM
|
|
138
|
+
*
|
|
139
|
+
* @private
|
|
140
|
+
*/
|
|
141
|
+
generateNonce(): string;
|
|
142
|
+
/**
|
|
143
|
+
* Get the client ID for this origin
|
|
144
|
+
*
|
|
145
|
+
* @private
|
|
146
|
+
*/
|
|
147
|
+
getClientId(): string;
|
|
148
|
+
httpService: import("../HttpService").HttpService;
|
|
149
|
+
cloudURL: string;
|
|
150
|
+
config: import("../OxyServices.base").OxyConfig;
|
|
151
|
+
makeRequest<T_1>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("../HttpService").RequestOptions): Promise<T_1>;
|
|
152
|
+
getBaseURL(): string;
|
|
153
|
+
getClient(): import("../HttpService").HttpService;
|
|
154
|
+
getMetrics(): {
|
|
155
|
+
totalRequests: number;
|
|
156
|
+
successfulRequests: number;
|
|
157
|
+
failedRequests: number;
|
|
158
|
+
cacheHits: number;
|
|
159
|
+
cacheMisses: number;
|
|
160
|
+
averageResponseTime: number;
|
|
161
|
+
};
|
|
162
|
+
clearCache(): void;
|
|
163
|
+
clearCacheEntry(key: string): void;
|
|
164
|
+
getCacheStats(): {
|
|
165
|
+
size: number;
|
|
166
|
+
hits: number;
|
|
167
|
+
misses: number;
|
|
168
|
+
hitRate: number;
|
|
169
|
+
};
|
|
170
|
+
getCloudURL(): string;
|
|
171
|
+
setTokens(accessToken: string, refreshToken?: string): void;
|
|
172
|
+
clearTokens(): void;
|
|
173
|
+
getCurrentUserId(): string | null;
|
|
174
|
+
hasValidToken(): boolean;
|
|
175
|
+
getAccessToken(): string | null;
|
|
176
|
+
waitForAuth(timeoutMs?: number): Promise<boolean>;
|
|
177
|
+
withAuthRetry<T_1>(operation: () => Promise<T_1>, operationName: string, options?: {
|
|
178
|
+
maxRetries?: number;
|
|
179
|
+
retryDelay?: number;
|
|
180
|
+
authTimeoutMs?: number;
|
|
181
|
+
}): Promise<T_1>;
|
|
182
|
+
validate(): Promise<boolean>;
|
|
183
|
+
handleError(error: unknown): Error;
|
|
184
|
+
healthCheck(): Promise<{
|
|
185
|
+
status: string;
|
|
186
|
+
users?: number;
|
|
187
|
+
timestamp?: string;
|
|
188
|
+
[key: string]: any;
|
|
189
|
+
}>;
|
|
190
|
+
};
|
|
191
|
+
readonly DEFAULT_CONFIG_URL: "https://auth.oxy.so/fedcm.json";
|
|
192
|
+
readonly FEDCM_TIMEOUT: 60000;
|
|
193
|
+
readonly FEDCM_SILENT_TIMEOUT: 10000;
|
|
194
|
+
/**
|
|
195
|
+
* Check if FedCM is supported in the current browser
|
|
196
|
+
*/
|
|
197
|
+
isFedCMSupported(): boolean;
|
|
198
|
+
__resetTokensForTests(): void;
|
|
199
|
+
} & T;
|
|
200
|
+
export { OxyServicesFedCMMixin as FedCMMixin };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Karma Methods Mixin
|
|
3
|
+
*
|
|
4
|
+
* Provides methods for karma system management
|
|
5
|
+
*/
|
|
6
|
+
import type { OxyServicesBase } from '../OxyServices.base';
|
|
7
|
+
export declare function OxyServicesKarmaMixin<T extends typeof OxyServicesBase>(Base: T): {
|
|
8
|
+
new (...args: any[]): {
|
|
9
|
+
/**
|
|
10
|
+
* Get user karma
|
|
11
|
+
*/
|
|
12
|
+
getUserKarma(userId: string): Promise<any>;
|
|
13
|
+
/**
|
|
14
|
+
* Give karma to user
|
|
15
|
+
*/
|
|
16
|
+
giveKarma(userId: string, amount: number, reason?: string): Promise<any>;
|
|
17
|
+
/**
|
|
18
|
+
* Get user karma total
|
|
19
|
+
* @param userId - The user ID
|
|
20
|
+
* @returns User karma total
|
|
21
|
+
*/
|
|
22
|
+
getUserKarmaTotal(userId: string): Promise<any>;
|
|
23
|
+
/**
|
|
24
|
+
* Get user karma history
|
|
25
|
+
* @param userId - The user ID
|
|
26
|
+
* @param limit - Optional limit for results
|
|
27
|
+
* @param offset - Optional offset for pagination
|
|
28
|
+
* @returns User karma history
|
|
29
|
+
*/
|
|
30
|
+
getUserKarmaHistory(userId: string, limit?: number, offset?: number): Promise<any>;
|
|
31
|
+
/**
|
|
32
|
+
* Get karma leaderboard
|
|
33
|
+
* @returns Karma leaderboard
|
|
34
|
+
*/
|
|
35
|
+
getKarmaLeaderboard(): Promise<any>;
|
|
36
|
+
/**
|
|
37
|
+
* Get karma rules
|
|
38
|
+
* @returns Karma rules
|
|
39
|
+
*/
|
|
40
|
+
getKarmaRules(): Promise<any>;
|
|
41
|
+
httpService: import("../HttpService").HttpService;
|
|
42
|
+
cloudURL: string;
|
|
43
|
+
config: import("../OxyServices.base").OxyConfig;
|
|
44
|
+
makeRequest<T_1>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("../HttpService").RequestOptions): Promise<T_1>;
|
|
45
|
+
getBaseURL(): string;
|
|
46
|
+
getClient(): import("../HttpService").HttpService;
|
|
47
|
+
getMetrics(): {
|
|
48
|
+
totalRequests: number;
|
|
49
|
+
successfulRequests: number;
|
|
50
|
+
failedRequests: number;
|
|
51
|
+
cacheHits: number;
|
|
52
|
+
cacheMisses: number;
|
|
53
|
+
averageResponseTime: number;
|
|
54
|
+
};
|
|
55
|
+
clearCache(): void;
|
|
56
|
+
clearCacheEntry(key: string): void;
|
|
57
|
+
getCacheStats(): {
|
|
58
|
+
size: number;
|
|
59
|
+
hits: number;
|
|
60
|
+
misses: number;
|
|
61
|
+
hitRate: number;
|
|
62
|
+
};
|
|
63
|
+
getCloudURL(): string;
|
|
64
|
+
setTokens(accessToken: string, refreshToken?: string): void;
|
|
65
|
+
clearTokens(): void;
|
|
66
|
+
getCurrentUserId(): string | null;
|
|
67
|
+
hasValidToken(): boolean;
|
|
68
|
+
getAccessToken(): string | null;
|
|
69
|
+
waitForAuth(timeoutMs?: number): Promise<boolean>;
|
|
70
|
+
withAuthRetry<T_1>(operation: () => Promise<T_1>, operationName: string, options?: {
|
|
71
|
+
maxRetries?: number;
|
|
72
|
+
retryDelay?: number;
|
|
73
|
+
authTimeoutMs?: number;
|
|
74
|
+
}): Promise<T_1>;
|
|
75
|
+
validate(): Promise<boolean>;
|
|
76
|
+
handleError(error: unknown): Error;
|
|
77
|
+
healthCheck(): Promise<{
|
|
78
|
+
status: string;
|
|
79
|
+
users?: number;
|
|
80
|
+
timestamp?: string;
|
|
81
|
+
[key: string]: any;
|
|
82
|
+
}>;
|
|
83
|
+
};
|
|
84
|
+
__resetTokensForTests(): void;
|
|
85
|
+
} & T;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import type { LanguageMetadata } from '../utils/languageUtils';
|
|
2
|
+
import type { OxyServicesBase } from '../OxyServices.base';
|
|
3
|
+
export declare function OxyServicesLanguageMixin<T extends typeof OxyServicesBase>(Base: T): {
|
|
4
|
+
new (...args: any[]): {
|
|
5
|
+
/**
|
|
6
|
+
* Get appropriate storage for the platform (similar to DeviceManager)
|
|
7
|
+
*/
|
|
8
|
+
getStorage(): Promise<{
|
|
9
|
+
getItem: (key: string) => Promise<string | null>;
|
|
10
|
+
setItem: (key: string, value: string) => Promise<void>;
|
|
11
|
+
removeItem: (key: string) => Promise<void>;
|
|
12
|
+
}>;
|
|
13
|
+
/**
|
|
14
|
+
* Get the current language from storage or user profile
|
|
15
|
+
* @param storageKeyPrefix - Optional prefix for storage key (default: 'oxy_session')
|
|
16
|
+
* @returns The current language code (e.g., 'en-US') or null if not set
|
|
17
|
+
*/
|
|
18
|
+
getCurrentLanguage(storageKeyPrefix?: string): Promise<string | null>;
|
|
19
|
+
/**
|
|
20
|
+
* Get the current language with metadata (name, nativeName, etc.)
|
|
21
|
+
* @param storageKeyPrefix - Optional prefix for storage key (default: 'oxy_session')
|
|
22
|
+
* @returns Language metadata object or null if not set
|
|
23
|
+
*/
|
|
24
|
+
getCurrentLanguageMetadata(storageKeyPrefix?: string): Promise<LanguageMetadata | null>;
|
|
25
|
+
/**
|
|
26
|
+
* Get the current language name (e.g., 'English')
|
|
27
|
+
* @param storageKeyPrefix - Optional prefix for storage key (default: 'oxy_session')
|
|
28
|
+
* @returns Language name or null if not set
|
|
29
|
+
*/
|
|
30
|
+
getCurrentLanguageName(storageKeyPrefix?: string): Promise<string | null>;
|
|
31
|
+
/**
|
|
32
|
+
* Get the current native language name (e.g., 'Español')
|
|
33
|
+
* @param storageKeyPrefix - Optional prefix for storage key (default: 'oxy_session')
|
|
34
|
+
* @returns Native language name or null if not set
|
|
35
|
+
*/
|
|
36
|
+
getCurrentNativeLanguageName(storageKeyPrefix?: string): Promise<string | null>;
|
|
37
|
+
httpService: import("../HttpService").HttpService;
|
|
38
|
+
cloudURL: string;
|
|
39
|
+
config: import("../OxyServices.base").OxyConfig;
|
|
40
|
+
makeRequest<T_1>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("../HttpService").RequestOptions): Promise<T_1>;
|
|
41
|
+
getBaseURL(): string;
|
|
42
|
+
getClient(): import("../HttpService").HttpService;
|
|
43
|
+
getMetrics(): {
|
|
44
|
+
totalRequests: number;
|
|
45
|
+
successfulRequests: number;
|
|
46
|
+
failedRequests: number;
|
|
47
|
+
cacheHits: number;
|
|
48
|
+
cacheMisses: number;
|
|
49
|
+
averageResponseTime: number;
|
|
50
|
+
};
|
|
51
|
+
clearCache(): void;
|
|
52
|
+
clearCacheEntry(key: string): void;
|
|
53
|
+
getCacheStats(): {
|
|
54
|
+
size: number;
|
|
55
|
+
hits: number;
|
|
56
|
+
misses: number;
|
|
57
|
+
hitRate: number;
|
|
58
|
+
};
|
|
59
|
+
getCloudURL(): string;
|
|
60
|
+
setTokens(accessToken: string, refreshToken?: string): void;
|
|
61
|
+
clearTokens(): void;
|
|
62
|
+
getCurrentUserId(): string | null;
|
|
63
|
+
hasValidToken(): boolean;
|
|
64
|
+
getAccessToken(): string | null;
|
|
65
|
+
waitForAuth(timeoutMs?: number): Promise<boolean>;
|
|
66
|
+
withAuthRetry<T_1>(operation: () => Promise<T_1>, operationName: string, options?: {
|
|
67
|
+
maxRetries?: number;
|
|
68
|
+
retryDelay?: number;
|
|
69
|
+
authTimeoutMs?: number;
|
|
70
|
+
}): Promise<T_1>;
|
|
71
|
+
validate(): Promise<boolean>;
|
|
72
|
+
handleError(error: unknown): Error;
|
|
73
|
+
healthCheck(): Promise<{
|
|
74
|
+
status: string;
|
|
75
|
+
users?: number;
|
|
76
|
+
timestamp?: string;
|
|
77
|
+
[key: string]: any;
|
|
78
|
+
}>;
|
|
79
|
+
};
|
|
80
|
+
__resetTokensForTests(): void;
|
|
81
|
+
} & T;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Location Methods Mixin
|
|
3
|
+
*/
|
|
4
|
+
import type { OxyServicesBase } from '../OxyServices.base';
|
|
5
|
+
export declare function OxyServicesLocationMixin<T extends typeof OxyServicesBase>(Base: T): {
|
|
6
|
+
new (...args: any[]): {
|
|
7
|
+
/**
|
|
8
|
+
* Update user location
|
|
9
|
+
* @param latitude - Latitude coordinate
|
|
10
|
+
* @param longitude - Longitude coordinate
|
|
11
|
+
* @returns Location update result
|
|
12
|
+
*/
|
|
13
|
+
updateLocation(latitude: number, longitude: number): Promise<any>;
|
|
14
|
+
/**
|
|
15
|
+
* Get nearby users
|
|
16
|
+
* @param radius - Optional search radius in meters
|
|
17
|
+
* @returns Array of nearby users
|
|
18
|
+
*/
|
|
19
|
+
getNearbyUsers(radius?: number): Promise<any[]>;
|
|
20
|
+
httpService: import("../HttpService").HttpService;
|
|
21
|
+
cloudURL: string;
|
|
22
|
+
config: import("../OxyServices.base").OxyConfig;
|
|
23
|
+
makeRequest<T_1>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("../HttpService").RequestOptions): Promise<T_1>;
|
|
24
|
+
getBaseURL(): string;
|
|
25
|
+
getClient(): import("../HttpService").HttpService;
|
|
26
|
+
getMetrics(): {
|
|
27
|
+
totalRequests: number;
|
|
28
|
+
successfulRequests: number;
|
|
29
|
+
failedRequests: number;
|
|
30
|
+
cacheHits: number;
|
|
31
|
+
cacheMisses: number;
|
|
32
|
+
averageResponseTime: number;
|
|
33
|
+
};
|
|
34
|
+
clearCache(): void;
|
|
35
|
+
clearCacheEntry(key: string): void;
|
|
36
|
+
getCacheStats(): {
|
|
37
|
+
size: number;
|
|
38
|
+
hits: number;
|
|
39
|
+
misses: number;
|
|
40
|
+
hitRate: number;
|
|
41
|
+
};
|
|
42
|
+
getCloudURL(): string;
|
|
43
|
+
setTokens(accessToken: string, refreshToken?: string): void;
|
|
44
|
+
clearTokens(): void;
|
|
45
|
+
getCurrentUserId(): string | null;
|
|
46
|
+
hasValidToken(): boolean;
|
|
47
|
+
getAccessToken(): string | null;
|
|
48
|
+
waitForAuth(timeoutMs?: number): Promise<boolean>;
|
|
49
|
+
withAuthRetry<T_1>(operation: () => Promise<T_1>, operationName: string, options?: {
|
|
50
|
+
maxRetries?: number;
|
|
51
|
+
retryDelay?: number;
|
|
52
|
+
authTimeoutMs?: number;
|
|
53
|
+
}): Promise<T_1>;
|
|
54
|
+
validate(): Promise<boolean>;
|
|
55
|
+
handleError(error: unknown): Error;
|
|
56
|
+
healthCheck(): Promise<{
|
|
57
|
+
status: string;
|
|
58
|
+
users?: number;
|
|
59
|
+
timestamp?: string;
|
|
60
|
+
[key: string]: any;
|
|
61
|
+
}>;
|
|
62
|
+
};
|
|
63
|
+
__resetTokensForTests(): void;
|
|
64
|
+
} & T;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Payment Methods Mixin
|
|
3
|
+
*
|
|
4
|
+
* Provides methods for payment processing and management
|
|
5
|
+
*/
|
|
6
|
+
import type { OxyServicesBase } from '../OxyServices.base';
|
|
7
|
+
export declare function OxyServicesPaymentMixin<T extends typeof OxyServicesBase>(Base: T): {
|
|
8
|
+
new (...args: any[]): {
|
|
9
|
+
/**
|
|
10
|
+
* Create a payment
|
|
11
|
+
* @param data - Payment data
|
|
12
|
+
* @returns Created payment object
|
|
13
|
+
*/
|
|
14
|
+
createPayment(data: any): Promise<any>;
|
|
15
|
+
/**
|
|
16
|
+
* Get payment by ID
|
|
17
|
+
* @param paymentId - The payment ID
|
|
18
|
+
* @returns Payment object
|
|
19
|
+
*/
|
|
20
|
+
getPayment(paymentId: string): Promise<any>;
|
|
21
|
+
/**
|
|
22
|
+
* Get user payments
|
|
23
|
+
* @returns Array of user payments
|
|
24
|
+
*/
|
|
25
|
+
getUserPayments(): Promise<any[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Get user subscription
|
|
28
|
+
* @param userId - The user ID
|
|
29
|
+
* @returns Subscription object
|
|
30
|
+
*/
|
|
31
|
+
getSubscription(userId: string): Promise<any>;
|
|
32
|
+
/**
|
|
33
|
+
* Get current user's subscription
|
|
34
|
+
* @returns Subscription object
|
|
35
|
+
*/
|
|
36
|
+
getCurrentUserSubscription(): Promise<any>;
|
|
37
|
+
/**
|
|
38
|
+
* Get user wallet
|
|
39
|
+
* @param userId - The user ID
|
|
40
|
+
* @returns Wallet object with balance
|
|
41
|
+
*/
|
|
42
|
+
getWallet(userId: string): Promise<any>;
|
|
43
|
+
/**
|
|
44
|
+
* Get current user's wallet
|
|
45
|
+
* @returns Wallet object with balance
|
|
46
|
+
*/
|
|
47
|
+
getCurrentUserWallet(): Promise<any>;
|
|
48
|
+
/**
|
|
49
|
+
* Get wallet transaction history
|
|
50
|
+
* @param userId - The user ID
|
|
51
|
+
* @param options - Pagination options
|
|
52
|
+
* @returns Transaction history
|
|
53
|
+
*/
|
|
54
|
+
getWalletTransactions(userId: string, options?: {
|
|
55
|
+
limit?: number;
|
|
56
|
+
offset?: number;
|
|
57
|
+
}): Promise<any>;
|
|
58
|
+
/**
|
|
59
|
+
* Get current user's wallet transaction history
|
|
60
|
+
* @param options - Pagination options
|
|
61
|
+
* @returns Transaction history
|
|
62
|
+
*/
|
|
63
|
+
getCurrentUserWalletTransactions(options?: {
|
|
64
|
+
limit?: number;
|
|
65
|
+
offset?: number;
|
|
66
|
+
}): Promise<any>;
|
|
67
|
+
httpService: import("../HttpService").HttpService;
|
|
68
|
+
cloudURL: string;
|
|
69
|
+
config: import("../OxyServices.base").OxyConfig;
|
|
70
|
+
makeRequest<T_1>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("../HttpService").RequestOptions): Promise<T_1>;
|
|
71
|
+
getBaseURL(): string;
|
|
72
|
+
getClient(): import("../HttpService").HttpService;
|
|
73
|
+
getMetrics(): {
|
|
74
|
+
totalRequests: number;
|
|
75
|
+
successfulRequests: number;
|
|
76
|
+
failedRequests: number;
|
|
77
|
+
cacheHits: number;
|
|
78
|
+
cacheMisses: number;
|
|
79
|
+
averageResponseTime: number;
|
|
80
|
+
};
|
|
81
|
+
clearCache(): void;
|
|
82
|
+
clearCacheEntry(key: string): void;
|
|
83
|
+
getCacheStats(): {
|
|
84
|
+
size: number;
|
|
85
|
+
hits: number;
|
|
86
|
+
misses: number;
|
|
87
|
+
hitRate: number;
|
|
88
|
+
};
|
|
89
|
+
getCloudURL(): string;
|
|
90
|
+
setTokens(accessToken: string, refreshToken?: string): void;
|
|
91
|
+
clearTokens(): void;
|
|
92
|
+
getCurrentUserId(): string | null;
|
|
93
|
+
hasValidToken(): boolean;
|
|
94
|
+
getAccessToken(): string | null;
|
|
95
|
+
waitForAuth(timeoutMs?: number): Promise<boolean>;
|
|
96
|
+
withAuthRetry<T_1>(operation: () => Promise<T_1>, operationName: string, options?: {
|
|
97
|
+
maxRetries?: number;
|
|
98
|
+
retryDelay?: number;
|
|
99
|
+
authTimeoutMs?: number;
|
|
100
|
+
}): Promise<T_1>;
|
|
101
|
+
validate(): Promise<boolean>;
|
|
102
|
+
handleError(error: unknown): Error;
|
|
103
|
+
healthCheck(): Promise<{
|
|
104
|
+
status: string;
|
|
105
|
+
users?: number;
|
|
106
|
+
timestamp?: string;
|
|
107
|
+
[key: string]: any;
|
|
108
|
+
}>;
|
|
109
|
+
};
|
|
110
|
+
__resetTokensForTests(): void;
|
|
111
|
+
} & T;
|