@oxyhq/services 5.16.35 → 5.16.37

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.
Files changed (232) hide show
  1. package/README.md +8 -26
  2. package/lib/commonjs/core/OxyServices.base.js.map +1 -1
  3. package/lib/commonjs/core/mixins/OxyServices.user.js.map +1 -1
  4. package/lib/commonjs/core/mixins/OxyServices.utility.js.map +1 -1
  5. package/lib/commonjs/crypto/README.md +142 -0
  6. package/lib/commonjs/crypto/core.js +147 -0
  7. package/lib/commonjs/crypto/core.js.map +1 -0
  8. package/lib/commonjs/crypto/index.js +16 -0
  9. package/lib/commonjs/crypto/index.js.map +1 -1
  10. package/lib/commonjs/crypto/keyManager.js +19 -22
  11. package/lib/commonjs/crypto/keyManager.js.map +1 -1
  12. package/lib/commonjs/crypto/signatureService.js +116 -28
  13. package/lib/commonjs/crypto/signatureService.js.map +1 -1
  14. package/lib/commonjs/index.js +0 -12
  15. package/lib/commonjs/index.js.map +1 -1
  16. package/lib/commonjs/models/interfaces.js +10 -11
  17. package/lib/commonjs/models/interfaces.js.map +1 -1
  18. package/lib/commonjs/node/index.js +10 -1
  19. package/lib/commonjs/node/index.js.map +1 -1
  20. package/lib/commonjs/node/signatureService.js +107 -0
  21. package/lib/commonjs/node/signatureService.js.map +1 -0
  22. package/lib/commonjs/ui/context/OxyContext.js +23 -0
  23. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  24. package/lib/commonjs/ui/context/hooks/useAuthOperations.js +29 -2
  25. package/lib/commonjs/ui/context/hooks/useAuthOperations.js.map +1 -1
  26. package/lib/commonjs/ui/context/hooks/useLanguageManagement.js.map +1 -1
  27. package/lib/commonjs/ui/hooks/useLanguageManagement.js.map +1 -1
  28. package/lib/commonjs/ui/hooks/useSessionManagement.js.map +1 -1
  29. package/lib/commonjs/ui/index.js +0 -2
  30. package/lib/commonjs/ui/index.js.map +1 -1
  31. package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
  32. package/lib/commonjs/ui/screens/OxyAuthScreen.js +11 -2
  33. package/lib/commonjs/ui/screens/OxyAuthScreen.js.map +1 -1
  34. package/lib/module/core/OxyServices.base.js.map +1 -1
  35. package/lib/module/core/mixins/OxyServices.user.js.map +1 -1
  36. package/lib/module/core/mixins/OxyServices.utility.js.map +1 -1
  37. package/lib/module/crypto/README.md +142 -0
  38. package/lib/module/crypto/core.js +133 -0
  39. package/lib/module/crypto/core.js.map +1 -0
  40. package/lib/module/crypto/index.js +3 -9
  41. package/lib/module/crypto/index.js.map +1 -1
  42. package/lib/module/crypto/keyManager.js +19 -22
  43. package/lib/module/crypto/keyManager.js.map +1 -1
  44. package/lib/module/crypto/signatureService.js +113 -23
  45. package/lib/module/crypto/signatureService.js.map +1 -1
  46. package/lib/module/index.js +0 -2
  47. package/lib/module/index.js.map +1 -1
  48. package/lib/module/models/interfaces.js +10 -11
  49. package/lib/module/models/interfaces.js.map +1 -1
  50. package/lib/module/node/index.js +3 -0
  51. package/lib/module/node/index.js.map +1 -1
  52. package/lib/module/node/signatureService.js +101 -0
  53. package/lib/module/node/signatureService.js.map +1 -0
  54. package/lib/module/ui/context/OxyContext.js +23 -0
  55. package/lib/module/ui/context/OxyContext.js.map +1 -1
  56. package/lib/module/ui/context/hooks/useAuthOperations.js +29 -2
  57. package/lib/module/ui/context/hooks/useAuthOperations.js.map +1 -1
  58. package/lib/module/ui/context/hooks/useLanguageManagement.js.map +1 -1
  59. package/lib/module/ui/hooks/useLanguageManagement.js.map +1 -1
  60. package/lib/module/ui/hooks/useSessionManagement.js.map +1 -1
  61. package/lib/module/ui/index.js +0 -1
  62. package/lib/module/ui/index.js.map +1 -1
  63. package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
  64. package/lib/module/ui/screens/OxyAuthScreen.js +11 -2
  65. package/lib/module/ui/screens/OxyAuthScreen.js.map +1 -1
  66. package/lib/typescript/core/OxyServices.base.d.ts.map +1 -1
  67. package/lib/typescript/core/mixins/OxyServices.analytics.d.ts.map +1 -1
  68. package/lib/typescript/core/mixins/OxyServices.assets.d.ts.map +1 -1
  69. package/lib/typescript/core/mixins/OxyServices.auth.d.ts +1 -1
  70. package/lib/typescript/core/mixins/OxyServices.auth.d.ts.map +1 -1
  71. package/lib/typescript/core/mixins/OxyServices.developer.d.ts.map +1 -1
  72. package/lib/typescript/core/mixins/OxyServices.devices.d.ts.map +1 -1
  73. package/lib/typescript/core/mixins/OxyServices.karma.d.ts.map +1 -1
  74. package/lib/typescript/core/mixins/OxyServices.language.d.ts.map +1 -1
  75. package/lib/typescript/core/mixins/OxyServices.location.d.ts.map +1 -1
  76. package/lib/typescript/core/mixins/OxyServices.payment.d.ts.map +1 -1
  77. package/lib/typescript/core/mixins/OxyServices.privacy.d.ts.map +1 -1
  78. package/lib/typescript/core/mixins/OxyServices.security.d.ts.map +1 -1
  79. package/lib/typescript/core/mixins/OxyServices.user.d.ts +1 -2
  80. package/lib/typescript/core/mixins/OxyServices.user.d.ts.map +1 -1
  81. package/lib/typescript/core/mixins/OxyServices.utility.d.ts.map +1 -1
  82. package/lib/typescript/core/mixins/index.d.ts +13 -13
  83. package/lib/typescript/core/mixins/index.d.ts.map +1 -1
  84. package/lib/typescript/core/services/SessionService.d.ts +1 -1
  85. package/lib/typescript/core/services/SessionService.d.ts.map +1 -1
  86. package/lib/typescript/crypto/core.d.ts +56 -0
  87. package/lib/typescript/crypto/core.d.ts.map +1 -0
  88. package/lib/typescript/crypto/index.d.ts +1 -9
  89. package/lib/typescript/crypto/index.d.ts.map +1 -1
  90. package/lib/typescript/crypto/keyManager.d.ts +13 -1
  91. package/lib/typescript/crypto/keyManager.d.ts.map +1 -1
  92. package/lib/typescript/crypto/signatureService.d.ts +15 -9
  93. package/lib/typescript/crypto/signatureService.d.ts.map +1 -1
  94. package/lib/typescript/index.d.ts +1 -2
  95. package/lib/typescript/index.d.ts.map +1 -1
  96. package/lib/typescript/models/interfaces.d.ts +68 -15
  97. package/lib/typescript/models/interfaces.d.ts.map +1 -1
  98. package/lib/typescript/node/index.d.ts +1 -0
  99. package/lib/typescript/node/index.d.ts.map +1 -1
  100. package/lib/typescript/node/signatureService.d.ts +55 -0
  101. package/lib/typescript/node/signatureService.d.ts.map +1 -0
  102. package/lib/typescript/ui/context/OxyContext.d.ts +1 -2
  103. package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
  104. package/lib/typescript/ui/context/hooks/useAuthOperations.d.ts +1 -2
  105. package/lib/typescript/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
  106. package/lib/typescript/ui/context/hooks/useLanguageManagement.d.ts +1 -2
  107. package/lib/typescript/ui/context/hooks/useLanguageManagement.d.ts.map +1 -1
  108. package/lib/typescript/ui/hooks/mutations/useAccountMutations.d.ts +1 -1
  109. package/lib/typescript/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
  110. package/lib/typescript/ui/hooks/queries/useAccountQueries.d.ts +1 -1
  111. package/lib/typescript/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
  112. package/lib/typescript/ui/hooks/useLanguageManagement.d.ts +1 -2
  113. package/lib/typescript/ui/hooks/useLanguageManagement.d.ts.map +1 -1
  114. package/lib/typescript/ui/hooks/useSessionManagement.d.ts +1 -2
  115. package/lib/typescript/ui/hooks/useSessionManagement.d.ts.map +1 -1
  116. package/lib/typescript/ui/index.d.ts +1 -1
  117. package/lib/typescript/ui/index.d.ts.map +1 -1
  118. package/lib/typescript/ui/screens/OxyAuthScreen.d.ts.map +1 -1
  119. package/lib/typescript/ui/stores/authStore.d.ts +1 -1
  120. package/lib/typescript/ui/stores/authStore.d.ts.map +1 -1
  121. package/lib/typescript/ui/utils/avatarUtils.d.ts +1 -1
  122. package/lib/typescript/ui/utils/avatarUtils.d.ts.map +1 -1
  123. package/package.json +6 -1
  124. package/src/core/OxyServices.base.ts +1 -2
  125. package/src/core/mixins/OxyServices.auth.ts +1 -1
  126. package/src/core/mixins/OxyServices.user.ts +1 -2
  127. package/src/core/mixins/OxyServices.utility.ts +1 -2
  128. package/src/core/services/SessionService.ts +1 -1
  129. package/src/crypto/README.md +142 -0
  130. package/src/crypto/__tests__/core.test.ts +203 -0
  131. package/src/crypto/core.ts +142 -0
  132. package/src/crypto/index.ts +3 -10
  133. package/src/crypto/keyManager.ts +25 -21
  134. package/src/crypto/signatureService.ts +137 -36
  135. package/src/index.ts +2 -3
  136. package/src/models/interfaces.ts +73 -21
  137. package/src/node/index.ts +3 -0
  138. package/src/node/signatureService.ts +126 -0
  139. package/src/ui/context/OxyContext.tsx +26 -2
  140. package/src/ui/context/hooks/useAuthOperations.ts +33 -4
  141. package/src/ui/context/hooks/useLanguageManagement.ts +1 -2
  142. package/src/ui/hooks/auth/index.ts +2 -0
  143. package/src/ui/hooks/mutations/useAccountMutations.ts +1 -1
  144. package/src/ui/hooks/mutations/useServicesMutations.ts +1 -1
  145. package/src/ui/hooks/queries/useAccountQueries.ts +1 -1
  146. package/src/ui/hooks/useLanguageManagement.ts +1 -2
  147. package/src/ui/hooks/useSessionManagement.ts +1 -2
  148. package/src/ui/index.ts +1 -2
  149. package/src/ui/screens/AccountSettingsScreen.tsx +6 -6
  150. package/src/ui/screens/AccountSwitcherScreen.tsx +1 -1
  151. package/src/ui/screens/OxyAuthScreen.tsx +11 -2
  152. package/src/ui/screens/ProfileScreen.tsx +1 -1
  153. package/src/ui/stores/authStore.ts +1 -1
  154. package/src/ui/types/navigation.ts +1 -1
  155. package/src/ui/utils/avatarUtils.ts +1 -1
  156. package/lib/commonjs/core/services/AuthService.js +0 -156
  157. package/lib/commonjs/core/services/AuthService.js.map +0 -1
  158. package/lib/commonjs/core/services/SessionTransportService.js +0 -64
  159. package/lib/commonjs/core/services/SessionTransportService.js.map +0 -1
  160. package/lib/commonjs/core/services/UserService.js +0 -123
  161. package/lib/commonjs/core/services/UserService.js.map +0 -1
  162. package/lib/commonjs/core/services/index.js +0 -34
  163. package/lib/commonjs/core/services/index.js.map +0 -1
  164. package/lib/commonjs/shared/crypto/messageBuilders.js +0 -79
  165. package/lib/commonjs/shared/crypto/messageBuilders.js.map +0 -1
  166. package/lib/commonjs/shared/crypto/platform.js +0 -118
  167. package/lib/commonjs/shared/crypto/platform.js.map +0 -1
  168. package/lib/commonjs/shared/crypto/signature.js +0 -191
  169. package/lib/commonjs/shared/crypto/signature.js.map +0 -1
  170. package/lib/commonjs/shared/index.js +0 -94
  171. package/lib/commonjs/shared/index.js.map +0 -1
  172. package/lib/commonjs/shared/models/index.js +0 -2
  173. package/lib/commonjs/shared/models/index.js.map +0 -1
  174. package/lib/commonjs/shared/transport/index.js +0 -260
  175. package/lib/commonjs/shared/transport/index.js.map +0 -1
  176. package/lib/commonjs/shared/utils/index.js +0 -82
  177. package/lib/commonjs/shared/utils/index.js.map +0 -1
  178. package/lib/module/core/services/AuthService.js +0 -151
  179. package/lib/module/core/services/AuthService.js.map +0 -1
  180. package/lib/module/core/services/SessionTransportService.js +0 -59
  181. package/lib/module/core/services/SessionTransportService.js.map +0 -1
  182. package/lib/module/core/services/UserService.js +0 -118
  183. package/lib/module/core/services/UserService.js.map +0 -1
  184. package/lib/module/core/services/index.js +0 -16
  185. package/lib/module/core/services/index.js.map +0 -1
  186. package/lib/module/shared/crypto/messageBuilders.js +0 -70
  187. package/lib/module/shared/crypto/messageBuilders.js.map +0 -1
  188. package/lib/module/shared/crypto/platform.js +0 -112
  189. package/lib/module/shared/crypto/platform.js.map +0 -1
  190. package/lib/module/shared/crypto/signature.js +0 -186
  191. package/lib/module/shared/crypto/signature.js.map +0 -1
  192. package/lib/module/shared/index.js +0 -30
  193. package/lib/module/shared/index.js.map +0 -1
  194. package/lib/module/shared/models/index.js +0 -2
  195. package/lib/module/shared/models/index.js.map +0 -1
  196. package/lib/module/shared/transport/index.js +0 -254
  197. package/lib/module/shared/transport/index.js.map +0 -1
  198. package/lib/module/shared/utils/index.js +0 -74
  199. package/lib/module/shared/utils/index.js.map +0 -1
  200. package/lib/typescript/core/services/AuthService.d.ts +0 -50
  201. package/lib/typescript/core/services/AuthService.d.ts.map +0 -1
  202. package/lib/typescript/core/services/SessionTransportService.d.ts +0 -31
  203. package/lib/typescript/core/services/SessionTransportService.d.ts.map +0 -1
  204. package/lib/typescript/core/services/UserService.d.ts +0 -39
  205. package/lib/typescript/core/services/UserService.d.ts.map +0 -1
  206. package/lib/typescript/core/services/index.d.ts +0 -13
  207. package/lib/typescript/core/services/index.d.ts.map +0 -1
  208. package/lib/typescript/shared/crypto/messageBuilders.d.ts +0 -38
  209. package/lib/typescript/shared/crypto/messageBuilders.d.ts.map +0 -1
  210. package/lib/typescript/shared/crypto/platform.d.ts +0 -54
  211. package/lib/typescript/shared/crypto/platform.d.ts.map +0 -1
  212. package/lib/typescript/shared/crypto/signature.d.ts +0 -72
  213. package/lib/typescript/shared/crypto/signature.d.ts.map +0 -1
  214. package/lib/typescript/shared/index.d.ts +0 -20
  215. package/lib/typescript/shared/index.d.ts.map +0 -1
  216. package/lib/typescript/shared/models/index.d.ts +0 -163
  217. package/lib/typescript/shared/models/index.d.ts.map +0 -1
  218. package/lib/typescript/shared/transport/index.d.ts +0 -73
  219. package/lib/typescript/shared/transport/index.d.ts.map +0 -1
  220. package/lib/typescript/shared/utils/index.d.ts +0 -28
  221. package/lib/typescript/shared/utils/index.d.ts.map +0 -1
  222. package/src/core/services/AuthService.ts +0 -153
  223. package/src/core/services/SessionTransportService.ts +0 -69
  224. package/src/core/services/UserService.ts +0 -125
  225. package/src/core/services/index.ts +0 -14
  226. package/src/shared/crypto/messageBuilders.ts +0 -89
  227. package/src/shared/crypto/platform.ts +0 -140
  228. package/src/shared/crypto/signature.ts +0 -235
  229. package/src/shared/index.ts +0 -28
  230. package/src/shared/models/index.ts +0 -173
  231. package/src/shared/transport/index.ts +0 -349
  232. package/src/shared/utils/index.ts +0 -73
@@ -1,64 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.SessionTransportService = void 0;
7
- var _shared = require("../../shared");
8
- /**
9
- * Session Transport Service
10
- *
11
- * Uses shared transport abstraction for WebSocket/SSE/polling
12
- * Provides unified interface for session status updates
13
- */
14
-
15
- class SessionTransportService {
16
- transport = null;
17
- constructor(config) {
18
- this.config = config;
19
- }
20
-
21
- /**
22
- * Connect to session status updates
23
- * Automatically chooses best available transport (WebSocket > SSE > Polling)
24
- */
25
- async connect(sessionToken, callbacks) {
26
- const transportConfig = {
27
- baseURL: this.config.baseURL,
28
- namespace: 'auth-session',
29
- sessionToken,
30
- pollingInterval: 3000,
31
- // 3 seconds
32
- reconnectAttempts: 3,
33
- reconnectDelay: 1000
34
- };
35
- this.transport = await _shared.TransportFactory.create(transportConfig, callbacks);
36
- await this.transport.connect();
37
- }
38
-
39
- /**
40
- * Disconnect from session updates
41
- */
42
- disconnect() {
43
- if (this.transport) {
44
- this.transport.disconnect();
45
- this.transport = null;
46
- }
47
- }
48
-
49
- /**
50
- * Check if currently connected
51
- */
52
- isConnected() {
53
- return this.transport?.isConnected() ?? false;
54
- }
55
-
56
- /**
57
- * Get the transport type being used
58
- */
59
- getTransportType() {
60
- return this.transport?.getType() ?? 'none';
61
- }
62
- }
63
- exports.SessionTransportService = SessionTransportService;
64
- //# sourceMappingURL=SessionTransportService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_shared","require","SessionTransportService","transport","constructor","config","connect","sessionToken","callbacks","transportConfig","baseURL","namespace","pollingInterval","reconnectAttempts","reconnectDelay","TransportFactory","create","disconnect","isConnected","getTransportType","getType","exports"],"sourceRoot":"../../../../src","sources":["core/services/SessionTransportService.ts"],"mappings":";;;;;;AAQA,IAAAA,OAAA,GAAAC,OAAA;AARA;AACA;AACA;AACA;AACA;AACA;;AAUO,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,MAAMY,wBAAgB,CAACC,MAAM,CAACP,eAAe,EAAED,SAAS,CAAC;IAC1E,MAAM,IAAI,CAACL,SAAS,CAACG,OAAO,CAAC,CAAC;EAChC;;EAEA;AACF;AACA;EACEW,UAAUA,CAAA,EAAS;IACjB,IAAI,IAAI,CAACd,SAAS,EAAE;MAClB,IAAI,CAACA,SAAS,CAACc,UAAU,CAAC,CAAC;MAC3B,IAAI,CAACd,SAAS,GAAG,IAAI;IACvB;EACF;;EAEA;AACF;AACA;EACEe,WAAWA,CAAA,EAAY;IACrB,OAAO,IAAI,CAACf,SAAS,EAAEe,WAAW,CAAC,CAAC,IAAI,KAAK;EAC/C;;EAEA;AACF;AACA;EACEC,gBAAgBA,CAAA,EAAW;IACzB,OAAO,IAAI,CAAChB,SAAS,EAAEiB,OAAO,CAAC,CAAC,IAAI,MAAM;EAC5C;AACF;AAACC,OAAA,CAAAnB,uBAAA,GAAAA,uBAAA","ignoreList":[]}
@@ -1,123 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.UserService = void 0;
7
- var _HttpService = require("../HttpService");
8
- /**
9
- * User Service
10
- *
11
- * Handles user profile operations (no key handling):
12
- * - Profile fetch/update
13
- * - Profile search
14
- * - User recommendations
15
- */
16
-
17
- class UserService {
18
- constructor(config) {
19
- this.httpService = new _HttpService.HttpService(config);
20
- }
21
-
22
- /**
23
- * Get user profile by ID
24
- */
25
- async getUserById(userId) {
26
- try {
27
- return await this.httpService.request({
28
- method: 'GET',
29
- url: `/api/profiles/${userId}`,
30
- cache: true,
31
- cacheTTL: 5 * 60 * 1000
32
- });
33
- } catch (error) {
34
- throw error;
35
- }
36
- }
37
-
38
- /**
39
- * Get profile by username
40
- */
41
- async getProfileByUsername(username) {
42
- try {
43
- return await this.httpService.request({
44
- method: 'GET',
45
- url: `/api/profiles/username/${username}`,
46
- cache: true,
47
- cacheTTL: 5 * 60 * 1000
48
- });
49
- } catch (error) {
50
- throw error;
51
- }
52
- }
53
-
54
- /**
55
- * Search user profiles
56
- */
57
- async searchProfiles(query, pagination) {
58
- try {
59
- const params = new URLSearchParams();
60
- params.set('query', query);
61
- if (pagination?.limit) params.set('limit', pagination.limit.toString());
62
- if (pagination?.offset) params.set('offset', pagination.offset.toString());
63
- const response = await this.httpService.request({
64
- method: 'GET',
65
- url: `/api/profiles/search?${params.toString()}`,
66
- cache: true,
67
- cacheTTL: 2 * 60 * 1000
68
- });
69
-
70
- // Handle response format
71
- if (Array.isArray(response)) {
72
- const limit = pagination?.limit ?? response.length;
73
- const paginationInfo = {
74
- total: response.length,
75
- limit,
76
- offset: pagination?.offset ?? 0,
77
- hasMore: limit > 0 && response.length === limit
78
- };
79
- return {
80
- data: response,
81
- pagination: paginationInfo
82
- };
83
- }
84
- return response;
85
- } catch (error) {
86
- throw error;
87
- }
88
- }
89
-
90
- /**
91
- * Get profile recommendations
92
- */
93
- async getProfileRecommendations() {
94
- try {
95
- return await this.httpService.request({
96
- method: 'GET',
97
- url: '/api/profiles/recommendations',
98
- cache: true,
99
- cacheTTL: 5 * 60 * 1000
100
- });
101
- } catch (error) {
102
- throw error;
103
- }
104
- }
105
-
106
- /**
107
- * Update user profile
108
- */
109
- async updateProfile(updates) {
110
- try {
111
- return await this.httpService.request({
112
- method: 'PATCH',
113
- url: '/api/profiles/me',
114
- data: updates,
115
- cache: false
116
- });
117
- } catch (error) {
118
- throw error;
119
- }
120
- }
121
- }
122
- exports.UserService = UserService;
123
- //# sourceMappingURL=UserService.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_HttpService","require","UserService","constructor","config","httpService","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","exports"],"sourceRoot":"../../../../src","sources":["core/services/UserService.ts"],"mappings":";;;;;;AAWA,IAAAA,YAAA,GAAAC,OAAA;AAXA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWO,MAAMC,WAAW,CAAC;EAGvBC,WAAWA,CAACC,MAAiB,EAAE;IAC7B,IAAI,CAACC,WAAW,GAAG,IAAIC,wBAAW,CAACF,MAAM,CAAC;EAC5C;;EAEA;AACF;AACA;EACE,MAAMG,WAAWA,CAACC,MAAc,EAAiB;IAC/C,IAAI;MACF,OAAO,MAAM,IAAI,CAACH,WAAW,CAACI,OAAO,CAAO;QAC1CC,MAAM,EAAE,KAAK;QACbC,GAAG,EAAE,iBAAiBH,MAAM,EAAE;QAC9BI,KAAK,EAAE,IAAI;QACXC,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG;MACrB,CAAC,CAAC;IACJ,CAAC,CAAC,OAAOC,KAAK,EAAE;MACd,MAAMA,KAAK;IACb;EACF;;EAEA;AACF;AACA;EACE,MAAMC,oBAAoBA,CAACC,QAAgB,EAAiB;IAC1D,IAAI;MACF,OAAO,MAAM,IAAI,CAACX,WAAW,CAACI,OAAO,CAAO;QAC1CC,MAAM,EAAE,KAAK;QACbC,GAAG,EAAE,0BAA0BK,QAAQ,EAAE;QACzCJ,KAAK,EAAE,IAAI;QACXC,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG;MACrB,CAAC,CAAC;IACJ,CAAC,CAAC,OAAOC,KAAK,EAAE;MACd,MAAMA,KAAK;IACb;EACF;;EAEA;AACF;AACA;EACE,MAAMG,cAAcA,CAACC,KAAa,EAAEC,UAA6B,EAAmC;IAClG,IAAI;MACF,MAAMC,MAAM,G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AC5CC,MAAM,EAAE,KAAK;QACbC,GAAG,EAAE,+BAA+B;QACpCC,KAAK,EAAE,IAAI;QACXC,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG;MACrB,CAAC,CAAC;IACJ,CAAC,CAAC,OAAOC,KAAK,EAAE;MACd,MAAMA,KAAK;IACb;EACF;;EAEA;AACF;AACA;EACE,MAAMqB,aAAaA,CAACC,OAAsB,EAAiB;IACzD,IAAI;MACF,OAAO,MAAM,IAAI,CAAC/B,WAAW,CAACI,OAAO,CAAO;QAC1CC,MAAM,EAAE,OAAO;QACfC,GAAG,EAAE,kBAAkB;QACvBsB,IAAI,EAAEG,OAAO;QACbxB,KAAK,EAAE;MACT,CAAC,CAAC;IACJ,CAAC,CAAC,OAAOE,KAAK,EAAE;MACd,MAAMA,KAAK;IACb;EACF;AACF;AAACuB,OAAA,CAAAnC,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -1,34 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "AuthService", {
7
- enumerable: true,
8
- get: function () {
9
- return _AuthService.AuthService;
10
- }
11
- });
12
- Object.defineProperty(exports, "UserService", {
13
- enumerable: true,
14
- get: function () {
15
- return _UserService.UserService;
16
- }
17
- });
18
- Object.defineProperty(exports, "sessionService", {
19
- enumerable: true,
20
- get: function () {
21
- return _SessionService.sessionService;
22
- }
23
- });
24
- Object.defineProperty(exports, "tokenService", {
25
- enumerable: true,
26
- get: function () {
27
- return _TokenService.tokenService;
28
- }
29
- });
30
- var _AuthService = require("./AuthService");
31
- var _SessionService = require("./SessionService");
32
- var _UserService = require("./UserService");
33
- var _TokenService = require("./TokenService");
34
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_AuthService","require","_SessionService","_UserService","_TokenService"],"sourceRoot":"../../../../src","sources":["core/services/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,aAAA,GAAAH,OAAA","ignoreList":[]}
@@ -1,79 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.buildAuthChallengeResponse = buildAuthChallengeResponse;
7
- exports.buildAuthMessage = buildAuthMessage;
8
- exports.buildRegistrationMessage = buildRegistrationMessage;
9
- exports.buildRequestMessage = buildRequestMessage;
10
- exports.canonicalizeData = canonicalizeData;
11
- exports.isTimestampFresh = isTimestampFresh;
12
- /**
13
- * Canonical Message Builders
14
- *
15
- * Creates standardized, canonical message formats for signing.
16
- * These formats are used consistently across Accounts, Services SDK, and API.
17
- */
18
-
19
- /**
20
- * Build authentication message for challenge-response
21
- * Format: auth:{publicKey}:{challenge}:{timestamp}
22
- */
23
- function buildAuthMessage(publicKey, challenge, timestamp) {
24
- return `auth:${publicKey}:${challenge}:${timestamp}`;
25
- }
26
-
27
- /**
28
- * Build registration message
29
- * Format: oxy:register:{publicKey}:{timestamp}
30
- */
31
- function buildRegistrationMessage(publicKey, timestamp) {
32
- return `oxy:register:${publicKey}:${timestamp}`;
33
- }
34
-
35
- /**
36
- * Build request signing message
37
- * Format: request:{publicKey}:{timestamp}:{canonicalData}
38
- */
39
- function buildRequestMessage(publicKey, timestamp, data) {
40
- // Create canonical string representation
41
- const sortedKeys = Object.keys(data).sort();
42
- const canonicalParts = sortedKeys.map(key => `${key}:${JSON.stringify(data[key])}`);
43
- const canonicalString = canonicalParts.join('|');
44
- return `request:${publicKey}:${timestamp}:${canonicalString}`;
45
- }
46
-
47
- /**
48
- * Create canonical data representation for signing
49
- * Sorts keys and creates a consistent string representation
50
- */
51
- function canonicalizeData(data) {
52
- const sortedKeys = Object.keys(data).sort();
53
- const canonicalParts = sortedKeys.map(key => `${key}:${JSON.stringify(data[key])}`);
54
- return canonicalParts.join('|');
55
- }
56
-
57
- /**
58
- * Build auth challenge response payload
59
- * Helper to construct the signed challenge response
60
- */
61
- function buildAuthChallengeResponse(publicKey, challenge, signature, timestamp) {
62
- return {
63
- challenge,
64
- publicKey,
65
- signature,
66
- timestamp
67
- };
68
- }
69
-
70
- /**
71
- * Validate timestamp freshness
72
- * Ensures signed messages are not too old
73
- */
74
- function isTimestampFresh(timestamp, maxAgeMs = 5 * 60 * 1000 // 5 minutes default
75
- ) {
76
- const now = Date.now();
77
- return now - timestamp <= maxAgeMs && timestamp <= now;
78
- }
79
- //# sourceMappingURL=messageBuilders.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["buildAuthMessage","publicKey","challenge","timestamp","buildRegistrationMessage","buildRequestMessage","data","sortedKeys","Object","keys","sort","canonicalParts","map","key","JSON","stringify","canonicalString","join","canonicalizeData","buildAuthChallengeResponse","signature","isTimestampFresh","maxAgeMs","now","Date"],"sourceRoot":"../../../../src","sources":["shared/crypto/messageBuilders.ts"],"mappings":";;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACO,SAASA,gBAAgBA,CAC9BC,SAAiB,EACjBC,SAAiB,EACjBC,SAAiB,EACT;EACR,OAAO,QAAQF,SAAS,IAAIC,SAAS,IAAIC,SAAS,EAAE;AACtD;;AAEA;AACA;AACA;AACA;AACO,SAASC,wBAAwBA,CACtCH,SAAiB,EACjBE,SAAiB,EACT;EACR,OAAO,gBAAgBF,SAAS,IAAIE,SAAS,EAAE;AACjD;;AAEA;AACA;AACA;AACA;AACO,SAASE,mBAAmBA,CACjCJ,SAAiB,EACjBE,SAAiB,EACjBG,IAA6B,EACrB;EACR;EACA,MAAMC,UAAU,GAAGC,MAAM,CAACC,IAAI,CAACH,IAAI,CAAC,CAACI,IAAI,CAAC,CAAC;EAC3C,MAAMC,cAAc,GAAGJ,UAAU,CAACK,GAAG,CAACC,GAAG,IAAI,GAAGA,GAAG,IAAIC,IAAI,CAACC,SAAS,CAACT,IAAI,CAACO,GAAG,CAAC,CAAC,EAAE,CAAC;EACnF,MAAMG,eAAe,GAAGL,cAAc,CAACM,IAAI,CAAC,GAAG,CAAC;EAEhD,OAAO,WAAWhB,SAAS,IAAIE,SAAS,IAAIa,eAAe,EAAE;AAC/D;;AAEA;AACA;AACA;AACA;AACO,SAASE,gBAAgBA,CAACZ,IAA6B,EAAU;EACtE,MAAMC,UAAU,GAAGC,MAAM,CAACC,IAAI,CAACH,IAAI,CAAC,CAACI,IAAI,CAAC,CAAC;EAC3C,MAAMC,cAAc,GAAGJ,UAAU,CAACK,GAAG,CAACC,GAAG,IAAI,GAAGA,GAAG,IAAIC,IAAI,CAACC,SAAS,CAACT,IAAI,CAACO,GAAG,CAAC,CAAC,EAAE,CAAC;EACnF,OAAOF,cAAc,CAACM,IAAI,CAAC,GAAG,CAAC;AACjC;;AAEA;AACA;AACA;AACA;AACO,SAASE,0BAA0BA,CACxClB,SAAiB,EACjBC,SAAiB,EACjBkB,SAAiB,EACjBjB,SAAiB,EACM;EACvB,OAAO;IACLD,SAAS;IACTD,SAAS;IACTmB,SAAS;IACTjB;EACF,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACO,SAASkB,gBAAgBA,CAC9BlB,SAAiB,EACjBmB,QAAgB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAAA,EACxB;EACT,MAAMC,GAAG,GAAGC,IAAI,CAACD,GAAG,CAAC,CAAC;EACtB,OAAQA,GAAG,GAAGpB,SAAS,IAAKmB,QAAQ,IAAInB,SAAS,IAAIoB,GAAG;AAC1D","ignoreList":[]}
@@ -1,118 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.PlatformDetector = void 0;
7
- exports.getCryptoAdapter = getCryptoAdapter;
8
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
9
- /**
10
- * Platform Detection and Adapters
11
- *
12
- * Provides environment detection and platform-specific crypto adapters
13
- * to support Node.js, React Native, and Web environments.
14
- */
15
-
16
- /**
17
- * Platform types
18
- */
19
-
20
- /**
21
- * Platform detection utilities
22
- */
23
- const PlatformDetector = exports.PlatformDetector = {
24
- /**
25
- * Detect current platform
26
- */
27
- detect() {
28
- if (typeof window === 'undefined' && typeof process !== 'undefined' && process.versions?.node) {
29
- return 'node';
30
- }
31
- if (typeof navigator !== 'undefined' && navigator.product === 'ReactNative') {
32
- return 'react-native';
33
- }
34
- return 'web';
35
- },
36
- /**
37
- * Check if running in Node.js
38
- */
39
- isNode() {
40
- return this.detect() === 'node';
41
- },
42
- /**
43
- * Check if running in React Native
44
- */
45
- isReactNative() {
46
- return this.detect() === 'react-native';
47
- },
48
- /**
49
- * Check if running in Web browser
50
- */
51
- isWeb() {
52
- return this.detect() === 'web';
53
- }
54
- };
55
-
56
- /**
57
- * Crypto adapter interface
58
- * Platform-specific implementations must implement this interface
59
- */
60
-
61
- /**
62
- * Get the appropriate crypto adapter for the current platform
63
- */
64
- async function getCryptoAdapter() {
65
- const platform = PlatformDetector.detect();
66
- if (platform === 'node') {
67
- // eslint-disable-next-line @typescript-eslint/no-implied-eval
68
- const getCrypto = new Function('return require("crypto")');
69
- const crypto = getCrypto();
70
- return {
71
- async randomBytes(size) {
72
- return new Uint8Array(crypto.randomBytes(size));
73
- },
74
- async sha256(message) {
75
- return crypto.createHash('sha256').update(message).digest('hex');
76
- },
77
- sha256Sync(message) {
78
- return crypto.createHash('sha256').update(message).digest('hex');
79
- }
80
- };
81
- }
82
- if (platform === 'react-native') {
83
- // Lazy load expo-crypto (peer dependency)
84
- try {
85
- // @ts-ignore - expo-crypto is an optional peer dependency
86
- const ExpoCrypto = await Promise.resolve().then(() => _interopRequireWildcard(require('expo-crypto')));
87
- return {
88
- async randomBytes(size) {
89
- const bytes = await ExpoCrypto.getRandomBytesAsync(size);
90
- return new Uint8Array(bytes);
91
- },
92
- async sha256(message) {
93
- return ExpoCrypto.digestStringAsync(ExpoCrypto.CryptoDigestAlgorithm.SHA256, message);
94
- }
95
- };
96
- } catch (error) {
97
- throw new Error(`expo-crypto is required in React Native environment: ${error instanceof Error ? error.message : String(error)}`);
98
- }
99
- }
100
-
101
- // Web platform - use Web Crypto API
102
- if (typeof window !== 'undefined' && window.crypto) {
103
- return {
104
- async randomBytes(size) {
105
- return window.crypto.getRandomValues(new Uint8Array(size));
106
- },
107
- async sha256(message) {
108
- const encoder = new TextEncoder();
109
- const data = encoder.encode(message);
110
- const hashBuffer = await window.crypto.subtle.digest('SHA-256', data);
111
- const hashArray = Array.from(new Uint8Array(hashBuffer));
112
- return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
113
- }
114
- };
115
- }
116
- throw new Error('No suitable crypto implementation found for current platform');
117
- }
118
- //# sourceMappingURL=platform.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["PlatformDetector","exports","detect","window","process","versions","node","navigator","product","isNode","isReactNative","isWeb","getCryptoAdapter","platform","getCrypto","Function","crypto","randomBytes","size","Uint8Array","sha256","message","createHash","update","digest","sha256Sync","ExpoCrypto","Promise","resolve","then","_interopRequireWildcard","require","bytes","getRandomBytesAsync","digestStringAsync","CryptoDigestAlgorithm","SHA256","error","Error","String","getRandomValues","encoder","TextEncoder","data","encode","hashBuffer","subtle","hashArray","Array","from","map","b","toString","padStart","join"],"sourceRoot":"../../../../src","sources":["shared/crypto/platform.ts"],"mappings":";;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAGA;AACA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AAO,CAACG,MAAM,CAACvB,OAAO,CAAC;QACpC,MAAMwB,UAAU,GAAG,MAAM1C,MAAM,CAACa,MAAM,CAAC8B,MAAM,CAACtB,MAAM,CAAC,SAAS,EAAEmB,IAAI,CAAC;QACrE,MAAMI,SAAS,GAAGC,KAAK,CAACC,IAAI,CAAC,IAAI9B,UAAU,CAAC0B,UAAU,CAAC,CAAC;QACxD,OAAOE,SAAS,CAACG,GAAG,CAACC,CAAC,IAAIA,CAAC,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAACC,IAAI,CAAC,EAAE,CAAC;MACrE;IACF,CAAC;EACH;EAEA,MAAM,IAAIhB,KAAK,CAAC,8DAA8D,CAAC;AACjF","ignoreList":[]}
@@ -1,191 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.SignatureService = exports.MAX_SIGNATURE_AGE_MS = exports.CHALLENGE_TTL_MS = void 0;
7
- var _elliptic = require("elliptic");
8
- var _platform = require("./platform");
9
- var _messageBuilders = require("./messageBuilders");
10
- /**
11
- * Signature Verification Service
12
- *
13
- * Unified signature verification used by both backend (API) and SDK.
14
- * Uses platform adapters for crypto operations while keeping message construction shared.
15
- */
16
-
17
- const ec = new _elliptic.ec('secp256k1');
18
-
19
- /**
20
- * Maximum age for signed messages (5 minutes)
21
- */
22
- const MAX_SIGNATURE_AGE_MS = exports.MAX_SIGNATURE_AGE_MS = 5 * 60 * 1000;
23
-
24
- /**
25
- * Challenge TTL (5 minutes)
26
- */
27
- const CHALLENGE_TTL_MS = exports.CHALLENGE_TTL_MS = 5 * 60 * 1000;
28
-
29
- /**
30
- * Signature Service
31
- * Provides signature verification that works across all platforms
32
- */
33
- class SignatureService {
34
- /**
35
- * Verify an ECDSA signature
36
- *
37
- * @param message - The original message that was signed
38
- * @param signature - The signature in DER format (hex encoded)
39
- * @param publicKey - The public key (hex encoded, uncompressed)
40
- * @returns true if the signature is valid
41
- */
42
- static async verify(message, signature, publicKey) {
43
- try {
44
- const key = ec.keyFromPublic(publicKey, 'hex');
45
- const adapter = await (0, _platform.getCryptoAdapter)();
46
- const messageHash = await adapter.sha256(message);
47
- return key.verify(messageHash, signature);
48
- } catch {
49
- return false;
50
- }
51
- }
52
-
53
- /**
54
- * Synchronous signature verification (Node.js only)
55
- * Uses Node.js crypto module directly for hashing
56
- */
57
- static verifySync(message, signature, publicKey) {
58
- if (!_platform.PlatformDetector.isNode()) {
59
- throw new Error('verifySync should only be used in Node.js. Use verify() in other environments.');
60
- }
61
- try {
62
- // eslint-disable-next-line @typescript-eslint/no-implied-eval
63
- const getCrypto = new Function('return require("crypto")');
64
- const crypto = getCrypto();
65
- const key = ec.keyFromPublic(publicKey, 'hex');
66
- const messageHash = crypto.createHash('sha256').update(message).digest('hex');
67
- return key.verify(messageHash, signature);
68
- } catch {
69
- return false;
70
- }
71
- }
72
-
73
- /**
74
- * Verify an authentication challenge response
75
- *
76
- * @param publicKey - The user's public key
77
- * @param challenge - The original challenge string
78
- * @param signature - The signature of the auth message
79
- * @param timestamp - The timestamp when the signature was created
80
- * @param maxAgeMs - Maximum age of the signature in milliseconds
81
- * @returns true if the challenge response is valid
82
- */
83
- static async verifyChallengeResponse(publicKey, challenge, signature, timestamp, maxAgeMs = CHALLENGE_TTL_MS) {
84
- // Check timestamp freshness
85
- if (!(0, _messageBuilders.isTimestampFresh)(timestamp, maxAgeMs)) {
86
- return false;
87
- }
88
-
89
- // Build the canonical message
90
- const message = (0, _messageBuilders.buildAuthMessage)(publicKey, challenge, timestamp);
91
-
92
- // Verify the signature
93
- return this.verify(message, signature, publicKey);
94
- }
95
-
96
- /**
97
- * Synchronous challenge response verification (Node.js only)
98
- */
99
- static verifyChallengeResponseSync(publicKey, challenge, signature, timestamp, maxAgeMs = CHALLENGE_TTL_MS) {
100
- // Check timestamp freshness
101
- if (!(0, _messageBuilders.isTimestampFresh)(timestamp, maxAgeMs)) {
102
- return false;
103
- }
104
-
105
- // Build the canonical message
106
- const message = (0, _messageBuilders.buildAuthMessage)(publicKey, challenge, timestamp);
107
-
108
- // Verify the signature
109
- return this.verifySync(message, signature, publicKey);
110
- }
111
-
112
- /**
113
- * Verify a registration signature
114
- * Signature format: oxy:register:{publicKey}:{timestamp}
115
- */
116
- static async verifyRegistrationSignature(publicKey, signature, timestamp, maxAgeMs = MAX_SIGNATURE_AGE_MS) {
117
- // Check timestamp freshness
118
- if (!(0, _messageBuilders.isTimestampFresh)(timestamp, maxAgeMs)) {
119
- return false;
120
- }
121
-
122
- // Build the canonical message
123
- const message = (0, _messageBuilders.buildRegistrationMessage)(publicKey, timestamp);
124
-
125
- // Verify the signature
126
- return this.verify(message, signature, publicKey);
127
- }
128
-
129
- /**
130
- * Synchronous registration signature verification (Node.js only)
131
- */
132
- static verifyRegistrationSignatureSync(publicKey, signature, timestamp, maxAgeMs = MAX_SIGNATURE_AGE_MS) {
133
- // Check timestamp freshness
134
- if (!(0, _messageBuilders.isTimestampFresh)(timestamp, maxAgeMs)) {
135
- return false;
136
- }
137
-
138
- // Build the canonical message
139
- const message = (0, _messageBuilders.buildRegistrationMessage)(publicKey, timestamp);
140
-
141
- // Verify the signature
142
- return this.verifySync(message, signature, publicKey);
143
- }
144
-
145
- /**
146
- * Verify a signed request
147
- * Used for authenticated API operations
148
- */
149
- static async verifyRequestSignature(publicKey, data, signature, timestamp, maxAgeMs = MAX_SIGNATURE_AGE_MS) {
150
- // Check timestamp freshness
151
- if (!(0, _messageBuilders.isTimestampFresh)(timestamp, maxAgeMs)) {
152
- return false;
153
- }
154
-
155
- // Build the canonical message
156
- const message = (0, _messageBuilders.buildRequestMessage)(publicKey, timestamp, data);
157
-
158
- // Verify the signature
159
- return this.verify(message, signature, publicKey);
160
- }
161
-
162
- /**
163
- * Synchronous request signature verification (Node.js only)
164
- */
165
- static verifyRequestSignatureSync(publicKey, data, signature, timestamp, maxAgeMs = MAX_SIGNATURE_AGE_MS) {
166
- // Check timestamp freshness
167
- if (!(0, _messageBuilders.isTimestampFresh)(timestamp, maxAgeMs)) {
168
- return false;
169
- }
170
-
171
- // Build the canonical message
172
- const message = (0, _messageBuilders.buildRequestMessage)(publicKey, timestamp, data);
173
-
174
- // Verify the signature
175
- return this.verifySync(message, signature, publicKey);
176
- }
177
-
178
- /**
179
- * Validate that a string is a valid public key
180
- */
181
- static isValidPublicKey(publicKey) {
182
- try {
183
- ec.keyFromPublic(publicKey, 'hex');
184
- return true;
185
- } catch {
186
- return false;
187
- }
188
- }
189
- }
190
- exports.SignatureService = SignatureService;
191
- //# sourceMappingURL=signature.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["_elliptic","require","_platform","_messageBuilders","ec","EC","MAX_SIGNATURE_AGE_MS","exports","CHALLENGE_TTL_MS","SignatureService","verify","message","signature","publicKey","key","keyFromPublic","adapter","getCryptoAdapter","messageHash","sha256","verifySync","PlatformDetector","isNode","Error","getCrypto","Function","crypto","createHash","update","digest","verifyChallengeResponse","challenge","timestamp","maxAgeMs","isTimestampFresh","buildAuthMessage","verifyChallengeResponseSync","verifyRegistrationSignature","buildRegistrationMessage","verifyRegistrationSignatureSync","verifyRequestSignature","data","buildRequestMessage","verifyRequestSignatureSync","isValidPublicKey"],"sourceRoot":"../../../../src","sources":["shared/crypto/signature.ts"],"mappings":";;;;;;AAOA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,gBAAA,GAAAF,OAAA;AATA;AACA;AACA;AACA;AACA;AACA;;AAWA,MAAMG,EAAE,GAAG,IAAIC,YAAE,CAAC,WAAW,CAAC;;AAE9B;AACA;AACA;AACO,MAAMC,oBAAoB,GAAAC,OAAA,CAAAD,oBAAA,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI;;AAEjD;AACA;AACA;AACO,MAAME,gBAAgB,GAAAD,OAAA,CAAAC,gBAAA,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI;;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