@oxyhq/services 5.16.34 → 5.16.36
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 +8 -26
- package/lib/commonjs/core/OxyServices.base.js.map +1 -1
- package/lib/commonjs/core/mixins/OxyServices.user.js.map +1 -1
- package/lib/commonjs/core/mixins/OxyServices.utility.js.map +1 -1
- package/lib/commonjs/crypto/README.md +142 -0
- package/lib/commonjs/crypto/core.js +147 -0
- package/lib/commonjs/crypto/core.js.map +1 -0
- package/lib/commonjs/crypto/index.js +16 -0
- package/lib/commonjs/crypto/index.js.map +1 -1
- package/lib/commonjs/crypto/keyManager.js +19 -24
- package/lib/commonjs/crypto/keyManager.js.map +1 -1
- package/lib/commonjs/crypto/signatureService.js +116 -37
- package/lib/commonjs/crypto/signatureService.js.map +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/interfaces.js +10 -11
- package/lib/commonjs/models/interfaces.js.map +1 -1
- package/lib/commonjs/node/index.js +10 -1
- package/lib/commonjs/node/index.js.map +1 -1
- package/lib/commonjs/node/signatureService.js +107 -0
- package/lib/commonjs/node/signatureService.js.map +1 -0
- package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
- package/lib/commonjs/ui/context/hooks/useAuthOperations.js.map +1 -1
- package/lib/commonjs/ui/context/hooks/useLanguageManagement.js.map +1 -1
- package/lib/commonjs/ui/hooks/useLanguageManagement.js.map +1 -1
- package/lib/commonjs/ui/hooks/useSessionManagement.js.map +1 -1
- package/lib/commonjs/ui/index.js +0 -2
- package/lib/commonjs/ui/index.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/OxyAuthScreen.js +13 -9
- package/lib/commonjs/ui/screens/OxyAuthScreen.js.map +1 -1
- package/lib/module/core/OxyServices.base.js.map +1 -1
- package/lib/module/core/mixins/OxyServices.user.js.map +1 -1
- package/lib/module/core/mixins/OxyServices.utility.js.map +1 -1
- package/lib/module/crypto/README.md +142 -0
- package/lib/module/crypto/core.js +133 -0
- package/lib/module/crypto/core.js.map +1 -0
- package/lib/module/crypto/index.js +3 -9
- package/lib/module/crypto/index.js.map +1 -1
- package/lib/module/crypto/keyManager.js +19 -24
- package/lib/module/crypto/keyManager.js.map +1 -1
- package/lib/module/crypto/signatureService.js +113 -33
- package/lib/module/crypto/signatureService.js.map +1 -1
- package/lib/module/index.js +0 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/interfaces.js +10 -11
- package/lib/module/models/interfaces.js.map +1 -1
- package/lib/module/node/index.js +3 -0
- package/lib/module/node/index.js.map +1 -1
- package/lib/module/node/signatureService.js +101 -0
- package/lib/module/node/signatureService.js.map +1 -0
- package/lib/module/ui/context/OxyContext.js.map +1 -1
- package/lib/module/ui/context/hooks/useAuthOperations.js.map +1 -1
- package/lib/module/ui/context/hooks/useLanguageManagement.js.map +1 -1
- package/lib/module/ui/hooks/useLanguageManagement.js.map +1 -1
- package/lib/module/ui/hooks/useSessionManagement.js.map +1 -1
- package/lib/module/ui/index.js +0 -1
- package/lib/module/ui/index.js.map +1 -1
- package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
- package/lib/module/ui/screens/OxyAuthScreen.js +9 -7
- package/lib/module/ui/screens/OxyAuthScreen.js.map +1 -1
- package/lib/typescript/core/OxyServices.base.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.analytics.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.assets.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.auth.d.ts +1 -1
- package/lib/typescript/core/mixins/OxyServices.auth.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.developer.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.devices.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.karma.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.language.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.location.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.payment.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.privacy.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.security.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.user.d.ts +1 -2
- package/lib/typescript/core/mixins/OxyServices.user.d.ts.map +1 -1
- package/lib/typescript/core/mixins/OxyServices.utility.d.ts.map +1 -1
- package/lib/typescript/core/mixins/index.d.ts +13 -13
- package/lib/typescript/core/mixins/index.d.ts.map +1 -1
- package/lib/typescript/core/services/SessionService.d.ts +1 -1
- package/lib/typescript/core/services/SessionService.d.ts.map +1 -1
- package/lib/typescript/crypto/core.d.ts +56 -0
- package/lib/typescript/crypto/core.d.ts.map +1 -0
- package/lib/typescript/crypto/index.d.ts +1 -9
- package/lib/typescript/crypto/index.d.ts.map +1 -1
- package/lib/typescript/crypto/keyManager.d.ts +13 -1
- package/lib/typescript/crypto/keyManager.d.ts.map +1 -1
- package/lib/typescript/crypto/signatureService.d.ts +15 -9
- package/lib/typescript/crypto/signatureService.d.ts.map +1 -1
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/models/interfaces.d.ts +68 -15
- package/lib/typescript/models/interfaces.d.ts.map +1 -1
- package/lib/typescript/node/index.d.ts +1 -0
- package/lib/typescript/node/index.d.ts.map +1 -1
- package/lib/typescript/node/signatureService.d.ts +55 -0
- package/lib/typescript/node/signatureService.d.ts.map +1 -0
- package/lib/typescript/ui/context/OxyContext.d.ts +1 -2
- package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
- package/lib/typescript/ui/context/hooks/useAuthOperations.d.ts +1 -2
- package/lib/typescript/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
- package/lib/typescript/ui/context/hooks/useLanguageManagement.d.ts +1 -2
- package/lib/typescript/ui/context/hooks/useLanguageManagement.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/mutations/useAccountMutations.d.ts +1 -1
- package/lib/typescript/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/queries/useAccountQueries.d.ts +1 -1
- package/lib/typescript/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/useLanguageManagement.d.ts +1 -2
- package/lib/typescript/ui/hooks/useLanguageManagement.d.ts.map +1 -1
- package/lib/typescript/ui/hooks/useSessionManagement.d.ts +1 -2
- package/lib/typescript/ui/hooks/useSessionManagement.d.ts.map +1 -1
- package/lib/typescript/ui/index.d.ts +1 -1
- package/lib/typescript/ui/index.d.ts.map +1 -1
- package/lib/typescript/ui/screens/OxyAuthScreen.d.ts.map +1 -1
- package/lib/typescript/ui/stores/authStore.d.ts +1 -1
- package/lib/typescript/ui/stores/authStore.d.ts.map +1 -1
- package/lib/typescript/ui/utils/avatarUtils.d.ts +1 -1
- package/lib/typescript/ui/utils/avatarUtils.d.ts.map +1 -1
- package/package.json +6 -2
- package/src/core/OxyServices.base.ts +1 -2
- package/src/core/mixins/OxyServices.auth.ts +1 -1
- package/src/core/mixins/OxyServices.user.ts +1 -2
- package/src/core/mixins/OxyServices.utility.ts +1 -2
- package/src/core/services/SessionService.ts +1 -1
- package/src/crypto/README.md +142 -0
- package/src/crypto/__tests__/core.test.ts +203 -0
- package/src/crypto/core.ts +142 -0
- package/src/crypto/index.ts +3 -10
- package/src/crypto/keyManager.ts +25 -21
- package/src/crypto/signatureService.ts +137 -37
- package/src/index.ts +2 -1
- package/src/models/interfaces.ts +73 -21
- package/src/node/index.ts +3 -0
- package/src/node/signatureService.ts +126 -0
- package/src/ui/context/OxyContext.tsx +1 -2
- package/src/ui/context/hooks/useAuthOperations.ts +1 -2
- package/src/ui/context/hooks/useLanguageManagement.ts +1 -2
- package/src/ui/hooks/auth/index.ts +2 -0
- package/src/ui/hooks/mutations/useAccountMutations.ts +1 -1
- package/src/ui/hooks/mutations/useServicesMutations.ts +1 -1
- package/src/ui/hooks/queries/useAccountQueries.ts +1 -1
- package/src/ui/hooks/useLanguageManagement.ts +1 -2
- package/src/ui/hooks/useSessionManagement.ts +1 -2
- package/src/ui/index.ts +1 -2
- package/src/ui/screens/AccountSettingsScreen.tsx +6 -6
- package/src/ui/screens/AccountSwitcherScreen.tsx +1 -1
- package/src/ui/screens/OxyAuthScreen.tsx +9 -5
- package/src/ui/screens/ProfileScreen.tsx +1 -1
- package/src/ui/stores/authStore.ts +1 -1
- package/src/ui/types/navigation.ts +1 -1
- package/src/ui/utils/avatarUtils.ts +1 -1
- package/lib/commonjs/core/services/AuthService.js +0 -156
- package/lib/commonjs/core/services/AuthService.js.map +0 -1
- package/lib/commonjs/core/services/SessionTransportService.js +0 -64
- package/lib/commonjs/core/services/SessionTransportService.js.map +0 -1
- package/lib/commonjs/core/services/UserService.js +0 -123
- package/lib/commonjs/core/services/UserService.js.map +0 -1
- package/lib/commonjs/core/services/index.js +0 -34
- package/lib/commonjs/core/services/index.js.map +0 -1
- package/lib/module/core/services/AuthService.js +0 -151
- package/lib/module/core/services/AuthService.js.map +0 -1
- package/lib/module/core/services/SessionTransportService.js +0 -59
- package/lib/module/core/services/SessionTransportService.js.map +0 -1
- package/lib/module/core/services/UserService.js +0 -118
- package/lib/module/core/services/UserService.js.map +0 -1
- package/lib/module/core/services/index.js +0 -16
- package/lib/module/core/services/index.js.map +0 -1
- package/lib/typescript/core/services/AuthService.d.ts +0 -50
- package/lib/typescript/core/services/AuthService.d.ts.map +0 -1
- package/lib/typescript/core/services/SessionTransportService.d.ts +0 -31
- package/lib/typescript/core/services/SessionTransportService.d.ts.map +0 -1
- package/lib/typescript/core/services/UserService.d.ts +0 -39
- package/lib/typescript/core/services/UserService.d.ts.map +0 -1
- package/lib/typescript/core/services/index.d.ts +0 -13
- package/lib/typescript/core/services/index.d.ts.map +0 -1
- package/src/core/services/AuthService.ts +0 -153
- package/src/core/services/SessionTransportService.ts +0 -69
- package/src/core/services/UserService.ts +0 -125
- package/src/core/services/index.ts +0 -14
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["TransportFactory","SessionTransportService","transport","constructor","config","connect","sessionToken","callbacks","transportConfig","baseURL","namespace","pollingInterval","reconnectAttempts","reconnectDelay","create","disconnect","isConnected","getTransportType","getType"],"sourceRoot":"../../../../src","sources":["core/services/SessionTransportService.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;;AAGA,SACEA,gBAAgB,QAIX,eAAe;AAEtB,OAAO,MAAMC,uBAAuB,CAAC;EAC3BC,SAAS,GAAQ,IAAI;EAG7BC,WAAWA,CAACC,MAAiB,EAAE;IAC7B,IAAI,CAACA,MAAM,GAAGA,MAAM;EACtB;;EAEA;AACF;AACA;AACA;EACE,MAAMC,OAAOA,CACXC,YAAoB,EACpBC,SAA6B,EACd;IACf,MAAMC,eAAgC,GAAG;MACvCC,OAAO,EAAE,IAAI,CAACL,MAAM,CAACK,OAAO;MAC5BC,SAAS,EAAE,cAAc;MACzBJ,YAAY;MACZK,eAAe,EAAE,IAAI;MAAE;MACvBC,iBAAiB,EAAE,CAAC;MACpBC,cAAc,EAAE;IAClB,CAAC;IAED,IAAI,CAACX,SAAS,GAAG,MAAMF,gBAAgB,CAACc,MAAM,CAACN,eAAe,EAAED,SAAS,CAAC;IAC1E,MAAM,IAAI,CAACL,SAAS,CAACG,OAAO,CAAC,CAAC;EAChC;;EAEA;AACF;AACA;EACEU,UAAUA,CAAA,EAAS;IACjB,IAAI,IAAI,CAACb,SAAS,EAAE;MAClB,IAAI,CAACA,SAAS,CAACa,UAAU,CAAC,CAAC;MAC3B,IAAI,CAACb,SAAS,GAAG,IAAI;IACvB;EACF;;EAEA;AACF;AACA;EACEc,WAAWA,CAAA,EAAY;IACrB,OAAO,IAAI,CAACd,SAAS,EAAEc,WAAW,CAAC,CAAC,IAAI,KAAK;EAC/C;;EAEA;AACF;AACA;EACEC,gBAAgBA,CAAA,EAAW;IACzB,OAAO,IAAI,CAACf,SAAS,EAAEgB,OAAO,CAAC,CAAC,IAAI,MAAM;EAC5C;AACF","ignoreList":[]}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* User Service
|
|
5
|
-
*
|
|
6
|
-
* Handles user profile operations (no key handling):
|
|
7
|
-
* - Profile fetch/update
|
|
8
|
-
* - Profile search
|
|
9
|
-
* - User recommendations
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import { HttpService } from '../HttpService';
|
|
13
|
-
export class UserService {
|
|
14
|
-
constructor(config) {
|
|
15
|
-
this.httpService = new HttpService(config);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Get user profile by ID
|
|
20
|
-
*/
|
|
21
|
-
async getUserById(userId) {
|
|
22
|
-
try {
|
|
23
|
-
return await this.httpService.request({
|
|
24
|
-
method: 'GET',
|
|
25
|
-
url: `/api/profiles/${userId}`,
|
|
26
|
-
cache: true,
|
|
27
|
-
cacheTTL: 5 * 60 * 1000
|
|
28
|
-
});
|
|
29
|
-
} catch (error) {
|
|
30
|
-
throw error;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Get profile by username
|
|
36
|
-
*/
|
|
37
|
-
async getProfileByUsername(username) {
|
|
38
|
-
try {
|
|
39
|
-
return await this.httpService.request({
|
|
40
|
-
method: 'GET',
|
|
41
|
-
url: `/api/profiles/username/${username}`,
|
|
42
|
-
cache: true,
|
|
43
|
-
cacheTTL: 5 * 60 * 1000
|
|
44
|
-
});
|
|
45
|
-
} catch (error) {
|
|
46
|
-
throw error;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Search user profiles
|
|
52
|
-
*/
|
|
53
|
-
async searchProfiles(query, pagination) {
|
|
54
|
-
try {
|
|
55
|
-
const params = new URLSearchParams();
|
|
56
|
-
params.set('query', query);
|
|
57
|
-
if (pagination?.limit) params.set('limit', pagination.limit.toString());
|
|
58
|
-
if (pagination?.offset) params.set('offset', pagination.offset.toString());
|
|
59
|
-
const response = await this.httpService.request({
|
|
60
|
-
method: 'GET',
|
|
61
|
-
url: `/api/profiles/search?${params.toString()}`,
|
|
62
|
-
cache: true,
|
|
63
|
-
cacheTTL: 2 * 60 * 1000
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
// Handle response format
|
|
67
|
-
if (Array.isArray(response)) {
|
|
68
|
-
const limit = pagination?.limit ?? response.length;
|
|
69
|
-
const paginationInfo = {
|
|
70
|
-
total: response.length,
|
|
71
|
-
limit,
|
|
72
|
-
offset: pagination?.offset ?? 0,
|
|
73
|
-
hasMore: limit > 0 && response.length === limit
|
|
74
|
-
};
|
|
75
|
-
return {
|
|
76
|
-
data: response,
|
|
77
|
-
pagination: paginationInfo
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
return response;
|
|
81
|
-
} catch (error) {
|
|
82
|
-
throw error;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Get profile recommendations
|
|
88
|
-
*/
|
|
89
|
-
async getProfileRecommendations() {
|
|
90
|
-
try {
|
|
91
|
-
return await this.httpService.request({
|
|
92
|
-
method: 'GET',
|
|
93
|
-
url: '/api/profiles/recommendations',
|
|
94
|
-
cache: true,
|
|
95
|
-
cacheTTL: 5 * 60 * 1000
|
|
96
|
-
});
|
|
97
|
-
} catch (error) {
|
|
98
|
-
throw error;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Update user profile
|
|
104
|
-
*/
|
|
105
|
-
async updateProfile(updates) {
|
|
106
|
-
try {
|
|
107
|
-
return await this.httpService.request({
|
|
108
|
-
method: 'PATCH',
|
|
109
|
-
url: '/api/profiles/me',
|
|
110
|
-
data: updates,
|
|
111
|
-
cache: false
|
|
112
|
-
});
|
|
113
|
-
} catch (error) {
|
|
114
|
-
throw error;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
//# sourceMappingURL=UserService.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["HttpService","UserService","constructor","config","httpService","getUserById","userId","request","method","url","cache","cacheTTL","error","getProfileByUsername","username","searchProfiles","query","pagination","params","URLSearchParams","set","limit","toString","offset","response","Array","isArray","length","paginationInfo","total","hasMore","data","getProfileRecommendations","updateProfile","updates"],"sourceRoot":"../../../../src","sources":["core/services/UserService.ts"],"mappings":"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","ignoreList":[]}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Focused Services
|
|
5
|
-
*
|
|
6
|
-
* Single-responsibility services replacing the mixin pattern:
|
|
7
|
-
* - AuthService: Authentication, challenges, registration
|
|
8
|
-
* - SessionService: Session management (already exists)
|
|
9
|
-
* - UserService: User profile operations
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
export { AuthService } from './AuthService';
|
|
13
|
-
export { sessionService } from './SessionService';
|
|
14
|
-
export { UserService } from './UserService';
|
|
15
|
-
export { tokenService } from './TokenService';
|
|
16
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["AuthService","sessionService","UserService","tokenService"],"sourceRoot":"../../../../src","sources":["core/services/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,WAAW,QAAQ,eAAe;AAC3C,SAASC,cAAc,QAAQ,kBAAkB;AACjD,SAASC,WAAW,QAAQ,eAAe;AAC3C,SAASC,YAAY,QAAQ,gBAAgB","ignoreList":[]}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Auth Service
|
|
3
|
-
*
|
|
4
|
-
* Handles authentication operations:
|
|
5
|
-
* - Challenge retrieval
|
|
6
|
-
* - Signing orchestration (delegated to Accounts/KeyManager)
|
|
7
|
-
* - Session verification
|
|
8
|
-
* - Access token retrieval
|
|
9
|
-
* - Registration
|
|
10
|
-
*/
|
|
11
|
-
import type { OxyConfig } from '../../models/interfaces';
|
|
12
|
-
import type { User, LoginResponse, ChallengePayload } from '@oxyhq/shared';
|
|
13
|
-
export interface PublicKeyCheckResponse {
|
|
14
|
-
registered: boolean;
|
|
15
|
-
message: string;
|
|
16
|
-
}
|
|
17
|
-
export declare class AuthService {
|
|
18
|
-
private httpService;
|
|
19
|
-
constructor(config: OxyConfig);
|
|
20
|
-
/**
|
|
21
|
-
* Check if a public key is registered on the server
|
|
22
|
-
*/
|
|
23
|
-
checkPublicKeyRegistered(publicKey: string): Promise<PublicKeyCheckResponse>;
|
|
24
|
-
/**
|
|
25
|
-
* Request an authentication challenge
|
|
26
|
-
*/
|
|
27
|
-
requestChallenge(publicKey: string): Promise<ChallengePayload>;
|
|
28
|
-
/**
|
|
29
|
-
* Verify a challenge and authenticate (creates session)
|
|
30
|
-
* This orchestrates signing via SignatureService (which uses KeyManager)
|
|
31
|
-
*/
|
|
32
|
-
verifyChallenge(challenge: string): Promise<LoginResponse>;
|
|
33
|
-
/**
|
|
34
|
-
* Register a new identity with the server
|
|
35
|
-
*/
|
|
36
|
-
register(publicKey: string, signature: string, timestamp: number, username?: string, email?: string): Promise<User>;
|
|
37
|
-
/**
|
|
38
|
-
* Register using current identity (signs automatically)
|
|
39
|
-
*/
|
|
40
|
-
registerCurrentIdentity(username?: string, email?: string): Promise<User>;
|
|
41
|
-
/**
|
|
42
|
-
* Get user by public key
|
|
43
|
-
*/
|
|
44
|
-
getUserByPublicKey(publicKey: string): Promise<User>;
|
|
45
|
-
/**
|
|
46
|
-
* Get user by session ID
|
|
47
|
-
*/
|
|
48
|
-
getUserBySession(sessionId: string): Promise<User>;
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=AuthService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AuthService.d.ts","sourceRoot":"","sources":["../../../../src/core/services/AuthService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAI3E,MAAM,WAAW,sBAAsB;IACrC,UAAU,EAAE,OAAO,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,WAAW,CAAc;gBAErB,MAAM,EAAE,SAAS;IAI7B;;OAEG;IACG,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAalF;;OAEG;IACG,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAapE;;;OAGG;IACG,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAsBhE;;OAEG;IACG,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBzH;;OAEG;IACG,uBAAuB,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAS/E;;OAEG;IACG,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAa1D;;OAEG;IACG,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAYzD"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session Transport Service
|
|
3
|
-
*
|
|
4
|
-
* Uses shared transport abstraction for WebSocket/SSE/polling
|
|
5
|
-
* Provides unified interface for session status updates
|
|
6
|
-
*/
|
|
7
|
-
import type { OxyConfig } from '../../models/interfaces';
|
|
8
|
-
import { type TransportCallbacks } from '@oxyhq/shared';
|
|
9
|
-
export declare class SessionTransportService {
|
|
10
|
-
private transport;
|
|
11
|
-
private config;
|
|
12
|
-
constructor(config: OxyConfig);
|
|
13
|
-
/**
|
|
14
|
-
* Connect to session status updates
|
|
15
|
-
* Automatically chooses best available transport (WebSocket > SSE > Polling)
|
|
16
|
-
*/
|
|
17
|
-
connect(sessionToken: string, callbacks: TransportCallbacks): Promise<void>;
|
|
18
|
-
/**
|
|
19
|
-
* Disconnect from session updates
|
|
20
|
-
*/
|
|
21
|
-
disconnect(): void;
|
|
22
|
-
/**
|
|
23
|
-
* Check if currently connected
|
|
24
|
-
*/
|
|
25
|
-
isConnected(): boolean;
|
|
26
|
-
/**
|
|
27
|
-
* Get the transport type being used
|
|
28
|
-
*/
|
|
29
|
-
getTransportType(): string;
|
|
30
|
-
}
|
|
31
|
-
//# sourceMappingURL=SessionTransportService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SessionTransportService.d.ts","sourceRoot":"","sources":["../../../../src/core/services/SessionTransportService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAGL,KAAK,kBAAkB,EAExB,MAAM,eAAe,CAAC;AAEvB,qBAAa,uBAAuB;IAClC,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,MAAM,CAAY;gBAEd,MAAM,EAAE,SAAS;IAI7B;;;OAGG;IACG,OAAO,CACX,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,kBAAkB,GAC5B,OAAO,CAAC,IAAI,CAAC;IAchB;;OAEG;IACH,UAAU,IAAI,IAAI;IAOlB;;OAEG;IACH,WAAW,IAAI,OAAO;IAItB;;OAEG;IACH,gBAAgB,IAAI,MAAM;CAG3B"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* User Service
|
|
3
|
-
*
|
|
4
|
-
* Handles user profile operations (no key handling):
|
|
5
|
-
* - Profile fetch/update
|
|
6
|
-
* - Profile search
|
|
7
|
-
* - User recommendations
|
|
8
|
-
*/
|
|
9
|
-
import type { OxyConfig } from '../../models/interfaces';
|
|
10
|
-
import type { User, SearchProfilesResponse } from '@oxyhq/shared';
|
|
11
|
-
export interface PaginationParams {
|
|
12
|
-
limit?: number;
|
|
13
|
-
offset?: number;
|
|
14
|
-
}
|
|
15
|
-
export declare class UserService {
|
|
16
|
-
private httpService;
|
|
17
|
-
constructor(config: OxyConfig);
|
|
18
|
-
/**
|
|
19
|
-
* Get user profile by ID
|
|
20
|
-
*/
|
|
21
|
-
getUserById(userId: string): Promise<User>;
|
|
22
|
-
/**
|
|
23
|
-
* Get profile by username
|
|
24
|
-
*/
|
|
25
|
-
getProfileByUsername(username: string): Promise<User>;
|
|
26
|
-
/**
|
|
27
|
-
* Search user profiles
|
|
28
|
-
*/
|
|
29
|
-
searchProfiles(query: string, pagination?: PaginationParams): Promise<SearchProfilesResponse>;
|
|
30
|
-
/**
|
|
31
|
-
* Get profile recommendations
|
|
32
|
-
*/
|
|
33
|
-
getProfileRecommendations(): Promise<User[]>;
|
|
34
|
-
/**
|
|
35
|
-
* Update user profile
|
|
36
|
-
*/
|
|
37
|
-
updateProfile(updates: Partial<User>): Promise<User>;
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=UserService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UserService.d.ts","sourceRoot":"","sources":["../../../../src/core/services/UserService.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,KAAK,EAAE,IAAI,EAAE,sBAAsB,EAAkB,MAAM,eAAe,CAAC;AAGlF,MAAM,WAAW,gBAAgB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,WAAW,CAAc;gBAErB,MAAM,EAAE,SAAS;IAI7B;;OAEG;IACG,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAahD;;OAEG;IACG,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAa3D;;OAEG;IACG,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAgCnG;;OAEG;IACG,yBAAyB,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;IAalD;;OAEG;IACG,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAY3D"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Focused Services
|
|
3
|
-
*
|
|
4
|
-
* Single-responsibility services replacing the mixin pattern:
|
|
5
|
-
* - AuthService: Authentication, challenges, registration
|
|
6
|
-
* - SessionService: Session management (already exists)
|
|
7
|
-
* - UserService: User profile operations
|
|
8
|
-
*/
|
|
9
|
-
export { AuthService } from './AuthService';
|
|
10
|
-
export { sessionService } from './SessionService';
|
|
11
|
-
export { UserService } from './UserService';
|
|
12
|
-
export { tokenService } from './TokenService';
|
|
13
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/services/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Auth Service
|
|
3
|
-
*
|
|
4
|
-
* Handles authentication operations:
|
|
5
|
-
* - Challenge retrieval
|
|
6
|
-
* - Signing orchestration (delegated to Accounts/KeyManager)
|
|
7
|
-
* - Session verification
|
|
8
|
-
* - Access token retrieval
|
|
9
|
-
* - Registration
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
import type { OxyConfig } from '../../models/interfaces';
|
|
13
|
-
import type { User, LoginResponse, ChallengePayload } from '@oxyhq/shared';
|
|
14
|
-
import { HttpService } from '../HttpService';
|
|
15
|
-
import { SignatureService } from '../../crypto/signatureService';
|
|
16
|
-
|
|
17
|
-
export interface PublicKeyCheckResponse {
|
|
18
|
-
registered: boolean;
|
|
19
|
-
message: string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export class AuthService {
|
|
23
|
-
private httpService: HttpService;
|
|
24
|
-
|
|
25
|
-
constructor(config: OxyConfig) {
|
|
26
|
-
this.httpService = new HttpService(config);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Check if a public key is registered on the server
|
|
31
|
-
*/
|
|
32
|
-
async checkPublicKeyRegistered(publicKey: string): Promise<PublicKeyCheckResponse> {
|
|
33
|
-
try {
|
|
34
|
-
return await this.httpService.request<PublicKeyCheckResponse>({
|
|
35
|
-
method: 'GET',
|
|
36
|
-
url: `/api/auth/check-publickey?publicKey=${encodeURIComponent(publicKey)}`,
|
|
37
|
-
cache: true,
|
|
38
|
-
cacheTTL: 2 * 60 * 1000,
|
|
39
|
-
});
|
|
40
|
-
} catch (error) {
|
|
41
|
-
throw error;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Request an authentication challenge
|
|
47
|
-
*/
|
|
48
|
-
async requestChallenge(publicKey: string): Promise<ChallengePayload> {
|
|
49
|
-
try {
|
|
50
|
-
return await this.httpService.request<ChallengePayload>({
|
|
51
|
-
method: 'POST',
|
|
52
|
-
url: '/api/auth/challenge',
|
|
53
|
-
data: { publicKey },
|
|
54
|
-
cache: false,
|
|
55
|
-
});
|
|
56
|
-
} catch (error) {
|
|
57
|
-
throw error;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Verify a challenge and authenticate (creates session)
|
|
63
|
-
* This orchestrates signing via SignatureService (which uses KeyManager)
|
|
64
|
-
*/
|
|
65
|
-
async verifyChallenge(challenge: string): Promise<LoginResponse> {
|
|
66
|
-
try {
|
|
67
|
-
// Sign the challenge using SignatureService (requires private key)
|
|
68
|
-
const signedChallenge = await SignatureService.signChallenge(challenge);
|
|
69
|
-
|
|
70
|
-
// Verify challenge and get session
|
|
71
|
-
return await this.httpService.request<LoginResponse>({
|
|
72
|
-
method: 'POST',
|
|
73
|
-
url: '/api/auth/verify',
|
|
74
|
-
data: {
|
|
75
|
-
publicKey: signedChallenge.publicKey,
|
|
76
|
-
challenge: challenge,
|
|
77
|
-
signature: signedChallenge.challenge,
|
|
78
|
-
timestamp: signedChallenge.timestamp,
|
|
79
|
-
},
|
|
80
|
-
cache: false,
|
|
81
|
-
});
|
|
82
|
-
} catch (error) {
|
|
83
|
-
throw error;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Register a new identity with the server
|
|
89
|
-
*/
|
|
90
|
-
async register(publicKey: string, signature: string, timestamp: number, username?: string, email?: string): Promise<User> {
|
|
91
|
-
try {
|
|
92
|
-
return await this.httpService.request<User>({
|
|
93
|
-
method: 'POST',
|
|
94
|
-
url: '/api/auth/register',
|
|
95
|
-
data: {
|
|
96
|
-
publicKey,
|
|
97
|
-
signature,
|
|
98
|
-
timestamp,
|
|
99
|
-
username,
|
|
100
|
-
email,
|
|
101
|
-
},
|
|
102
|
-
cache: false,
|
|
103
|
-
});
|
|
104
|
-
} catch (error) {
|
|
105
|
-
throw error;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Register using current identity (signs automatically)
|
|
111
|
-
*/
|
|
112
|
-
async registerCurrentIdentity(username?: string, email?: string): Promise<User> {
|
|
113
|
-
try {
|
|
114
|
-
const { signature, publicKey, timestamp } = await SignatureService.createRegistrationSignature();
|
|
115
|
-
return this.register(publicKey, signature, timestamp, username, email);
|
|
116
|
-
} catch (error) {
|
|
117
|
-
throw error;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Get user by public key
|
|
123
|
-
*/
|
|
124
|
-
async getUserByPublicKey(publicKey: string): Promise<User> {
|
|
125
|
-
try {
|
|
126
|
-
return await this.httpService.request<User>({
|
|
127
|
-
method: 'GET',
|
|
128
|
-
url: `/api/auth/user/${encodeURIComponent(publicKey)}`,
|
|
129
|
-
cache: true,
|
|
130
|
-
cacheTTL: 2 * 60 * 1000,
|
|
131
|
-
});
|
|
132
|
-
} catch (error) {
|
|
133
|
-
throw error;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Get user by session ID
|
|
139
|
-
*/
|
|
140
|
-
async getUserBySession(sessionId: string): Promise<User> {
|
|
141
|
-
try {
|
|
142
|
-
return await this.httpService.request<User>({
|
|
143
|
-
method: 'GET',
|
|
144
|
-
url: `/api/auth/user/session/${encodeURIComponent(sessionId)}`,
|
|
145
|
-
cache: true,
|
|
146
|
-
cacheTTL: 2 * 60 * 1000,
|
|
147
|
-
});
|
|
148
|
-
} catch (error) {
|
|
149
|
-
throw error;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Session Transport Service
|
|
3
|
-
*
|
|
4
|
-
* Uses shared transport abstraction for WebSocket/SSE/polling
|
|
5
|
-
* Provides unified interface for session status updates
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import type { OxyConfig } from '../../models/interfaces';
|
|
9
|
-
import {
|
|
10
|
-
TransportFactory,
|
|
11
|
-
type TransportConfig,
|
|
12
|
-
type TransportCallbacks,
|
|
13
|
-
type TransportUpdate,
|
|
14
|
-
} from '@oxyhq/shared';
|
|
15
|
-
|
|
16
|
-
export class SessionTransportService {
|
|
17
|
-
private transport: any = null;
|
|
18
|
-
private config: OxyConfig;
|
|
19
|
-
|
|
20
|
-
constructor(config: OxyConfig) {
|
|
21
|
-
this.config = config;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Connect to session status updates
|
|
26
|
-
* Automatically chooses best available transport (WebSocket > SSE > Polling)
|
|
27
|
-
*/
|
|
28
|
-
async connect(
|
|
29
|
-
sessionToken: string,
|
|
30
|
-
callbacks: TransportCallbacks
|
|
31
|
-
): Promise<void> {
|
|
32
|
-
const transportConfig: TransportConfig = {
|
|
33
|
-
baseURL: this.config.baseURL,
|
|
34
|
-
namespace: 'auth-session',
|
|
35
|
-
sessionToken,
|
|
36
|
-
pollingInterval: 3000, // 3 seconds
|
|
37
|
-
reconnectAttempts: 3,
|
|
38
|
-
reconnectDelay: 1000,
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
this.transport = await TransportFactory.create(transportConfig, callbacks);
|
|
42
|
-
await this.transport.connect();
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Disconnect from session updates
|
|
47
|
-
*/
|
|
48
|
-
disconnect(): void {
|
|
49
|
-
if (this.transport) {
|
|
50
|
-
this.transport.disconnect();
|
|
51
|
-
this.transport = null;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Check if currently connected
|
|
57
|
-
*/
|
|
58
|
-
isConnected(): boolean {
|
|
59
|
-
return this.transport?.isConnected() ?? false;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Get the transport type being used
|
|
64
|
-
*/
|
|
65
|
-
getTransportType(): string {
|
|
66
|
-
return this.transport?.getType() ?? 'none';
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* User Service
|
|
3
|
-
*
|
|
4
|
-
* Handles user profile operations (no key handling):
|
|
5
|
-
* - Profile fetch/update
|
|
6
|
-
* - Profile search
|
|
7
|
-
* - User recommendations
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import type { OxyConfig } from '../../models/interfaces';
|
|
11
|
-
import type { User, SearchProfilesResponse, PaginationInfo } from '@oxyhq/shared';
|
|
12
|
-
import { HttpService } from '../HttpService';
|
|
13
|
-
|
|
14
|
-
export interface PaginationParams {
|
|
15
|
-
limit?: number;
|
|
16
|
-
offset?: number;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export class UserService {
|
|
20
|
-
private httpService: HttpService;
|
|
21
|
-
|
|
22
|
-
constructor(config: OxyConfig) {
|
|
23
|
-
this.httpService = new HttpService(config);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Get user profile by ID
|
|
28
|
-
*/
|
|
29
|
-
async getUserById(userId: string): Promise<User> {
|
|
30
|
-
try {
|
|
31
|
-
return await this.httpService.request<User>({
|
|
32
|
-
method: 'GET',
|
|
33
|
-
url: `/api/profiles/${userId}`,
|
|
34
|
-
cache: true,
|
|
35
|
-
cacheTTL: 5 * 60 * 1000,
|
|
36
|
-
});
|
|
37
|
-
} catch (error) {
|
|
38
|
-
throw error;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Get profile by username
|
|
44
|
-
*/
|
|
45
|
-
async getProfileByUsername(username: string): Promise<User> {
|
|
46
|
-
try {
|
|
47
|
-
return await this.httpService.request<User>({
|
|
48
|
-
method: 'GET',
|
|
49
|
-
url: `/api/profiles/username/${username}`,
|
|
50
|
-
cache: true,
|
|
51
|
-
cacheTTL: 5 * 60 * 1000,
|
|
52
|
-
});
|
|
53
|
-
} catch (error) {
|
|
54
|
-
throw error;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* Search user profiles
|
|
60
|
-
*/
|
|
61
|
-
async searchProfiles(query: string, pagination?: PaginationParams): Promise<SearchProfilesResponse> {
|
|
62
|
-
try {
|
|
63
|
-
const params = new URLSearchParams();
|
|
64
|
-
params.set('query', query);
|
|
65
|
-
if (pagination?.limit) params.set('limit', pagination.limit.toString());
|
|
66
|
-
if (pagination?.offset) params.set('offset', pagination.offset.toString());
|
|
67
|
-
|
|
68
|
-
const response = await this.httpService.request<SearchProfilesResponse | User[]>({
|
|
69
|
-
method: 'GET',
|
|
70
|
-
url: `/api/profiles/search?${params.toString()}`,
|
|
71
|
-
cache: true,
|
|
72
|
-
cacheTTL: 2 * 60 * 1000,
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
// Handle response format
|
|
76
|
-
if (Array.isArray(response)) {
|
|
77
|
-
const limit = pagination?.limit ?? response.length;
|
|
78
|
-
const paginationInfo: PaginationInfo = {
|
|
79
|
-
total: response.length,
|
|
80
|
-
limit,
|
|
81
|
-
offset: pagination?.offset ?? 0,
|
|
82
|
-
hasMore: limit > 0 && response.length === limit,
|
|
83
|
-
};
|
|
84
|
-
return { data: response, pagination: paginationInfo };
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return response;
|
|
88
|
-
} catch (error) {
|
|
89
|
-
throw error;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Get profile recommendations
|
|
95
|
-
*/
|
|
96
|
-
async getProfileRecommendations(): Promise<User[]> {
|
|
97
|
-
try {
|
|
98
|
-
return await this.httpService.request<User[]>({
|
|
99
|
-
method: 'GET',
|
|
100
|
-
url: '/api/profiles/recommendations',
|
|
101
|
-
cache: true,
|
|
102
|
-
cacheTTL: 5 * 60 * 1000,
|
|
103
|
-
});
|
|
104
|
-
} catch (error) {
|
|
105
|
-
throw error;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Update user profile
|
|
111
|
-
*/
|
|
112
|
-
async updateProfile(updates: Partial<User>): Promise<User> {
|
|
113
|
-
try {
|
|
114
|
-
return await this.httpService.request<User>({
|
|
115
|
-
method: 'PATCH',
|
|
116
|
-
url: '/api/profiles/me',
|
|
117
|
-
data: updates,
|
|
118
|
-
cache: false,
|
|
119
|
-
});
|
|
120
|
-
} catch (error) {
|
|
121
|
-
throw error;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Focused Services
|
|
3
|
-
*
|
|
4
|
-
* Single-responsibility services replacing the mixin pattern:
|
|
5
|
-
* - AuthService: Authentication, challenges, registration
|
|
6
|
-
* - SessionService: Session management (already exists)
|
|
7
|
-
* - UserService: User profile operations
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
export { AuthService } from './AuthService';
|
|
11
|
-
export { sessionService } from './SessionService';
|
|
12
|
-
export { UserService } from './UserService';
|
|
13
|
-
export { tokenService } from './TokenService';
|
|
14
|
-
|