@oxyhq/services 5.16.44 → 5.17.1

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 (512) hide show
  1. package/README.md +29 -10
  2. package/lib/commonjs/core/OxyServices.js +1 -1
  3. package/lib/commonjs/core/index.js +20 -15
  4. package/lib/commonjs/core/index.js.map +1 -1
  5. package/lib/commonjs/core/mixins/OxyServices.auth.js +36 -53
  6. package/lib/commonjs/core/mixins/OxyServices.auth.js.map +1 -1
  7. package/lib/commonjs/core/mixins/OxyServices.user.js +10 -17
  8. package/lib/commonjs/core/mixins/OxyServices.user.js.map +1 -1
  9. package/lib/commonjs/core/services/TokenService.js +27 -13
  10. package/lib/commonjs/core/services/TokenService.js.map +1 -1
  11. package/lib/commonjs/crypto/index.js +0 -16
  12. package/lib/commonjs/crypto/index.js.map +1 -1
  13. package/lib/commonjs/crypto/keyManager.js +21 -22
  14. package/lib/commonjs/crypto/keyManager.js.map +1 -1
  15. package/lib/commonjs/crypto/polyfill.js +1 -10
  16. package/lib/commonjs/crypto/polyfill.js.map +1 -1
  17. package/lib/commonjs/crypto/signatureService.js +18 -32
  18. package/lib/commonjs/crypto/signatureService.js.map +1 -1
  19. package/lib/commonjs/index.js +13 -134
  20. package/lib/commonjs/index.js.map +1 -1
  21. package/lib/commonjs/models/interfaces.js +0 -7
  22. package/lib/commonjs/models/interfaces.js.map +1 -1
  23. package/lib/commonjs/node/index.js +1 -10
  24. package/lib/commonjs/node/index.js.map +1 -1
  25. package/lib/commonjs/ui/components/BottomSheetRouter.js +1 -9
  26. package/lib/commonjs/ui/components/BottomSheetRouter.js.map +1 -1
  27. package/lib/commonjs/ui/components/OxyProvider.js +9 -20
  28. package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
  29. package/lib/commonjs/ui/context/OxyContext.js +779 -450
  30. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  31. package/lib/commonjs/ui/context/hooks/useAuthOperations.js +551 -0
  32. package/lib/commonjs/ui/context/hooks/useAuthOperations.js.map +1 -0
  33. package/lib/commonjs/ui/context/hooks/useDeviceManagement.js +73 -0
  34. package/lib/commonjs/ui/context/hooks/useDeviceManagement.js.map +1 -0
  35. package/lib/commonjs/ui/context/hooks/useStorage.js +79 -0
  36. package/lib/commonjs/ui/context/hooks/useStorage.js.map +1 -0
  37. package/lib/commonjs/ui/hooks/index.js +0 -20
  38. package/lib/commonjs/ui/hooks/index.js.map +1 -1
  39. package/lib/commonjs/ui/hooks/mutations/index.js +0 -12
  40. package/lib/commonjs/ui/hooks/mutations/index.js.map +1 -1
  41. package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js +23 -74
  42. package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js.map +1 -1
  43. package/lib/commonjs/ui/hooks/queries/index.js +0 -12
  44. package/lib/commonjs/ui/hooks/queries/index.js.map +1 -1
  45. package/lib/commonjs/ui/hooks/queries/queryKeys.js +1 -3
  46. package/lib/commonjs/ui/hooks/queries/queryKeys.js.map +1 -1
  47. package/lib/commonjs/ui/hooks/queries/useAccountQueries.js +28 -64
  48. package/lib/commonjs/ui/hooks/queries/useAccountQueries.js.map +1 -1
  49. package/lib/commonjs/ui/hooks/queries/useServicesQueries.js +6 -4
  50. package/lib/commonjs/ui/hooks/queries/useServicesQueries.js.map +1 -1
  51. package/lib/commonjs/ui/hooks/useDeviceManagement.js +73 -0
  52. package/lib/commonjs/ui/hooks/useDeviceManagement.js.map +1 -0
  53. package/lib/commonjs/ui/hooks/useProfileEditing.js +5 -3
  54. package/lib/commonjs/ui/hooks/useProfileEditing.js.map +1 -1
  55. package/lib/commonjs/ui/hooks/useSessionManagement.js +284 -0
  56. package/lib/commonjs/ui/hooks/useSessionManagement.js.map +1 -0
  57. package/lib/commonjs/ui/index.js +2 -10
  58. package/lib/commonjs/ui/index.js.map +1 -1
  59. package/lib/commonjs/ui/navigation/routes.js +1 -5
  60. package/lib/commonjs/ui/navigation/routes.js.map +1 -1
  61. package/lib/commonjs/ui/screens/AccountCenterScreen.js +4 -9
  62. package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
  63. package/lib/commonjs/ui/screens/AccountSettingsScreen.js +19 -37
  64. package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
  65. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +5 -5
  66. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
  67. package/lib/commonjs/ui/screens/OxyAuthScreen.js +15 -2
  68. package/lib/commonjs/ui/screens/OxyAuthScreen.js.map +1 -1
  69. package/lib/commonjs/ui/screens/PrivacySettingsScreen.js +97 -76
  70. package/lib/commonjs/ui/screens/PrivacySettingsScreen.js.map +1 -1
  71. package/lib/commonjs/ui/screens/ProfileScreen.js +6 -6
  72. package/lib/commonjs/ui/screens/ProfileScreen.js.map +1 -1
  73. package/lib/commonjs/ui/stores/authStore.js +6 -54
  74. package/lib/commonjs/ui/stores/authStore.js.map +1 -1
  75. package/lib/commonjs/ui/styles/spacing.js +2 -54
  76. package/lib/commonjs/ui/styles/spacing.js.map +1 -1
  77. package/lib/commonjs/ui/utils/avatarUtils.js +12 -9
  78. package/lib/commonjs/ui/utils/avatarUtils.js.map +1 -1
  79. package/lib/commonjs/ui/utils/sessionHelpers.js +1 -7
  80. package/lib/commonjs/ui/utils/sessionHelpers.js.map +1 -1
  81. package/lib/commonjs/utils/deviceManager.js +177 -0
  82. package/lib/commonjs/utils/deviceManager.js.map +1 -0
  83. package/lib/commonjs/utils/errorUtils.js +0 -13
  84. package/lib/commonjs/utils/errorUtils.js.map +1 -1
  85. package/lib/commonjs/utils/index.js +7 -0
  86. package/lib/commonjs/utils/index.js.map +1 -1
  87. package/lib/commonjs/utils/sessionUtils.js +1 -8
  88. package/lib/commonjs/utils/sessionUtils.js.map +1 -1
  89. package/lib/commonjs/utils/validationUtils.js +1 -15
  90. package/lib/commonjs/utils/validationUtils.js.map +1 -1
  91. package/lib/module/core/OxyServices.js +1 -1
  92. package/lib/module/core/index.js +4 -6
  93. package/lib/module/core/index.js.map +1 -1
  94. package/lib/module/core/mixins/OxyServices.auth.js +36 -53
  95. package/lib/module/core/mixins/OxyServices.auth.js.map +1 -1
  96. package/lib/module/core/mixins/OxyServices.user.js +10 -17
  97. package/lib/module/core/mixins/OxyServices.user.js.map +1 -1
  98. package/lib/module/core/services/TokenService.js +27 -13
  99. package/lib/module/core/services/TokenService.js.map +1 -1
  100. package/lib/module/crypto/index.js +0 -3
  101. package/lib/module/crypto/index.js.map +1 -1
  102. package/lib/module/crypto/keyManager.js +21 -22
  103. package/lib/module/crypto/keyManager.js.map +1 -1
  104. package/lib/module/crypto/polyfill.js +1 -2
  105. package/lib/module/crypto/polyfill.js.map +1 -1
  106. package/lib/module/crypto/signatureService.js +18 -32
  107. package/lib/module/crypto/signatureService.js.map +1 -1
  108. package/lib/module/index.js +7 -19
  109. package/lib/module/index.js.map +1 -1
  110. package/lib/module/models/interfaces.js +0 -7
  111. package/lib/module/models/interfaces.js.map +1 -1
  112. package/lib/module/node/index.js +0 -3
  113. package/lib/module/node/index.js.map +1 -1
  114. package/lib/module/ui/components/BottomSheetRouter.js +2 -6
  115. package/lib/module/ui/components/BottomSheetRouter.js.map +1 -1
  116. package/lib/module/ui/components/OxyProvider.js +9 -20
  117. package/lib/module/ui/components/OxyProvider.js.map +1 -1
  118. package/lib/module/ui/context/OxyContext.js +779 -450
  119. package/lib/module/ui/context/OxyContext.js.map +1 -1
  120. package/lib/module/ui/context/hooks/useAuthOperations.js +545 -0
  121. package/lib/module/ui/context/hooks/useAuthOperations.js.map +1 -0
  122. package/lib/module/ui/context/hooks/useDeviceManagement.js +68 -0
  123. package/lib/module/ui/context/hooks/useDeviceManagement.js.map +1 -0
  124. package/lib/module/ui/context/hooks/useStorage.js +74 -0
  125. package/lib/module/ui/context/hooks/useStorage.js.map +1 -0
  126. package/lib/module/ui/hooks/index.js +0 -1
  127. package/lib/module/ui/hooks/index.js.map +1 -1
  128. package/lib/module/ui/hooks/mutations/index.js +1 -1
  129. package/lib/module/ui/hooks/mutations/index.js.map +1 -1
  130. package/lib/module/ui/hooks/mutations/useAccountMutations.js +21 -71
  131. package/lib/module/ui/hooks/mutations/useAccountMutations.js.map +1 -1
  132. package/lib/module/ui/hooks/queries/index.js +1 -1
  133. package/lib/module/ui/hooks/queries/index.js.map +1 -1
  134. package/lib/module/ui/hooks/queries/queryKeys.js +1 -3
  135. package/lib/module/ui/hooks/queries/queryKeys.js.map +1 -1
  136. package/lib/module/ui/hooks/queries/useAccountQueries.js +27 -61
  137. package/lib/module/ui/hooks/queries/useAccountQueries.js.map +1 -1
  138. package/lib/module/ui/hooks/queries/useServicesQueries.js +6 -4
  139. package/lib/module/ui/hooks/queries/useServicesQueries.js.map +1 -1
  140. package/lib/module/ui/hooks/useDeviceManagement.js +68 -0
  141. package/lib/module/ui/hooks/useDeviceManagement.js.map +1 -0
  142. package/lib/module/ui/hooks/useProfileEditing.js +5 -3
  143. package/lib/module/ui/hooks/useProfileEditing.js.map +1 -1
  144. package/lib/module/ui/hooks/useSessionManagement.js +279 -0
  145. package/lib/module/ui/hooks/useSessionManagement.js.map +1 -0
  146. package/lib/module/ui/index.js +1 -2
  147. package/lib/module/ui/index.js.map +1 -1
  148. package/lib/module/ui/navigation/routes.js +1 -5
  149. package/lib/module/ui/navigation/routes.js.map +1 -1
  150. package/lib/module/ui/screens/AccountCenterScreen.js +4 -9
  151. package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
  152. package/lib/module/ui/screens/AccountSettingsScreen.js +19 -37
  153. package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
  154. package/lib/module/ui/screens/AccountSwitcherScreen.js +5 -5
  155. package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
  156. package/lib/module/ui/screens/OxyAuthScreen.js +15 -2
  157. package/lib/module/ui/screens/OxyAuthScreen.js.map +1 -1
  158. package/lib/module/ui/screens/PrivacySettingsScreen.js +98 -77
  159. package/lib/module/ui/screens/PrivacySettingsScreen.js.map +1 -1
  160. package/lib/module/ui/screens/ProfileScreen.js +6 -6
  161. package/lib/module/ui/screens/ProfileScreen.js.map +1 -1
  162. package/lib/module/ui/stores/authStore.js +6 -54
  163. package/lib/module/ui/stores/authStore.js.map +1 -1
  164. package/lib/module/ui/styles/spacing.js +2 -6
  165. package/lib/module/ui/styles/spacing.js.map +1 -1
  166. package/lib/module/ui/utils/avatarUtils.js +12 -9
  167. package/lib/module/ui/utils/avatarUtils.js.map +1 -1
  168. package/lib/module/ui/utils/sessionHelpers.js +1 -7
  169. package/lib/module/ui/utils/sessionHelpers.js.map +1 -1
  170. package/lib/module/utils/deviceManager.js +171 -0
  171. package/lib/module/utils/deviceManager.js.map +1 -0
  172. package/lib/module/utils/errorUtils.js +0 -7
  173. package/lib/module/utils/errorUtils.js.map +1 -1
  174. package/lib/module/utils/index.js +1 -2
  175. package/lib/module/utils/index.js.map +1 -1
  176. package/lib/module/utils/sessionUtils.js +1 -8
  177. package/lib/module/utils/sessionUtils.js.map +1 -1
  178. package/lib/module/utils/validationUtils.js +0 -13
  179. package/lib/module/utils/validationUtils.js.map +1 -1
  180. package/lib/typescript/core/OxyServices.d.ts +1 -1
  181. package/lib/typescript/core/index.d.ts +3 -3
  182. package/lib/typescript/core/index.d.ts.map +1 -1
  183. package/lib/typescript/core/mixins/OxyServices.auth.d.ts +21 -44
  184. package/lib/typescript/core/mixins/OxyServices.auth.d.ts.map +1 -1
  185. package/lib/typescript/core/mixins/OxyServices.user.d.ts +1 -0
  186. package/lib/typescript/core/mixins/OxyServices.user.d.ts.map +1 -1
  187. package/lib/typescript/core/mixins/index.d.ts +8 -15
  188. package/lib/typescript/core/mixins/index.d.ts.map +1 -1
  189. package/lib/typescript/core/services/TokenService.d.ts.map +1 -1
  190. package/lib/typescript/crypto/index.d.ts +0 -1
  191. package/lib/typescript/crypto/index.d.ts.map +1 -1
  192. package/lib/typescript/crypto/keyManager.d.ts +2 -15
  193. package/lib/typescript/crypto/keyManager.d.ts.map +1 -1
  194. package/lib/typescript/crypto/polyfill.d.ts +1 -2
  195. package/lib/typescript/crypto/polyfill.d.ts.map +1 -1
  196. package/lib/typescript/crypto/signatureService.d.ts +0 -13
  197. package/lib/typescript/crypto/signatureService.d.ts.map +1 -1
  198. package/lib/typescript/index.d.ts +7 -12
  199. package/lib/typescript/index.d.ts.map +1 -1
  200. package/lib/typescript/models/interfaces.d.ts +36 -5
  201. package/lib/typescript/models/interfaces.d.ts.map +1 -1
  202. package/lib/typescript/models/session.d.ts +18 -3
  203. package/lib/typescript/models/session.d.ts.map +1 -1
  204. package/lib/typescript/node/index.d.ts +0 -1
  205. package/lib/typescript/node/index.d.ts.map +1 -1
  206. package/lib/typescript/ui/components/BottomSheetRouter.d.ts +0 -5
  207. package/lib/typescript/ui/components/BottomSheetRouter.d.ts.map +1 -1
  208. package/lib/typescript/ui/components/OxyProvider.d.ts.map +1 -1
  209. package/lib/typescript/ui/components/TextField/Addons/Outline.d.ts +2 -2
  210. package/lib/typescript/ui/components/TextField/helpers.d.ts +2 -2
  211. package/lib/typescript/ui/components/TextField/types.d.ts +0 -1
  212. package/lib/typescript/ui/components/TextField/types.d.ts.map +1 -1
  213. package/lib/typescript/ui/context/OxyContext.d.ts +28 -5
  214. package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
  215. package/lib/typescript/ui/context/hooks/useAuthOperations.d.ts +59 -0
  216. package/lib/typescript/ui/context/hooks/useAuthOperations.d.ts.map +1 -0
  217. package/lib/typescript/ui/context/hooks/useDeviceManagement.d.ts +27 -0
  218. package/lib/typescript/ui/context/hooks/useDeviceManagement.d.ts.map +1 -0
  219. package/lib/typescript/ui/context/hooks/useStorage.d.ts +22 -0
  220. package/lib/typescript/ui/context/hooks/useStorage.d.ts.map +1 -0
  221. package/lib/typescript/ui/hooks/index.d.ts +0 -1
  222. package/lib/typescript/ui/hooks/index.d.ts.map +1 -1
  223. package/lib/typescript/ui/hooks/mutations/index.d.ts +1 -1
  224. package/lib/typescript/ui/hooks/mutations/index.d.ts.map +1 -1
  225. package/lib/typescript/ui/hooks/mutations/useAccountMutations.d.ts +8 -19
  226. package/lib/typescript/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
  227. package/lib/typescript/ui/hooks/mutations/useServicesMutations.d.ts +1 -1
  228. package/lib/typescript/ui/hooks/mutations/useServicesMutations.d.ts.map +1 -1
  229. package/lib/typescript/ui/hooks/queries/index.d.ts +1 -1
  230. package/lib/typescript/ui/hooks/queries/index.d.ts.map +1 -1
  231. package/lib/typescript/ui/hooks/queries/queryKeys.d.ts +0 -2
  232. package/lib/typescript/ui/hooks/queries/queryKeys.d.ts.map +1 -1
  233. package/lib/typescript/ui/hooks/queries/useAccountQueries.d.ts +5 -17
  234. package/lib/typescript/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
  235. package/lib/typescript/ui/hooks/queries/useServicesQueries.d.ts.map +1 -1
  236. package/lib/typescript/ui/hooks/useDeviceManagement.d.ts +27 -0
  237. package/lib/typescript/ui/hooks/useDeviceManagement.d.ts.map +1 -0
  238. package/lib/typescript/ui/hooks/useProfileEditing.d.ts.map +1 -1
  239. package/lib/typescript/ui/hooks/useSessionManagement.d.ts +41 -0
  240. package/lib/typescript/ui/hooks/useSessionManagement.d.ts.map +1 -0
  241. package/lib/typescript/ui/index.d.ts +0 -1
  242. package/lib/typescript/ui/index.d.ts.map +1 -1
  243. package/lib/typescript/ui/navigation/routes.d.ts +1 -1
  244. package/lib/typescript/ui/navigation/routes.d.ts.map +1 -1
  245. package/lib/typescript/ui/screens/AccountCenterScreen.d.ts.map +1 -1
  246. package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
  247. package/lib/typescript/ui/screens/OxyAuthScreen.d.ts.map +1 -1
  248. package/lib/typescript/ui/screens/PrivacySettingsScreen.d.ts.map +1 -1
  249. package/lib/typescript/ui/stores/authStore.d.ts +1 -8
  250. package/lib/typescript/ui/stores/authStore.d.ts.map +1 -1
  251. package/lib/typescript/ui/styles/spacing.d.ts +0 -5
  252. package/lib/typescript/ui/styles/spacing.d.ts.map +1 -1
  253. package/lib/typescript/ui/utils/avatarUtils.d.ts +4 -1
  254. package/lib/typescript/ui/utils/avatarUtils.d.ts.map +1 -1
  255. package/lib/typescript/ui/utils/sessionHelpers.d.ts +0 -1
  256. package/lib/typescript/ui/utils/sessionHelpers.d.ts.map +1 -1
  257. package/lib/typescript/utils/deviceManager.d.ts +66 -0
  258. package/lib/typescript/utils/deviceManager.d.ts.map +1 -0
  259. package/lib/typescript/utils/errorUtils.d.ts +0 -6
  260. package/lib/typescript/utils/errorUtils.d.ts.map +1 -1
  261. package/lib/typescript/utils/index.d.ts +2 -0
  262. package/lib/typescript/utils/index.d.ts.map +1 -1
  263. package/lib/typescript/utils/sessionUtils.d.ts.map +1 -1
  264. package/lib/typescript/utils/validationUtils.d.ts +0 -8
  265. package/lib/typescript/utils/validationUtils.d.ts.map +1 -1
  266. package/package.json +1 -6
  267. package/src/core/OxyServices.ts +1 -1
  268. package/src/core/index.ts +5 -8
  269. package/src/core/mixins/OxyServices.auth.ts +44 -87
  270. package/src/core/mixins/OxyServices.user.ts +10 -18
  271. package/src/core/services/TokenService.ts +27 -16
  272. package/src/crypto/index.ts +1 -3
  273. package/src/crypto/keyManager.ts +21 -30
  274. package/src/crypto/polyfill.ts +1 -2
  275. package/src/crypto/signatureService.ts +19 -43
  276. package/src/index.ts +6 -41
  277. package/src/models/interfaces.ts +39 -12
  278. package/src/models/session.ts +19 -7
  279. package/src/node/index.ts +0 -3
  280. package/src/ui/components/BottomSheetRouter.tsx +1 -6
  281. package/src/ui/components/OxyProvider.tsx +10 -17
  282. package/src/ui/components/TextField/Addons/Outline.tsx +2 -2
  283. package/src/ui/components/TextField/helpers.tsx +2 -2
  284. package/src/ui/components/TextField/types.tsx +1 -1
  285. package/src/ui/context/OxyContext.tsx +831 -463
  286. package/src/ui/context/hooks/useAuthOperations.ts +620 -0
  287. package/src/ui/context/hooks/useDeviceManagement.ts +108 -0
  288. package/src/ui/context/hooks/useStorage.ts +104 -0
  289. package/src/ui/hooks/index.ts +1 -2
  290. package/src/ui/hooks/mutations/index.ts +0 -2
  291. package/src/ui/hooks/mutations/useAccountMutations.ts +20 -66
  292. package/src/ui/hooks/queries/index.ts +0 -2
  293. package/src/ui/hooks/queries/queryKeys.ts +0 -2
  294. package/src/ui/hooks/queries/useAccountQueries.ts +19 -53
  295. package/src/ui/hooks/queries/useServicesQueries.ts +5 -5
  296. package/src/ui/hooks/useDeviceManagement.ts +108 -0
  297. package/src/ui/hooks/useProfileEditing.ts +3 -3
  298. package/src/ui/hooks/useSessionManagement.ts +405 -0
  299. package/src/ui/index.ts +1 -2
  300. package/src/ui/navigation/routes.ts +2 -6
  301. package/src/ui/screens/AccountCenterScreen.tsx +4 -9
  302. package/src/ui/screens/AccountSettingsScreen.tsx +31 -49
  303. package/src/ui/screens/AccountSwitcherScreen.tsx +5 -5
  304. package/src/ui/screens/OxyAuthScreen.tsx +19 -4
  305. package/src/ui/screens/PrivacySettingsScreen.tsx +101 -67
  306. package/src/ui/screens/ProfileScreen.tsx +10 -10
  307. package/src/ui/stores/authStore.ts +8 -48
  308. package/src/ui/styles/spacing.ts +2 -15
  309. package/src/ui/utils/avatarUtils.ts +21 -19
  310. package/src/ui/utils/sessionHelpers.ts +0 -7
  311. package/src/utils/__tests__/validationUtils.test.ts +1 -16
  312. package/src/utils/deviceManager.ts +198 -0
  313. package/src/utils/errorUtils.ts +1 -8
  314. package/src/utils/index.ts +2 -1
  315. package/src/utils/sessionUtils.ts +0 -8
  316. package/src/utils/validationUtils.ts +0 -12
  317. package/lib/commonjs/adapters/expo/crypto.js +0 -56
  318. package/lib/commonjs/adapters/expo/crypto.js.map +0 -1
  319. package/lib/commonjs/adapters/expo/fetch.js +0 -30
  320. package/lib/commonjs/adapters/expo/fetch.js.map +0 -1
  321. package/lib/commonjs/adapters/expo/index.js +0 -48
  322. package/lib/commonjs/adapters/expo/index.js.map +0 -1
  323. package/lib/commonjs/adapters/expo/storage.js +0 -201
  324. package/lib/commonjs/adapters/expo/storage.js.map +0 -1
  325. package/lib/commonjs/adapters/index.js +0 -48
  326. package/lib/commonjs/adapters/index.js.map +0 -1
  327. package/lib/commonjs/adapters/node/crypto.js +0 -40
  328. package/lib/commonjs/adapters/node/crypto.js.map +0 -1
  329. package/lib/commonjs/adapters/node/fetch.js +0 -62
  330. package/lib/commonjs/adapters/node/fetch.js.map +0 -1
  331. package/lib/commonjs/adapters/node/index.js +0 -34
  332. package/lib/commonjs/adapters/node/index.js.map +0 -1
  333. package/lib/commonjs/adapters/node/storage.js +0 -163
  334. package/lib/commonjs/adapters/node/storage.js.map +0 -1
  335. package/lib/commonjs/core/identity-session/DeviceManager.js +0 -237
  336. package/lib/commonjs/core/identity-session/DeviceManager.js.map +0 -1
  337. package/lib/commonjs/core/identity-session/INTEGRATION_GUIDE.md +0 -287
  338. package/lib/commonjs/core/identity-session/IdentityManager.js +0 -400
  339. package/lib/commonjs/core/identity-session/IdentityManager.js.map +0 -1
  340. package/lib/commonjs/core/identity-session/IdentitySessionCore.js +0 -394
  341. package/lib/commonjs/core/identity-session/IdentitySessionCore.js.map +0 -1
  342. package/lib/commonjs/core/identity-session/RefreshManager.js +0 -137
  343. package/lib/commonjs/core/identity-session/RefreshManager.js.map +0 -1
  344. package/lib/commonjs/core/identity-session/SessionManager.js +0 -427
  345. package/lib/commonjs/core/identity-session/SessionManager.js.map +0 -1
  346. package/lib/commonjs/core/identity-session/createIdentitySessionCore.js +0 -24
  347. package/lib/commonjs/core/identity-session/createIdentitySessionCore.js.map +0 -1
  348. package/lib/commonjs/core/identity-session/errors.js +0 -176
  349. package/lib/commonjs/core/identity-session/errors.js.map +0 -1
  350. package/lib/commonjs/core/identity-session/index.js +0 -80
  351. package/lib/commonjs/core/identity-session/index.js.map +0 -1
  352. package/lib/commonjs/core/identity-session/types.js +0 -2
  353. package/lib/commonjs/core/identity-session/types.js.map +0 -1
  354. package/lib/commonjs/crypto/README.md +0 -142
  355. package/lib/commonjs/crypto/core.js +0 -147
  356. package/lib/commonjs/crypto/core.js.map +0 -1
  357. package/lib/commonjs/node/signatureService.js +0 -107
  358. package/lib/commonjs/node/signatureService.js.map +0 -1
  359. package/lib/commonjs/ui/hooks/auth/index.js +0 -37
  360. package/lib/commonjs/ui/hooks/auth/index.js.map +0 -1
  361. package/lib/commonjs/ui/hooks/auth/useUsernameValidation.js +0 -171
  362. package/lib/commonjs/ui/hooks/auth/useUsernameValidation.js.map +0 -1
  363. package/lib/commonjs/ui/hooks/useAvatarPicker.js +0 -52
  364. package/lib/commonjs/ui/hooks/useAvatarPicker.js.map +0 -1
  365. package/lib/commonjs/ui/hooks/useIdentityTransfer.js +0 -125
  366. package/lib/commonjs/ui/hooks/useIdentityTransfer.js.map +0 -1
  367. package/lib/commonjs/ui/hooks/useTransferCodesPersistence.js +0 -81
  368. package/lib/commonjs/ui/hooks/useTransferCodesPersistence.js.map +0 -1
  369. package/lib/commonjs/ui/hooks/useTransferQueries.js +0 -85
  370. package/lib/commonjs/ui/hooks/useTransferQueries.js.map +0 -1
  371. package/lib/commonjs/ui/stores/transferStore.js +0 -157
  372. package/lib/commonjs/ui/stores/transferStore.js.map +0 -1
  373. package/lib/module/adapters/expo/crypto.js +0 -51
  374. package/lib/module/adapters/expo/crypto.js.map +0 -1
  375. package/lib/module/adapters/expo/fetch.js +0 -26
  376. package/lib/module/adapters/expo/fetch.js.map +0 -1
  377. package/lib/module/adapters/expo/index.js +0 -45
  378. package/lib/module/adapters/expo/index.js.map +0 -1
  379. package/lib/module/adapters/expo/storage.js +0 -198
  380. package/lib/module/adapters/expo/storage.js.map +0 -1
  381. package/lib/module/adapters/index.js +0 -45
  382. package/lib/module/adapters/index.js.map +0 -1
  383. package/lib/module/adapters/node/crypto.js +0 -36
  384. package/lib/module/adapters/node/crypto.js.map +0 -1
  385. package/lib/module/adapters/node/fetch.js +0 -57
  386. package/lib/module/adapters/node/fetch.js.map +0 -1
  387. package/lib/module/adapters/node/index.js +0 -31
  388. package/lib/module/adapters/node/index.js.map +0 -1
  389. package/lib/module/adapters/node/storage.js +0 -159
  390. package/lib/module/adapters/node/storage.js.map +0 -1
  391. package/lib/module/core/identity-session/DeviceManager.js +0 -232
  392. package/lib/module/core/identity-session/DeviceManager.js.map +0 -1
  393. package/lib/module/core/identity-session/INTEGRATION_GUIDE.md +0 -287
  394. package/lib/module/core/identity-session/IdentityManager.js +0 -395
  395. package/lib/module/core/identity-session/IdentityManager.js.map +0 -1
  396. package/lib/module/core/identity-session/IdentitySessionCore.js +0 -390
  397. package/lib/module/core/identity-session/IdentitySessionCore.js.map +0 -1
  398. package/lib/module/core/identity-session/RefreshManager.js +0 -132
  399. package/lib/module/core/identity-session/RefreshManager.js.map +0 -1
  400. package/lib/module/core/identity-session/SessionManager.js +0 -422
  401. package/lib/module/core/identity-session/SessionManager.js.map +0 -1
  402. package/lib/module/core/identity-session/createIdentitySessionCore.js +0 -21
  403. package/lib/module/core/identity-session/createIdentitySessionCore.js.map +0 -1
  404. package/lib/module/core/identity-session/errors.js +0 -170
  405. package/lib/module/core/identity-session/errors.js.map +0 -1
  406. package/lib/module/core/identity-session/index.js +0 -17
  407. package/lib/module/core/identity-session/index.js.map +0 -1
  408. package/lib/module/core/identity-session/types.js +0 -2
  409. package/lib/module/core/identity-session/types.js.map +0 -1
  410. package/lib/module/crypto/README.md +0 -142
  411. package/lib/module/crypto/core.js +0 -133
  412. package/lib/module/crypto/core.js.map +0 -1
  413. package/lib/module/node/signatureService.js +0 -101
  414. package/lib/module/node/signatureService.js.map +0 -1
  415. package/lib/module/ui/hooks/auth/index.js +0 -7
  416. package/lib/module/ui/hooks/auth/index.js.map +0 -1
  417. package/lib/module/ui/hooks/auth/useUsernameValidation.js +0 -167
  418. package/lib/module/ui/hooks/auth/useUsernameValidation.js.map +0 -1
  419. package/lib/module/ui/hooks/useAvatarPicker.js +0 -48
  420. package/lib/module/ui/hooks/useAvatarPicker.js.map +0 -1
  421. package/lib/module/ui/hooks/useIdentityTransfer.js +0 -121
  422. package/lib/module/ui/hooks/useIdentityTransfer.js.map +0 -1
  423. package/lib/module/ui/hooks/useTransferCodesPersistence.js +0 -77
  424. package/lib/module/ui/hooks/useTransferCodesPersistence.js.map +0 -1
  425. package/lib/module/ui/hooks/useTransferQueries.js +0 -80
  426. package/lib/module/ui/hooks/useTransferQueries.js.map +0 -1
  427. package/lib/module/ui/stores/transferStore.js +0 -152
  428. package/lib/module/ui/stores/transferStore.js.map +0 -1
  429. package/lib/typescript/adapters/expo/crypto.d.ts +0 -17
  430. package/lib/typescript/adapters/expo/crypto.d.ts.map +0 -1
  431. package/lib/typescript/adapters/expo/fetch.d.ts +0 -16
  432. package/lib/typescript/adapters/expo/fetch.d.ts.map +0 -1
  433. package/lib/typescript/adapters/expo/index.d.ts +0 -23
  434. package/lib/typescript/adapters/expo/index.d.ts.map +0 -1
  435. package/lib/typescript/adapters/expo/storage.d.ts +0 -23
  436. package/lib/typescript/adapters/expo/storage.d.ts.map +0 -1
  437. package/lib/typescript/adapters/index.d.ts +0 -17
  438. package/lib/typescript/adapters/index.d.ts.map +0 -1
  439. package/lib/typescript/adapters/node/crypto.d.ts +0 -17
  440. package/lib/typescript/adapters/node/crypto.d.ts.map +0 -1
  441. package/lib/typescript/adapters/node/fetch.d.ts +0 -16
  442. package/lib/typescript/adapters/node/fetch.d.ts.map +0 -1
  443. package/lib/typescript/adapters/node/index.d.ts +0 -23
  444. package/lib/typescript/adapters/node/index.d.ts.map +0 -1
  445. package/lib/typescript/adapters/node/storage.d.ts +0 -23
  446. package/lib/typescript/adapters/node/storage.d.ts.map +0 -1
  447. package/lib/typescript/core/identity-session/DeviceManager.d.ts +0 -64
  448. package/lib/typescript/core/identity-session/DeviceManager.d.ts.map +0 -1
  449. package/lib/typescript/core/identity-session/IdentityManager.d.ts +0 -88
  450. package/lib/typescript/core/identity-session/IdentityManager.d.ts.map +0 -1
  451. package/lib/typescript/core/identity-session/IdentitySessionCore.d.ts +0 -141
  452. package/lib/typescript/core/identity-session/IdentitySessionCore.d.ts.map +0 -1
  453. package/lib/typescript/core/identity-session/RefreshManager.d.ts +0 -36
  454. package/lib/typescript/core/identity-session/RefreshManager.d.ts.map +0 -1
  455. package/lib/typescript/core/identity-session/SessionManager.d.ts +0 -104
  456. package/lib/typescript/core/identity-session/SessionManager.d.ts.map +0 -1
  457. package/lib/typescript/core/identity-session/createIdentitySessionCore.d.ts +0 -11
  458. package/lib/typescript/core/identity-session/createIdentitySessionCore.d.ts.map +0 -1
  459. package/lib/typescript/core/identity-session/errors.d.ts +0 -63
  460. package/lib/typescript/core/identity-session/errors.d.ts.map +0 -1
  461. package/lib/typescript/core/identity-session/index.d.ts +0 -14
  462. package/lib/typescript/core/identity-session/index.d.ts.map +0 -1
  463. package/lib/typescript/core/identity-session/types.d.ts +0 -196
  464. package/lib/typescript/core/identity-session/types.d.ts.map +0 -1
  465. package/lib/typescript/crypto/core.d.ts +0 -56
  466. package/lib/typescript/crypto/core.d.ts.map +0 -1
  467. package/lib/typescript/node/signatureService.d.ts +0 -55
  468. package/lib/typescript/node/signatureService.d.ts.map +0 -1
  469. package/lib/typescript/ui/hooks/auth/index.d.ts +0 -6
  470. package/lib/typescript/ui/hooks/auth/index.d.ts.map +0 -1
  471. package/lib/typescript/ui/hooks/auth/useUsernameValidation.d.ts +0 -32
  472. package/lib/typescript/ui/hooks/auth/useUsernameValidation.d.ts.map +0 -1
  473. package/lib/typescript/ui/hooks/useAvatarPicker.d.ts +0 -18
  474. package/lib/typescript/ui/hooks/useAvatarPicker.d.ts.map +0 -1
  475. package/lib/typescript/ui/hooks/useIdentityTransfer.d.ts +0 -24
  476. package/lib/typescript/ui/hooks/useIdentityTransfer.d.ts.map +0 -1
  477. package/lib/typescript/ui/hooks/useTransferCodesPersistence.d.ts +0 -6
  478. package/lib/typescript/ui/hooks/useTransferCodesPersistence.d.ts.map +0 -1
  479. package/lib/typescript/ui/hooks/useTransferQueries.d.ts +0 -26
  480. package/lib/typescript/ui/hooks/useTransferQueries.d.ts.map +0 -1
  481. package/lib/typescript/ui/stores/transferStore.d.ts +0 -36
  482. package/lib/typescript/ui/stores/transferStore.d.ts.map +0 -1
  483. package/src/adapters/expo/crypto.ts +0 -55
  484. package/src/adapters/expo/fetch.ts +0 -28
  485. package/src/adapters/expo/index.ts +0 -51
  486. package/src/adapters/expo/storage.ts +0 -228
  487. package/src/adapters/index.ts +0 -48
  488. package/src/adapters/node/crypto.ts +0 -39
  489. package/src/adapters/node/fetch.ts +0 -59
  490. package/src/adapters/node/index.ts +0 -37
  491. package/src/adapters/node/storage.ts +0 -170
  492. package/src/core/identity-session/DeviceManager.ts +0 -273
  493. package/src/core/identity-session/INTEGRATION_GUIDE.md +0 -287
  494. package/src/core/identity-session/IdentityManager.ts +0 -474
  495. package/src/core/identity-session/IdentitySessionCore.ts +0 -464
  496. package/src/core/identity-session/RefreshManager.ts +0 -189
  497. package/src/core/identity-session/SessionManager.ts +0 -500
  498. package/src/core/identity-session/createIdentitySessionCore.ts +0 -19
  499. package/src/core/identity-session/errors.ts +0 -197
  500. package/src/core/identity-session/index.ts +0 -15
  501. package/src/core/identity-session/types.ts +0 -188
  502. package/src/crypto/README.md +0 -142
  503. package/src/crypto/__tests__/core.test.ts +0 -203
  504. package/src/crypto/core.ts +0 -142
  505. package/src/node/signatureService.ts +0 -126
  506. package/src/ui/hooks/auth/index.ts +0 -9
  507. package/src/ui/hooks/auth/useUsernameValidation.ts +0 -177
  508. package/src/ui/hooks/useAvatarPicker.ts +0 -62
  509. package/src/ui/hooks/useIdentityTransfer.ts +0 -135
  510. package/src/ui/hooks/useTransferCodesPersistence.ts +0 -80
  511. package/src/ui/hooks/useTransferQueries.ts +0 -102
  512. package/src/ui/stores/transferStore.ts +0 -201
@@ -0,0 +1,108 @@
1
+ import { useCallback } from 'react';
2
+ import type { ApiError } from '../../../models/interfaces';
3
+ import { DeviceManager } from '../../../utils/deviceManager';
4
+ import type { OxyServices } from '../../../core';
5
+ import { handleAuthError } from '../../utils/errorHandlers';
6
+
7
+ export interface UseDeviceManagementOptions {
8
+ oxyServices: OxyServices;
9
+ activeSessionId: string | null;
10
+ onError?: (error: ApiError) => void;
11
+ clearSessionState: () => Promise<void>;
12
+ logger?: (message: string, error?: unknown) => void;
13
+ }
14
+
15
+ export interface UseDeviceManagementResult {
16
+ getDeviceSessions: () => Promise<
17
+ Array<{
18
+ sessionId: string;
19
+ deviceId: string;
20
+ deviceName?: string;
21
+ lastActive?: string;
22
+ expiresAt?: string;
23
+ }>
24
+ >;
25
+ logoutAllDeviceSessions: () => Promise<void>;
26
+ updateDeviceName: (deviceName: string) => Promise<void>;
27
+ }
28
+
29
+ /**
30
+ * Provide device session management helpers tied to the current active session.
31
+ *
32
+ * @param options - Device management configuration
33
+ */
34
+ export const useDeviceManagement = ({
35
+ oxyServices,
36
+ activeSessionId,
37
+ onError,
38
+ clearSessionState,
39
+ logger,
40
+ }: UseDeviceManagementOptions): UseDeviceManagementResult => {
41
+ const getDeviceSessions = useCallback(async (): Promise<
42
+ Array<{
43
+ sessionId: string;
44
+ deviceId: string;
45
+ deviceName?: string;
46
+ lastActive?: string;
47
+ expiresAt?: string;
48
+ }>
49
+ > => {
50
+ if (!activeSessionId) throw new Error('No active session');
51
+ try {
52
+ return await oxyServices.getDeviceSessions(activeSessionId);
53
+ } catch (error) {
54
+ handleAuthError(error, {
55
+ defaultMessage: 'Failed to get device sessions',
56
+ code: 'GET_DEVICE_SESSIONS_ERROR',
57
+ onError,
58
+ logger,
59
+ });
60
+ throw error instanceof Error ? error : new Error('Failed to get device sessions');
61
+ }
62
+ }, [activeSessionId, logger, onError, oxyServices]);
63
+
64
+ const logoutAllDeviceSessions = useCallback(async (): Promise<void> => {
65
+ if (!activeSessionId) throw new Error('No active session');
66
+
67
+ try {
68
+ await oxyServices.logoutAllDeviceSessions(activeSessionId);
69
+ await clearSessionState();
70
+ } catch (error) {
71
+ handleAuthError(error, {
72
+ defaultMessage: 'Failed to logout all device sessions',
73
+ code: 'LOGOUT_ALL_DEVICES_ERROR',
74
+ onError,
75
+ logger,
76
+ });
77
+ throw error instanceof Error ? error : new Error('Failed to logout all device sessions');
78
+ }
79
+ }, [activeSessionId, clearSessionState, logger, onError, oxyServices]);
80
+
81
+ const updateDeviceName = useCallback(
82
+ async (deviceName: string): Promise<void> => {
83
+ if (!activeSessionId) throw new Error('No active session');
84
+
85
+ try {
86
+ await oxyServices.updateDeviceName(activeSessionId, deviceName);
87
+ await DeviceManager.updateDeviceName(deviceName);
88
+ } catch (error) {
89
+ handleAuthError(error, {
90
+ defaultMessage: 'Failed to update device name',
91
+ code: 'UPDATE_DEVICE_NAME_ERROR',
92
+ onError,
93
+ logger,
94
+ });
95
+ throw error instanceof Error ? error : new Error('Failed to update device name');
96
+ }
97
+ },
98
+ [activeSessionId, logger, onError, oxyServices],
99
+ );
100
+
101
+ return {
102
+ getDeviceSessions,
103
+ logoutAllDeviceSessions,
104
+ updateDeviceName,
105
+ };
106
+ };
107
+
108
+
@@ -0,0 +1,104 @@
1
+ import { useCallback, useEffect, useRef, useState } from 'react';
2
+ import type { ApiError } from '../../../models/interfaces';
3
+ import { createPlatformStorage, type StorageInterface } from '../../utils/storageHelpers';
4
+ import { extractErrorMessage } from '../../utils/errorHandlers';
5
+
6
+ export interface UseStorageOptions {
7
+ onError?: (error: ApiError) => void;
8
+ logger?: (message: string, error?: unknown) => void;
9
+ errorCode?: string;
10
+ }
11
+
12
+ export interface UseStorageResult {
13
+ storage: StorageInterface | null;
14
+ isReady: boolean;
15
+ error: string | null;
16
+ refresh: () => Promise<StorageInterface | null>;
17
+ withStorage: <T>(callback: (storage: StorageInterface) => Promise<T>) => Promise<T | null>;
18
+ }
19
+
20
+ const DEFAULT_ERROR_CODE = 'STORAGE_INIT_ERROR';
21
+
22
+ /**
23
+ * React hook that exposes a platform-agnostic storage reference.
24
+ * Handles initialization, error propagation, and lazy re-initialization.
25
+ *
26
+ * @param options - Optional configuration for error reporting and logging
27
+ */
28
+ export const useStorage = ({
29
+ onError,
30
+ logger,
31
+ errorCode = DEFAULT_ERROR_CODE,
32
+ }: UseStorageOptions = {}): UseStorageResult => {
33
+ const [storage, setStorage] = useState<StorageInterface | null>(null);
34
+ const [error, setError] = useState<string | null>(null);
35
+ const initializingRef = useRef<Promise<StorageInterface | null> | null>(null);
36
+
37
+ const notifyError = useCallback(
38
+ (err: unknown) => {
39
+ const message = extractErrorMessage(err, 'Failed to initialize storage');
40
+ setError(message);
41
+
42
+ if (logger) {
43
+ logger(message, err);
44
+ }
45
+
46
+ onError?.({
47
+ message,
48
+ code: errorCode,
49
+ status: 500,
50
+ });
51
+ },
52
+ [errorCode, logger, onError],
53
+ );
54
+
55
+ const createStorageInstance = useCallback(async (): Promise<StorageInterface | null> => {
56
+ try {
57
+ const platformStorage = await createPlatformStorage();
58
+ setStorage(platformStorage);
59
+ setError(null);
60
+ return platformStorage;
61
+ } catch (err) {
62
+ notifyError(err);
63
+ setStorage(null);
64
+ return null;
65
+ }
66
+ }, [notifyError]);
67
+
68
+ const refresh = useCallback(async (): Promise<StorageInterface | null> => {
69
+ if (!initializingRef.current) {
70
+ initializingRef.current = createStorageInstance().finally(() => {
71
+ initializingRef.current = null;
72
+ });
73
+ }
74
+
75
+ return initializingRef.current;
76
+ }, [createStorageInstance]);
77
+
78
+ useEffect(() => {
79
+ refresh().catch((err) => {
80
+ notifyError(err);
81
+ });
82
+ }, [refresh, notifyError]);
83
+
84
+ const withStorage = useCallback(
85
+ async <T,>(callback: (resolvedStorage: StorageInterface) => Promise<T>): Promise<T | null> => {
86
+ const resolvedStorage = storage ?? (await refresh());
87
+ if (!resolvedStorage) {
88
+ return null;
89
+ }
90
+ return callback(resolvedStorage);
91
+ },
92
+ [refresh, storage],
93
+ );
94
+
95
+ return {
96
+ storage,
97
+ isReady: Boolean(storage) && !error,
98
+ error,
99
+ refresh,
100
+ withStorage,
101
+ };
102
+ };
103
+
104
+
@@ -1,5 +1,4 @@
1
1
  export { useFollow, useFollowerCounts } from './useFollow';
2
2
  export { useFileDownloadUrl, setOxyFileUrlInstance } from './useFileDownloadUrl';
3
3
  export { useThemeStyles } from './useThemeStyles';
4
- export { useThemeColors } from './useThemeColors';
5
- export * from './auth';
4
+ export { useThemeColors } from './useThemeColors';
@@ -12,8 +12,6 @@ export {
12
12
  useUpdateAccountSettings,
13
13
  useUpdatePrivacySettings,
14
14
  useUploadFile,
15
- useUnblockUser,
16
- useUnrestrictUser,
17
15
  } from './useAccountMutations';
18
16
 
19
17
  // Service mutation hooks (sessions, devices)
@@ -1,16 +1,19 @@
1
1
  import { useMutation, useQueryClient } from '@tanstack/react-query';
2
2
  import type { User } from '../../../models/interfaces';
3
+ import type { ClientSession } from '../../../models/session';
3
4
  import { queryKeys, invalidateAccountQueries, invalidateUserQueries } from '../queries/queryKeys';
4
5
  import { useOxy } from '../../context/OxyContext';
5
6
  import { toast } from '../../../lib/sonner';
6
7
  import { refreshAvatarInStore } from '../../utils/avatarUtils';
7
- import { useAuthStore } from '../../stores/authStore';
8
+
9
+ const getDeviceIdForSession = (sessions: ClientSession[] = [], sessionId: string | null) =>
10
+ sessionId ? sessions.find((s) => s.sessionId === sessionId)?.deviceId : undefined;
8
11
 
9
12
  /**
10
13
  * Update user profile with optimistic updates and offline queue support
11
14
  */
12
15
  export const useUpdateProfile = () => {
13
- const { oxyServices, activeSessionId, user, syncIdentity } = useOxy();
16
+ const { oxyServices, activeSessionId, user, syncIdentity, sessions } = useOxy();
14
17
  const queryClient = useQueryClient();
15
18
 
16
19
  return useMutation({
@@ -19,7 +22,7 @@ export const useUpdateProfile = () => {
19
22
  if (!oxyServices.hasValidToken() && activeSessionId) {
20
23
  try {
21
24
  // Try to get token for the session
22
- await oxyServices.getTokenBySession(activeSessionId);
25
+ await oxyServices.getTokenBySession(activeSessionId, getDeviceIdForSession(sessions, activeSessionId));
23
26
  } catch (tokenError) {
24
27
  // If getting token fails, might be an offline session - try syncing
25
28
  const errorMessage = tokenError instanceof Error ? tokenError.message : String(tokenError);
@@ -27,7 +30,7 @@ export const useUpdateProfile = () => {
27
30
  try {
28
31
  await syncIdentity();
29
32
  // Retry getting token after sync
30
- await oxyServices.getTokenBySession(activeSessionId);
33
+ await oxyServices.getTokenBySession(activeSessionId, getDeviceIdForSession(sessions, activeSessionId));
31
34
  } catch (syncError) {
32
35
  throw new Error('Session needs to be synced. Please try again.');
33
36
  }
@@ -49,7 +52,7 @@ export const useUpdateProfile = () => {
49
52
  if (activeSessionId) {
50
53
  try {
51
54
  await syncIdentity();
52
- await oxyServices.getTokenBySession(activeSessionId);
55
+ await oxyServices.getTokenBySession(activeSessionId, getDeviceIdForSession(sessions, activeSessionId));
53
56
  // Retry the update after getting token
54
57
  return await oxyServices.updateProfile(updates);
55
58
  } catch (retryError) {
@@ -108,9 +111,6 @@ export const useUpdateProfile = () => {
108
111
  queryClient.setQueryData(queryKeys.users.profile(activeSessionId), data);
109
112
  }
110
113
 
111
- // Update authStore so frontend components see the changes immediately
112
- useAuthStore.getState().setUser(data);
113
-
114
114
  // If avatar was updated, refresh accountStore with cache-busted URL
115
115
  if (updates.avatar && activeSessionId && oxyServices) {
116
116
  refreshAvatarInStore(activeSessionId, updates.avatar, oxyServices);
@@ -127,7 +127,7 @@ export const useUpdateProfile = () => {
127
127
  * Upload avatar with progress tracking and offline queue support
128
128
  */
129
129
  export const useUploadAvatar = () => {
130
- const { oxyServices, activeSessionId, syncIdentity } = useOxy();
130
+ const { oxyServices, activeSessionId, syncIdentity, sessions } = useOxy();
131
131
  const queryClient = useQueryClient();
132
132
 
133
133
  return useMutation({
@@ -135,13 +135,13 @@ export const useUploadAvatar = () => {
135
135
  // Ensure we have a valid token before making the request
136
136
  if (!oxyServices.hasValidToken() && activeSessionId) {
137
137
  try {
138
- await oxyServices.getTokenBySession(activeSessionId);
138
+ await oxyServices.getTokenBySession(activeSessionId, getDeviceIdForSession(sessions, activeSessionId));
139
139
  } catch (tokenError) {
140
140
  const errorMessage = tokenError instanceof Error ? tokenError.message : String(tokenError);
141
141
  if (errorMessage.includes('AUTH_REQUIRED_OFFLINE_SESSION') || errorMessage.includes('offline')) {
142
142
  try {
143
143
  await syncIdentity();
144
- await oxyServices.getTokenBySession(activeSessionId);
144
+ await oxyServices.getTokenBySession(activeSessionId, getDeviceIdForSession(sessions, activeSessionId));
145
145
  } catch (syncError) {
146
146
  throw new Error('Session needs to be synced. Please try again.');
147
147
  }
@@ -171,7 +171,7 @@ export const useUploadAvatar = () => {
171
171
  if (activeSessionId) {
172
172
  try {
173
173
  await syncIdentity();
174
- await oxyServices.getTokenBySession(activeSessionId);
174
+ await oxyServices.getTokenBySession(activeSessionId, getDeviceIdForSession(sessions, activeSessionId));
175
175
  // Retry upload
176
176
  const uploadResult = await oxyServices.assetUpload(file as any, 'public');
177
177
  const fileId = uploadResult?.file?.id || uploadResult?.id || uploadResult;
@@ -224,9 +224,6 @@ export const useUploadAvatar = () => {
224
224
  queryClient.setQueryData(queryKeys.users.profile(activeSessionId), data);
225
225
  }
226
226
 
227
- // Update authStore so frontend components see the changes immediately
228
- useAuthStore.getState().setUser(data);
229
-
230
227
  // Refresh accountStore with cache-busted URL if avatar was updated
231
228
  if (data?.avatar && activeSessionId && oxyServices) {
232
229
  refreshAvatarInStore(activeSessionId, data.avatar, oxyServices);
@@ -276,9 +273,6 @@ export const useUpdateAccountSettings = () => {
276
273
  onSuccess: (data) => {
277
274
  queryClient.setQueryData(queryKeys.accounts.current(), data);
278
275
 
279
- // Update authStore so frontend components see the changes immediately
280
- useAuthStore.getState().setUser(data);
281
-
282
276
  invalidateAccountQueries(queryClient);
283
277
  toast.success('Settings updated successfully');
284
278
  },
@@ -292,7 +286,7 @@ export const useUpdateAccountSettings = () => {
292
286
  * Update privacy settings with optimistic updates and authentication handling
293
287
  */
294
288
  export const useUpdatePrivacySettings = () => {
295
- const { oxyServices, activeSessionId, syncIdentity } = useOxy();
289
+ const { oxyServices, activeSessionId, syncIdentity, sessions } = useOxy();
296
290
  const queryClient = useQueryClient();
297
291
 
298
292
  return useMutation({
@@ -308,7 +302,7 @@ export const useUpdatePrivacySettings = () => {
308
302
  if (!oxyServices.hasValidToken() && activeSessionId) {
309
303
  try {
310
304
  // Try to get token for the session
311
- await oxyServices.getTokenBySession(activeSessionId);
305
+ await oxyServices.getTokenBySession(activeSessionId, getDeviceIdForSession(sessions, activeSessionId));
312
306
  } catch (tokenError) {
313
307
  // If getting token fails, might be an offline session - try syncing
314
308
  const errorMessage = tokenError instanceof Error ? tokenError.message : String(tokenError);
@@ -316,7 +310,7 @@ export const useUpdatePrivacySettings = () => {
316
310
  try {
317
311
  await syncIdentity();
318
312
  // Retry getting token after sync
319
- await oxyServices.getTokenBySession(activeSessionId);
313
+ await oxyServices.getTokenBySession(activeSessionId, getDeviceIdForSession(sessions, activeSessionId));
320
314
  } catch (syncError) {
321
315
  throw new Error('Session needs to be synced. Please try again.');
322
316
  }
@@ -338,7 +332,7 @@ export const useUpdatePrivacySettings = () => {
338
332
  if (activeSessionId) {
339
333
  try {
340
334
  await syncIdentity();
341
- await oxyServices.getTokenBySession(activeSessionId);
335
+ await oxyServices.getTokenBySession(activeSessionId, getDeviceIdForSession(sessions, activeSessionId));
342
336
  // Retry the update after getting token
343
337
  return await oxyServices.updatePrivacySettings(settings, targetUserId);
344
338
  } catch (retryError) {
@@ -412,9 +406,6 @@ export const useUpdatePrivacySettings = () => {
412
406
  privacySettings: data,
413
407
  };
414
408
  queryClient.setQueryData<User>(queryKeys.accounts.current(), updatedUser);
415
-
416
- // Update authStore so frontend components see the changes immediately
417
- useAuthStore.getState().setUser(updatedUser);
418
409
  }
419
410
  invalidateAccountQueries(queryClient);
420
411
  },
@@ -433,7 +424,7 @@ export const useUpdatePrivacySettings = () => {
433
424
  * Upload file with authentication handling and progress tracking
434
425
  */
435
426
  export const useUploadFile = () => {
436
- const { oxyServices, activeSessionId, syncIdentity } = useOxy();
427
+ const { oxyServices, activeSessionId, syncIdentity, sessions } = useOxy();
437
428
 
438
429
  return useMutation({
439
430
  mutationFn: async ({
@@ -451,7 +442,7 @@ export const useUploadFile = () => {
451
442
  if (!oxyServices.hasValidToken() && activeSessionId) {
452
443
  try {
453
444
  // Try to get token for the session
454
- await oxyServices.getTokenBySession(activeSessionId);
445
+ await oxyServices.getTokenBySession(activeSessionId, getDeviceIdForSession(sessions, activeSessionId));
455
446
  } catch (tokenError) {
456
447
  // If getting token fails, might be an offline session - try syncing
457
448
  const errorMessage = tokenError instanceof Error ? tokenError.message : String(tokenError);
@@ -459,7 +450,7 @@ export const useUploadFile = () => {
459
450
  try {
460
451
  await syncIdentity();
461
452
  // Retry getting token after sync
462
- await oxyServices.getTokenBySession(activeSessionId);
453
+ await oxyServices.getTokenBySession(activeSessionId, getDeviceIdForSession(sessions, activeSessionId));
463
454
  } catch (syncError) {
464
455
  throw new Error('Session needs to be synced. Please try again.');
465
456
  }
@@ -481,7 +472,7 @@ export const useUploadFile = () => {
481
472
  if (activeSessionId) {
482
473
  try {
483
474
  await syncIdentity();
484
- await oxyServices.getTokenBySession(activeSessionId);
475
+ await oxyServices.getTokenBySession(activeSessionId, getDeviceIdForSession(sessions, activeSessionId));
485
476
  // Retry the upload after getting token
486
477
  return await oxyServices.assetUpload(file as any, visibility, metadata, onProgress);
487
478
  } catch (retryError) {
@@ -498,40 +489,3 @@ export const useUploadFile = () => {
498
489
  },
499
490
  });
500
491
  };
501
-
502
- /**
503
- * Unblock a user with query invalidation
504
- */
505
- export const useUnblockUser = () => {
506
- const { oxyServices } = useOxy();
507
- const queryClient = useQueryClient();
508
-
509
- return useMutation({
510
- mutationFn: async (userId: string) => {
511
- return await oxyServices.unblockUser(userId);
512
- },
513
- onSuccess: () => {
514
- // Invalidate blocked users query to refetch the list
515
- queryClient.invalidateQueries({ queryKey: queryKeys.privacy.blocked() });
516
- },
517
- });
518
- };
519
-
520
- /**
521
- * Unrestrict a user with query invalidation
522
- */
523
- export const useUnrestrictUser = () => {
524
- const { oxyServices } = useOxy();
525
- const queryClient = useQueryClient();
526
-
527
- return useMutation({
528
- mutationFn: async (userId: string) => {
529
- return await oxyServices.unrestrictUser(userId);
530
- },
531
- onSuccess: () => {
532
- // Invalidate restricted users query to refetch the list
533
- queryClient.invalidateQueries({ queryKey: queryKeys.privacy.restricted() });
534
- },
535
- });
536
- };
537
-
@@ -14,8 +14,6 @@ export {
14
14
  useUserByUsername,
15
15
  useUsersBySessions,
16
16
  usePrivacySettings,
17
- useBlockedUsers,
18
- useRestrictedUsers,
19
17
  } from './useAccountQueries';
20
18
 
21
19
  // Service query hooks (sessions, devices, security)
@@ -53,8 +53,6 @@ export const queryKeys = {
53
53
  privacy: {
54
54
  all: ['privacy'] as const,
55
55
  settings: (userId?: string) => [...queryKeys.privacy.all, 'settings', userId || 'current'] as const,
56
- blocked: () => [...queryKeys.privacy.all, 'blocked'] as const,
57
- restricted: () => [...queryKeys.privacy.all, 'restricted'] as const,
58
56
  },
59
57
 
60
58
  // Security activity queries
@@ -19,8 +19,8 @@ export const useUserProfile = (sessionId: string | null, options?: { enabled?: b
19
19
  return await oxyServices.getUserBySession(sessionId);
20
20
  },
21
21
  enabled: (options?.enabled !== false) && !!sessionId,
22
- staleTime: 5 * 60 * 1000, // 5 minutes
23
- gcTime: 30 * 60 * 1000, // 30 minutes
22
+ staleTime: 0, // Always fetch fresh - Services never caches profile
23
+ gcTime: 0, // No garbage collection time - always fetch fresh
24
24
  });
25
25
  };
26
26
 
@@ -38,8 +38,8 @@ export const useUserProfiles = (sessionIds: string[], options?: { enabled?: bool
38
38
  return results[0]?.user || null;
39
39
  },
40
40
  enabled: (options?.enabled !== false) && !!sessionId,
41
- staleTime: 5 * 60 * 1000,
42
- gcTime: 30 * 60 * 1000,
41
+ staleTime: 0, // Always fetch fresh - Services never caches profile
42
+ gcTime: 0, // No garbage collection time - always fetch fresh
43
43
  })),
44
44
  });
45
45
  };
@@ -59,8 +59,8 @@ export const useCurrentUser = (options?: { enabled?: boolean }) => {
59
59
  return await oxyServices.getUserBySession(activeSessionId);
60
60
  },
61
61
  enabled: (options?.enabled !== false) && isAuthenticated && !!activeSessionId,
62
- staleTime: 1 * 60 * 1000, // 1 minute for current user
63
- gcTime: 30 * 60 * 1000,
62
+ staleTime: 0, // Always fetch fresh - Services never caches profile
63
+ gcTime: 0, // No garbage collection time - always fetch fresh
64
64
  });
65
65
  };
66
66
 
@@ -79,8 +79,8 @@ export const useUserById = (userId: string | null, options?: { enabled?: boolean
79
79
  return await oxyServices.getUserById(userId);
80
80
  },
81
81
  enabled: (options?.enabled !== false) && !!userId,
82
- staleTime: 5 * 60 * 1000,
83
- gcTime: 30 * 60 * 1000,
82
+ staleTime: 0, // Always fetch fresh - Services never caches profile
83
+ gcTime: 0, // No garbage collection time - always fetch fresh
84
84
  });
85
85
  };
86
86
 
@@ -99,8 +99,8 @@ export const useUserByUsername = (username: string | null, options?: { enabled?:
99
99
  return await oxyServices.getProfileByUsername(username);
100
100
  },
101
101
  enabled: (options?.enabled !== false) && !!username,
102
- staleTime: 5 * 60 * 1000,
103
- gcTime: 30 * 60 * 1000,
102
+ staleTime: 0, // Always fetch fresh - Services never caches profile
103
+ gcTime: 0, // No garbage collection time - always fetch fresh
104
104
  });
105
105
  };
106
106
 
@@ -119,8 +119,8 @@ export const useUsersBySessions = (sessionIds: string[], options?: { enabled?: b
119
119
  return await oxyServices.getUsersBySessions(sessionIds);
120
120
  },
121
121
  enabled: (options?.enabled !== false) && sessionIds.length > 0,
122
- staleTime: 5 * 60 * 1000,
123
- gcTime: 30 * 60 * 1000,
122
+ staleTime: 0, // Always fetch fresh - Services never caches profile
123
+ gcTime: 0, // No garbage collection time - always fetch fresh
124
124
  });
125
125
  };
126
126
 
@@ -128,10 +128,11 @@ export const useUsersBySessions = (sessionIds: string[], options?: { enabled?: b
128
128
  * Get privacy settings for a user
129
129
  */
130
130
  export const usePrivacySettings = (userId?: string, options?: { enabled?: boolean }) => {
131
- const { oxyServices, activeSessionId, syncIdentity } = useOxy();
131
+ const { oxyServices, activeSessionId, syncIdentity, sessions } = useOxy();
132
132
  // Use getCurrentUserId() which returns MongoDB ObjectId from JWT token
133
133
  // Never use user?.id as it may be set to publicKey
134
134
  const targetUserId = userId || oxyServices.getCurrentUserId() || undefined;
135
+ const deviceId = activeSessionId ? sessions.find((s) => s.sessionId === activeSessionId)?.deviceId : undefined;
135
136
 
136
137
  return useQuery({
137
138
  queryKey: queryKeys.privacy.settings(targetUserId),
@@ -144,7 +145,7 @@ export const usePrivacySettings = (userId?: string, options?: { enabled?: boolea
144
145
  if (!oxyServices.hasValidToken() && activeSessionId) {
145
146
  try {
146
147
  // Try to get token for the session
147
- await oxyServices.getTokenBySession(activeSessionId);
148
+ await oxyServices.getTokenBySession(activeSessionId, deviceId);
148
149
  } catch (tokenError) {
149
150
  // If getting token fails, might be an offline session - try syncing
150
151
  const errorMessage = tokenError instanceof Error ? tokenError.message : String(tokenError);
@@ -152,7 +153,7 @@ export const usePrivacySettings = (userId?: string, options?: { enabled?: boolea
152
153
  try {
153
154
  await syncIdentity();
154
155
  // Retry getting token after sync
155
- await oxyServices.getTokenBySession(activeSessionId);
156
+ await oxyServices.getTokenBySession(activeSessionId, deviceId);
156
157
  } catch (syncError) {
157
158
  throw new Error('Session needs to be synced. Please try again.');
158
159
  }
@@ -174,7 +175,7 @@ export const usePrivacySettings = (userId?: string, options?: { enabled?: boolea
174
175
  if (activeSessionId) {
175
176
  try {
176
177
  await syncIdentity();
177
- await oxyServices.getTokenBySession(activeSessionId);
178
+ await oxyServices.getTokenBySession(activeSessionId, deviceId);
178
179
  // Retry the request after getting token
179
180
  return await oxyServices.getPrivacySettings(targetUserId);
180
181
  } catch (retryError) {
@@ -190,42 +191,7 @@ export const usePrivacySettings = (userId?: string, options?: { enabled?: boolea
190
191
  }
191
192
  },
192
193
  enabled: (options?.enabled !== false) && !!targetUserId,
193
- staleTime: 2 * 60 * 1000, // 2 minutes
194
- gcTime: 10 * 60 * 1000, // 10 minutes
194
+ staleTime: 0, // Always fetch fresh - Services never caches profile
195
+ gcTime: 0, // No garbage collection time - always fetch fresh
195
196
  });
196
197
  };
197
-
198
- /**
199
- * Get blocked users
200
- */
201
- export const useBlockedUsers = (options?: { enabled?: boolean }) => {
202
- const { oxyServices, isAuthenticated } = useOxy();
203
-
204
- return useQuery({
205
- queryKey: queryKeys.privacy.blocked(),
206
- queryFn: async () => {
207
- return await oxyServices.getBlockedUsers();
208
- },
209
- enabled: (options?.enabled !== false) && isAuthenticated,
210
- staleTime: 1 * 60 * 1000, // 1 minute
211
- gcTime: 5 * 60 * 1000, // 5 minutes
212
- });
213
- };
214
-
215
- /**
216
- * Get restricted users
217
- */
218
- export const useRestrictedUsers = (options?: { enabled?: boolean }) => {
219
- const { oxyServices, isAuthenticated } = useOxy();
220
-
221
- return useQuery({
222
- queryKey: queryKeys.privacy.restricted(),
223
- queryFn: async () => {
224
- return await oxyServices.getRestrictedUsers();
225
- },
226
- enabled: (options?.enabled !== false) && isAuthenticated,
227
- staleTime: 1 * 60 * 1000, // 1 minute
228
- gcTime: 5 * 60 * 1000, // 5 minutes
229
- });
230
- };
231
-
@@ -89,7 +89,8 @@ export const useDeviceSessions = (options?: { enabled?: boolean }) => {
89
89
  * Get user devices
90
90
  */
91
91
  export const useUserDevices = (options?: { enabled?: boolean }) => {
92
- const { oxyServices, isAuthenticated, activeSessionId, syncIdentity } = useOxy();
92
+ const { oxyServices, isAuthenticated, activeSessionId, syncIdentity, sessions } = useOxy();
93
+ const deviceId = activeSessionId ? sessions.find((s) => s.sessionId === activeSessionId)?.deviceId : undefined;
93
94
 
94
95
  return useQuery({
95
96
  queryKey: queryKeys.devices.list(),
@@ -98,7 +99,7 @@ export const useUserDevices = (options?: { enabled?: boolean }) => {
98
99
  if (!oxyServices.hasValidToken() && activeSessionId) {
99
100
  try {
100
101
  // Try to get token for the session
101
- await oxyServices.getTokenBySession(activeSessionId);
102
+ await oxyServices.getTokenBySession(activeSessionId, deviceId);
102
103
  } catch (tokenError) {
103
104
  // If getting token fails, might be an offline session - try syncing
104
105
  const errorMessage = tokenError instanceof Error ? tokenError.message : String(tokenError);
@@ -106,7 +107,7 @@ export const useUserDevices = (options?: { enabled?: boolean }) => {
106
107
  try {
107
108
  await syncIdentity();
108
109
  // Retry getting token after sync
109
- await oxyServices.getTokenBySession(activeSessionId);
110
+ await oxyServices.getTokenBySession(activeSessionId, deviceId);
110
111
  } catch (syncError) {
111
112
  throw new Error('Session needs to be synced. Please try again.');
112
113
  }
@@ -128,7 +129,7 @@ export const useUserDevices = (options?: { enabled?: boolean }) => {
128
129
  if (activeSessionId) {
129
130
  try {
130
131
  await syncIdentity();
131
- await oxyServices.getTokenBySession(activeSessionId);
132
+ await oxyServices.getTokenBySession(activeSessionId, deviceId);
132
133
  // Retry the request after getting token
133
134
  return await oxyServices.getUserDevices();
134
135
  } catch (retryError) {
@@ -165,4 +166,3 @@ export const useSecurityInfo = (options?: { enabled?: boolean }) => {
165
166
  gcTime: 30 * 60 * 1000,
166
167
  });
167
168
  };
168
-