@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,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Authentication Methods Mixin
|
|
3
|
+
*
|
|
4
|
+
* Supports password-based login (email/username) and public key challenge-response.
|
|
5
|
+
*/
|
|
6
|
+
import type { User } from '../models/interfaces';
|
|
7
|
+
import type { SessionLoginResponse } from '../models/session';
|
|
8
|
+
import type { OxyServicesBase } from '../OxyServices.base';
|
|
9
|
+
export interface ChallengeResponse {
|
|
10
|
+
challenge: string;
|
|
11
|
+
expiresAt: string;
|
|
12
|
+
}
|
|
13
|
+
export interface RegistrationRequest {
|
|
14
|
+
publicKey: string;
|
|
15
|
+
username: string;
|
|
16
|
+
email?: string;
|
|
17
|
+
signature: string;
|
|
18
|
+
timestamp: number;
|
|
19
|
+
}
|
|
20
|
+
export interface ChallengeVerifyRequest {
|
|
21
|
+
publicKey: string;
|
|
22
|
+
challenge: string;
|
|
23
|
+
signature: string;
|
|
24
|
+
timestamp: number;
|
|
25
|
+
deviceName?: string;
|
|
26
|
+
deviceFingerprint?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface PublicKeyCheckResponse {
|
|
29
|
+
registered: boolean;
|
|
30
|
+
message: string;
|
|
31
|
+
}
|
|
32
|
+
export declare function OxyServicesAuthMixin<T extends typeof OxyServicesBase>(Base: T): {
|
|
33
|
+
new (...args: any[]): {
|
|
34
|
+
/**
|
|
35
|
+
* Register a new identity with public key authentication
|
|
36
|
+
* Identity is purely cryptographic - username and profile data are optional
|
|
37
|
+
*
|
|
38
|
+
* @param publicKey - The user's ECDSA public key (hex)
|
|
39
|
+
* @param signature - Signature of the registration request
|
|
40
|
+
* @param timestamp - Timestamp when the signature was created
|
|
41
|
+
*/
|
|
42
|
+
register(publicKey: string, signature: string, timestamp: number): Promise<{
|
|
43
|
+
message: string;
|
|
44
|
+
user: User;
|
|
45
|
+
}>;
|
|
46
|
+
/**
|
|
47
|
+
* Request an authentication challenge
|
|
48
|
+
* The client must sign this challenge with their private key
|
|
49
|
+
*
|
|
50
|
+
* @param publicKey - The user's public key
|
|
51
|
+
*/
|
|
52
|
+
requestChallenge(publicKey: string): Promise<ChallengeResponse>;
|
|
53
|
+
/**
|
|
54
|
+
* Verify a signed challenge and create a session
|
|
55
|
+
*
|
|
56
|
+
* @param publicKey - The user's public key
|
|
57
|
+
* @param challenge - The challenge string from requestChallenge
|
|
58
|
+
* @param signature - Signature of the auth message
|
|
59
|
+
* @param timestamp - Timestamp when the signature was created
|
|
60
|
+
* @param deviceName - Optional device name
|
|
61
|
+
* @param deviceFingerprint - Optional device fingerprint
|
|
62
|
+
*/
|
|
63
|
+
verifyChallenge(publicKey: string, challenge: string, signature: string, timestamp: number, deviceName?: string, deviceFingerprint?: string): Promise<SessionLoginResponse>;
|
|
64
|
+
/**
|
|
65
|
+
* Check if a public key is already registered
|
|
66
|
+
*/
|
|
67
|
+
checkPublicKeyRegistered(publicKey: string): Promise<PublicKeyCheckResponse>;
|
|
68
|
+
/**
|
|
69
|
+
* Get user by public key
|
|
70
|
+
*/
|
|
71
|
+
getUserByPublicKey(publicKey: string): Promise<User>;
|
|
72
|
+
/**
|
|
73
|
+
* Get user by session ID
|
|
74
|
+
*/
|
|
75
|
+
getUserBySession(sessionId: string): Promise<User>;
|
|
76
|
+
/**
|
|
77
|
+
* Batch get multiple user profiles by session IDs
|
|
78
|
+
*/
|
|
79
|
+
getUsersBySessions(sessionIds: string[]): Promise<Array<{
|
|
80
|
+
sessionId: string;
|
|
81
|
+
user: User | null;
|
|
82
|
+
}>>;
|
|
83
|
+
/**
|
|
84
|
+
* Get access token by session ID
|
|
85
|
+
*/
|
|
86
|
+
getTokenBySession(sessionId: string): Promise<{
|
|
87
|
+
accessToken: string;
|
|
88
|
+
expiresAt: string;
|
|
89
|
+
}>;
|
|
90
|
+
/**
|
|
91
|
+
* Get sessions by session ID
|
|
92
|
+
*/
|
|
93
|
+
getSessionsBySessionId(sessionId: string): Promise<any[]>;
|
|
94
|
+
/**
|
|
95
|
+
* Logout from a specific session
|
|
96
|
+
*/
|
|
97
|
+
logoutSession(sessionId: string, targetSessionId?: string): Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* Logout from all sessions
|
|
100
|
+
*/
|
|
101
|
+
logoutAllSessions(sessionId: string): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* Validate session
|
|
104
|
+
*/
|
|
105
|
+
validateSession(sessionId: string, options?: {
|
|
106
|
+
deviceFingerprint?: string;
|
|
107
|
+
useHeaderValidation?: boolean;
|
|
108
|
+
}): Promise<{
|
|
109
|
+
valid: boolean;
|
|
110
|
+
expiresAt: string;
|
|
111
|
+
lastActivity: string;
|
|
112
|
+
user: User;
|
|
113
|
+
sessionId?: string;
|
|
114
|
+
source?: string;
|
|
115
|
+
}>;
|
|
116
|
+
/**
|
|
117
|
+
* Check username availability
|
|
118
|
+
*/
|
|
119
|
+
checkUsernameAvailability(username: string): Promise<{
|
|
120
|
+
available: boolean;
|
|
121
|
+
message: string;
|
|
122
|
+
}>;
|
|
123
|
+
/**
|
|
124
|
+
* Check email availability
|
|
125
|
+
*/
|
|
126
|
+
checkEmailAvailability(email: string): Promise<{
|
|
127
|
+
available: boolean;
|
|
128
|
+
message: string;
|
|
129
|
+
}>;
|
|
130
|
+
/**
|
|
131
|
+
* Register a new user with email/username and password
|
|
132
|
+
*/
|
|
133
|
+
signUp(username: string, email: string, password: string, deviceName?: string, deviceFingerprint?: any): Promise<SessionLoginResponse>;
|
|
134
|
+
/**
|
|
135
|
+
* Sign in with email or username and password
|
|
136
|
+
*/
|
|
137
|
+
signIn(identifier: string, password: string, deviceName?: string, deviceFingerprint?: any): Promise<SessionLoginResponse>;
|
|
138
|
+
/**
|
|
139
|
+
* Convenience helper for email sign-in
|
|
140
|
+
*/
|
|
141
|
+
signInWithEmail(email: string, password: string, deviceName?: string, deviceFingerprint?: any): Promise<SessionLoginResponse>;
|
|
142
|
+
httpService: import("../HttpService").HttpService;
|
|
143
|
+
cloudURL: string;
|
|
144
|
+
config: import("../OxyServices.base").OxyConfig;
|
|
145
|
+
makeRequest<T_1>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("../HttpService").RequestOptions): Promise<T_1>;
|
|
146
|
+
getBaseURL(): string;
|
|
147
|
+
getClient(): import("../HttpService").HttpService;
|
|
148
|
+
getMetrics(): {
|
|
149
|
+
totalRequests: number;
|
|
150
|
+
successfulRequests: number;
|
|
151
|
+
failedRequests: number;
|
|
152
|
+
cacheHits: number;
|
|
153
|
+
cacheMisses: number;
|
|
154
|
+
averageResponseTime: number;
|
|
155
|
+
};
|
|
156
|
+
clearCache(): void;
|
|
157
|
+
clearCacheEntry(key: string): void;
|
|
158
|
+
getCacheStats(): {
|
|
159
|
+
size: number;
|
|
160
|
+
hits: number;
|
|
161
|
+
misses: number;
|
|
162
|
+
hitRate: number;
|
|
163
|
+
};
|
|
164
|
+
getCloudURL(): string;
|
|
165
|
+
setTokens(accessToken: string, refreshToken?: string): void;
|
|
166
|
+
clearTokens(): void;
|
|
167
|
+
getCurrentUserId(): string | null;
|
|
168
|
+
hasValidToken(): boolean;
|
|
169
|
+
getAccessToken(): string | null;
|
|
170
|
+
waitForAuth(timeoutMs?: number): Promise<boolean>;
|
|
171
|
+
withAuthRetry<T_1>(operation: () => Promise<T_1>, operationName: string, options?: {
|
|
172
|
+
maxRetries?: number;
|
|
173
|
+
retryDelay?: number;
|
|
174
|
+
authTimeoutMs?: number;
|
|
175
|
+
}): Promise<T_1>;
|
|
176
|
+
validate(): Promise<boolean>;
|
|
177
|
+
handleError(error: unknown): Error;
|
|
178
|
+
healthCheck(): Promise<{
|
|
179
|
+
status: string;
|
|
180
|
+
users?: number;
|
|
181
|
+
timestamp?: string;
|
|
182
|
+
[key: string]: any;
|
|
183
|
+
}>;
|
|
184
|
+
};
|
|
185
|
+
__resetTokensForTests(): void;
|
|
186
|
+
} & T;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Developer API Methods Mixin
|
|
3
|
+
*
|
|
4
|
+
* Provides methods for managing developer applications and API keys
|
|
5
|
+
*/
|
|
6
|
+
import type { OxyServicesBase } from '../OxyServices.base';
|
|
7
|
+
export declare function OxyServicesDeveloperMixin<T extends typeof OxyServicesBase>(Base: T): {
|
|
8
|
+
new (...args: any[]): {
|
|
9
|
+
/**
|
|
10
|
+
* Get developer apps for the current user
|
|
11
|
+
* @returns Array of developer apps
|
|
12
|
+
*/
|
|
13
|
+
getDeveloperApps(): Promise<any[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Create a new developer app
|
|
16
|
+
* @param data - Developer app configuration
|
|
17
|
+
* @returns Created developer app
|
|
18
|
+
*/
|
|
19
|
+
createDeveloperApp(data: {
|
|
20
|
+
name: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
webhookUrl: string;
|
|
23
|
+
devWebhookUrl?: string;
|
|
24
|
+
scopes?: string[];
|
|
25
|
+
}): Promise<any>;
|
|
26
|
+
/**
|
|
27
|
+
* Get a specific developer app
|
|
28
|
+
*/
|
|
29
|
+
getDeveloperApp(appId: string): Promise<any>;
|
|
30
|
+
/**
|
|
31
|
+
* Update a developer app
|
|
32
|
+
* @param appId - The developer app ID
|
|
33
|
+
* @param data - Updated app configuration
|
|
34
|
+
* @returns Updated developer app
|
|
35
|
+
*/
|
|
36
|
+
updateDeveloperApp(appId: string, data: {
|
|
37
|
+
name?: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
webhookUrl?: string;
|
|
40
|
+
devWebhookUrl?: string;
|
|
41
|
+
scopes?: string[];
|
|
42
|
+
}): Promise<any>;
|
|
43
|
+
/**
|
|
44
|
+
* Regenerate API secret for a developer app
|
|
45
|
+
* @param appId - The developer app ID
|
|
46
|
+
* @returns App with new secret
|
|
47
|
+
*/
|
|
48
|
+
regenerateDeveloperAppSecret(appId: string): Promise<any>;
|
|
49
|
+
/**
|
|
50
|
+
* Delete a developer app
|
|
51
|
+
* @param appId - The developer app ID
|
|
52
|
+
* @returns Deletion result
|
|
53
|
+
*/
|
|
54
|
+
deleteDeveloperApp(appId: string): Promise<any>;
|
|
55
|
+
httpService: import("../HttpService").HttpService;
|
|
56
|
+
cloudURL: string;
|
|
57
|
+
config: import("../OxyServices.base").OxyConfig;
|
|
58
|
+
makeRequest<T_1>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("../HttpService").RequestOptions): Promise<T_1>;
|
|
59
|
+
getBaseURL(): string;
|
|
60
|
+
getClient(): import("../HttpService").HttpService;
|
|
61
|
+
getMetrics(): {
|
|
62
|
+
totalRequests: number;
|
|
63
|
+
successfulRequests: number;
|
|
64
|
+
failedRequests: number;
|
|
65
|
+
cacheHits: number;
|
|
66
|
+
cacheMisses: number;
|
|
67
|
+
averageResponseTime: number;
|
|
68
|
+
};
|
|
69
|
+
clearCache(): void;
|
|
70
|
+
clearCacheEntry(key: string): void;
|
|
71
|
+
getCacheStats(): {
|
|
72
|
+
size: number;
|
|
73
|
+
hits: number;
|
|
74
|
+
misses: number;
|
|
75
|
+
hitRate: number;
|
|
76
|
+
};
|
|
77
|
+
getCloudURL(): string;
|
|
78
|
+
setTokens(accessToken: string, refreshToken?: string): void;
|
|
79
|
+
clearTokens(): void;
|
|
80
|
+
getCurrentUserId(): string | null;
|
|
81
|
+
hasValidToken(): boolean;
|
|
82
|
+
getAccessToken(): string | null;
|
|
83
|
+
waitForAuth(timeoutMs?: number): Promise<boolean>;
|
|
84
|
+
withAuthRetry<T_1>(operation: () => Promise<T_1>, operationName: string, options?: {
|
|
85
|
+
maxRetries?: number;
|
|
86
|
+
retryDelay?: number;
|
|
87
|
+
authTimeoutMs?: number;
|
|
88
|
+
}): Promise<T_1>;
|
|
89
|
+
validate(): Promise<boolean>;
|
|
90
|
+
handleError(error: unknown): Error;
|
|
91
|
+
healthCheck(): Promise<{
|
|
92
|
+
status: string;
|
|
93
|
+
users?: number;
|
|
94
|
+
timestamp?: string;
|
|
95
|
+
[key: string]: any;
|
|
96
|
+
}>;
|
|
97
|
+
};
|
|
98
|
+
__resetTokensForTests(): void;
|
|
99
|
+
} & T;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Device Methods Mixin
|
|
3
|
+
*/
|
|
4
|
+
import type { OxyServicesBase } from '../OxyServices.base';
|
|
5
|
+
export declare function OxyServicesDevicesMixin<T extends typeof OxyServicesBase>(Base: T): {
|
|
6
|
+
new (...args: any[]): {
|
|
7
|
+
/**
|
|
8
|
+
* Register a new device
|
|
9
|
+
* @param deviceData - Device information
|
|
10
|
+
* @returns Registered device object
|
|
11
|
+
*/
|
|
12
|
+
registerDevice(deviceData: any): Promise<any>;
|
|
13
|
+
/**
|
|
14
|
+
* Get all devices for the current user
|
|
15
|
+
* @returns Array of user devices
|
|
16
|
+
*/
|
|
17
|
+
getUserDevices(): Promise<any[]>;
|
|
18
|
+
/**
|
|
19
|
+
* Remove a device
|
|
20
|
+
* @param deviceId - The device ID to remove
|
|
21
|
+
*/
|
|
22
|
+
removeDevice(deviceId: string): Promise<void>;
|
|
23
|
+
/**
|
|
24
|
+
* Get device sessions for a given session ID
|
|
25
|
+
* Note: Not cached by default to ensure fresh data
|
|
26
|
+
* @param sessionId - The session ID
|
|
27
|
+
* @returns Array of device sessions
|
|
28
|
+
*/
|
|
29
|
+
getDeviceSessions(sessionId: string): Promise<any[]>;
|
|
30
|
+
/**
|
|
31
|
+
* Logout all device sessions
|
|
32
|
+
* @param sessionId - The session ID
|
|
33
|
+
* @param deviceId - Optional device ID to target
|
|
34
|
+
* @param excludeCurrent - Whether to exclude the current session
|
|
35
|
+
* @returns Logout result
|
|
36
|
+
*/
|
|
37
|
+
logoutAllDeviceSessions(sessionId: string, deviceId?: string, excludeCurrent?: boolean): Promise<any>;
|
|
38
|
+
/**
|
|
39
|
+
* Update device name
|
|
40
|
+
* @param sessionId - The session ID
|
|
41
|
+
* @param deviceName - New device name
|
|
42
|
+
* @returns Updated device object
|
|
43
|
+
*/
|
|
44
|
+
updateDeviceName(sessionId: string, deviceName: string): Promise<any>;
|
|
45
|
+
/**
|
|
46
|
+
* Get security information
|
|
47
|
+
* @returns Security information object
|
|
48
|
+
*/
|
|
49
|
+
getSecurityInfo(): Promise<{
|
|
50
|
+
recoveryEmail: string | null;
|
|
51
|
+
}>;
|
|
52
|
+
httpService: import("../HttpService").HttpService;
|
|
53
|
+
cloudURL: string;
|
|
54
|
+
config: import("../OxyServices.base").OxyConfig;
|
|
55
|
+
makeRequest<T_1>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("../HttpService").RequestOptions): Promise<T_1>;
|
|
56
|
+
getBaseURL(): string;
|
|
57
|
+
getClient(): import("../HttpService").HttpService;
|
|
58
|
+
getMetrics(): {
|
|
59
|
+
totalRequests: number;
|
|
60
|
+
successfulRequests: number;
|
|
61
|
+
failedRequests: number;
|
|
62
|
+
cacheHits: number;
|
|
63
|
+
cacheMisses: number;
|
|
64
|
+
averageResponseTime: number;
|
|
65
|
+
};
|
|
66
|
+
clearCache(): void;
|
|
67
|
+
clearCacheEntry(key: string): void;
|
|
68
|
+
getCacheStats(): {
|
|
69
|
+
size: number;
|
|
70
|
+
hits: number;
|
|
71
|
+
misses: number;
|
|
72
|
+
hitRate: number;
|
|
73
|
+
};
|
|
74
|
+
getCloudURL(): string;
|
|
75
|
+
setTokens(accessToken: string, refreshToken?: string): void;
|
|
76
|
+
clearTokens(): void;
|
|
77
|
+
getCurrentUserId(): string | null;
|
|
78
|
+
hasValidToken(): boolean;
|
|
79
|
+
getAccessToken(): string | null;
|
|
80
|
+
waitForAuth(timeoutMs?: number): Promise<boolean>;
|
|
81
|
+
withAuthRetry<T_1>(operation: () => Promise<T_1>, operationName: string, options?: {
|
|
82
|
+
maxRetries?: number;
|
|
83
|
+
retryDelay?: number;
|
|
84
|
+
authTimeoutMs?: number;
|
|
85
|
+
}): Promise<T_1>;
|
|
86
|
+
validate(): Promise<boolean>;
|
|
87
|
+
handleError(error: unknown): Error;
|
|
88
|
+
healthCheck(): Promise<{
|
|
89
|
+
status: string;
|
|
90
|
+
users?: number;
|
|
91
|
+
timestamp?: string;
|
|
92
|
+
[key: string]: any;
|
|
93
|
+
}>;
|
|
94
|
+
};
|
|
95
|
+
__resetTokensForTests(): void;
|
|
96
|
+
} & T;
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Features Methods Mixin
|
|
3
|
+
*
|
|
4
|
+
* Provides methods for various features:
|
|
5
|
+
* - Feedback submission
|
|
6
|
+
* - Subscription plans
|
|
7
|
+
* - Saves/Collections
|
|
8
|
+
* - User history
|
|
9
|
+
* - FAQ
|
|
10
|
+
* - User stats
|
|
11
|
+
* - Achievements
|
|
12
|
+
*/
|
|
13
|
+
import type { OxyServicesBase } from '../OxyServices.base';
|
|
14
|
+
export interface FeedbackPayload {
|
|
15
|
+
type: 'bug' | 'feature' | 'general' | 'support';
|
|
16
|
+
title: string;
|
|
17
|
+
description: string;
|
|
18
|
+
priority: 'low' | 'medium' | 'high' | 'critical';
|
|
19
|
+
category: string;
|
|
20
|
+
contactEmail?: string;
|
|
21
|
+
systemInfo?: {
|
|
22
|
+
platform: string;
|
|
23
|
+
version: string;
|
|
24
|
+
appVersion: string;
|
|
25
|
+
userId?: string;
|
|
26
|
+
username?: string;
|
|
27
|
+
timestamp: string;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export interface FeedbackResult {
|
|
31
|
+
id: string;
|
|
32
|
+
status: string;
|
|
33
|
+
createdAt: string;
|
|
34
|
+
}
|
|
35
|
+
export interface SubscriptionPlan {
|
|
36
|
+
id: string;
|
|
37
|
+
name: string;
|
|
38
|
+
description: string;
|
|
39
|
+
price: number;
|
|
40
|
+
currency: string;
|
|
41
|
+
interval: 'month' | 'year';
|
|
42
|
+
features: string[];
|
|
43
|
+
}
|
|
44
|
+
export interface SubscriptionResult {
|
|
45
|
+
subscriptionId: string;
|
|
46
|
+
status: string;
|
|
47
|
+
currentPeriodEnd: string;
|
|
48
|
+
}
|
|
49
|
+
export interface SavedItem {
|
|
50
|
+
id: string;
|
|
51
|
+
itemId: string;
|
|
52
|
+
itemType: string;
|
|
53
|
+
title: string;
|
|
54
|
+
createdAt: string;
|
|
55
|
+
}
|
|
56
|
+
export interface Collection {
|
|
57
|
+
id: string;
|
|
58
|
+
name: string;
|
|
59
|
+
description?: string;
|
|
60
|
+
itemCount: number;
|
|
61
|
+
createdAt: string;
|
|
62
|
+
}
|
|
63
|
+
export interface UserStats {
|
|
64
|
+
postCount: number;
|
|
65
|
+
commentCount: number;
|
|
66
|
+
followerCount: number;
|
|
67
|
+
followingCount: number;
|
|
68
|
+
karmaScore?: number;
|
|
69
|
+
}
|
|
70
|
+
export interface HistoryItem {
|
|
71
|
+
id: string;
|
|
72
|
+
type: string;
|
|
73
|
+
title: string;
|
|
74
|
+
timestamp: string;
|
|
75
|
+
metadata?: Record<string, any>;
|
|
76
|
+
}
|
|
77
|
+
export interface FAQ {
|
|
78
|
+
id: string;
|
|
79
|
+
question: string;
|
|
80
|
+
answer: string;
|
|
81
|
+
category: string;
|
|
82
|
+
}
|
|
83
|
+
export interface Achievement {
|
|
84
|
+
id: string;
|
|
85
|
+
name: string;
|
|
86
|
+
description: string;
|
|
87
|
+
icon: string;
|
|
88
|
+
unlockedAt?: string;
|
|
89
|
+
}
|
|
90
|
+
export declare function OxyServicesFeaturesMixin<T extends typeof OxyServicesBase>(Base: T): {
|
|
91
|
+
new (...args: any[]): {
|
|
92
|
+
/**
|
|
93
|
+
* Submit user feedback
|
|
94
|
+
*/
|
|
95
|
+
submitFeedback(payload: FeedbackPayload): Promise<FeedbackResult>;
|
|
96
|
+
/**
|
|
97
|
+
* Get available subscription plans
|
|
98
|
+
*/
|
|
99
|
+
getSubscriptionPlans(): Promise<SubscriptionPlan[]>;
|
|
100
|
+
/**
|
|
101
|
+
* Get individual purchasable features
|
|
102
|
+
*/
|
|
103
|
+
getIndividualFeatures(): Promise<any[]>;
|
|
104
|
+
/**
|
|
105
|
+
* Subscribe to a plan
|
|
106
|
+
*/
|
|
107
|
+
subscribe(planId: string, paymentMethodId?: string): Promise<SubscriptionResult>;
|
|
108
|
+
/**
|
|
109
|
+
* Subscribe to an individual feature
|
|
110
|
+
*/
|
|
111
|
+
subscribeToFeature(featureId: string, paymentMethodId?: string): Promise<SubscriptionResult>;
|
|
112
|
+
/**
|
|
113
|
+
* Cancel subscription
|
|
114
|
+
*/
|
|
115
|
+
cancelSubscription(subscriptionId: string): Promise<void>;
|
|
116
|
+
/**
|
|
117
|
+
* Reactivate subscription
|
|
118
|
+
*/
|
|
119
|
+
reactivateSubscription(subscriptionId: string): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* Get current user's subscription
|
|
122
|
+
*/
|
|
123
|
+
getCurrentSubscription(): Promise<SubscriptionResult | null>;
|
|
124
|
+
/**
|
|
125
|
+
* Get user's saved items
|
|
126
|
+
*/
|
|
127
|
+
getSavedItems(userId?: string): Promise<SavedItem[]>;
|
|
128
|
+
/**
|
|
129
|
+
* Get user's collections
|
|
130
|
+
*/
|
|
131
|
+
getCollections(userId?: string): Promise<Collection[]>;
|
|
132
|
+
/**
|
|
133
|
+
* Save an item
|
|
134
|
+
*/
|
|
135
|
+
saveItem(itemId: string, itemType: string, collectionId?: string): Promise<SavedItem>;
|
|
136
|
+
/**
|
|
137
|
+
* Remove an item from saves
|
|
138
|
+
*/
|
|
139
|
+
removeSavedItem(saveId: string): Promise<void>;
|
|
140
|
+
/**
|
|
141
|
+
* Create a collection
|
|
142
|
+
*/
|
|
143
|
+
createCollection(name: string, description?: string): Promise<Collection>;
|
|
144
|
+
/**
|
|
145
|
+
* Delete a collection
|
|
146
|
+
*/
|
|
147
|
+
deleteCollection(collectionId: string): Promise<void>;
|
|
148
|
+
/**
|
|
149
|
+
* Get user statistics
|
|
150
|
+
*/
|
|
151
|
+
getUserStats(userId: string): Promise<UserStats>;
|
|
152
|
+
/**
|
|
153
|
+
* Get user history
|
|
154
|
+
*/
|
|
155
|
+
getUserHistory(userId?: string, limit?: number, offset?: number): Promise<HistoryItem[]>;
|
|
156
|
+
/**
|
|
157
|
+
* Clear user history
|
|
158
|
+
*/
|
|
159
|
+
clearUserHistory(): Promise<void>;
|
|
160
|
+
/**
|
|
161
|
+
* Delete a history item
|
|
162
|
+
*/
|
|
163
|
+
deleteHistoryItem(itemId: string): Promise<void>;
|
|
164
|
+
/**
|
|
165
|
+
* Get FAQs
|
|
166
|
+
*/
|
|
167
|
+
getFAQs(category?: string): Promise<FAQ[]>;
|
|
168
|
+
/**
|
|
169
|
+
* Search FAQs
|
|
170
|
+
*/
|
|
171
|
+
searchFAQs(query: string): Promise<FAQ[]>;
|
|
172
|
+
/**
|
|
173
|
+
* Get user achievements
|
|
174
|
+
*/
|
|
175
|
+
getUserAchievements(userId?: string): Promise<Achievement[]>;
|
|
176
|
+
/**
|
|
177
|
+
* Get all available achievements
|
|
178
|
+
*/
|
|
179
|
+
getAllAchievements(): Promise<Achievement[]>;
|
|
180
|
+
/**
|
|
181
|
+
* Delete user account (requires password confirmation)
|
|
182
|
+
*/
|
|
183
|
+
deleteAccount(password: string): Promise<void>;
|
|
184
|
+
httpService: import("../HttpService").HttpService;
|
|
185
|
+
cloudURL: string;
|
|
186
|
+
config: import("../OxyServices.base").OxyConfig;
|
|
187
|
+
makeRequest<T_1>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("../HttpService").RequestOptions): Promise<T_1>;
|
|
188
|
+
getBaseURL(): string;
|
|
189
|
+
getClient(): import("../HttpService").HttpService;
|
|
190
|
+
getMetrics(): {
|
|
191
|
+
totalRequests: number;
|
|
192
|
+
successfulRequests: number;
|
|
193
|
+
failedRequests: number;
|
|
194
|
+
cacheHits: number;
|
|
195
|
+
cacheMisses: number;
|
|
196
|
+
averageResponseTime: number;
|
|
197
|
+
};
|
|
198
|
+
clearCache(): void;
|
|
199
|
+
clearCacheEntry(key: string): void;
|
|
200
|
+
getCacheStats(): {
|
|
201
|
+
size: number;
|
|
202
|
+
hits: number;
|
|
203
|
+
misses: number;
|
|
204
|
+
hitRate: number;
|
|
205
|
+
};
|
|
206
|
+
getCloudURL(): string;
|
|
207
|
+
setTokens(accessToken: string, refreshToken?: string): void;
|
|
208
|
+
clearTokens(): void;
|
|
209
|
+
getCurrentUserId(): string | null;
|
|
210
|
+
hasValidToken(): boolean;
|
|
211
|
+
getAccessToken(): string | null;
|
|
212
|
+
waitForAuth(timeoutMs?: number): Promise<boolean>;
|
|
213
|
+
withAuthRetry<T_1>(operation: () => Promise<T_1>, operationName: string, options?: {
|
|
214
|
+
maxRetries?: number;
|
|
215
|
+
retryDelay?: number;
|
|
216
|
+
authTimeoutMs?: number;
|
|
217
|
+
}): Promise<T_1>;
|
|
218
|
+
validate(): Promise<boolean>;
|
|
219
|
+
handleError(error: unknown): Error;
|
|
220
|
+
healthCheck(): Promise<{
|
|
221
|
+
status: string;
|
|
222
|
+
users?: number;
|
|
223
|
+
timestamp?: string;
|
|
224
|
+
[key: string]: any;
|
|
225
|
+
}>;
|
|
226
|
+
};
|
|
227
|
+
__resetTokensForTests(): void;
|
|
228
|
+
} & T;
|