@oxyhq/services 5.17.17 → 5.17.18

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 (403) hide show
  1. package/README.md +32 -38
  2. package/lib/commonjs/core/CrossDomainAuth.js +277 -0
  3. package/lib/commonjs/core/CrossDomainAuth.js.map +1 -0
  4. package/lib/commonjs/core/HttpService.js +82 -15
  5. package/lib/commonjs/core/HttpService.js.map +1 -1
  6. package/lib/commonjs/core/OxyServices.base.js +11 -3
  7. package/lib/commonjs/core/OxyServices.base.js.map +1 -1
  8. package/lib/commonjs/core/OxyServices.js +4 -1
  9. package/lib/commonjs/core/OxyServices.js.map +1 -1
  10. package/lib/commonjs/core/index.js +30 -0
  11. package/lib/commonjs/core/index.js.map +1 -1
  12. package/lib/commonjs/core/mixins/OxyServices.assets.js +16 -3
  13. package/lib/commonjs/core/mixins/OxyServices.assets.js.map +1 -1
  14. package/lib/commonjs/core/mixins/OxyServices.auth.js +73 -32
  15. package/lib/commonjs/core/mixins/OxyServices.auth.js.map +1 -1
  16. package/lib/commonjs/core/mixins/OxyServices.fedcm.js +289 -0
  17. package/lib/commonjs/core/mixins/OxyServices.fedcm.js.map +1 -0
  18. package/lib/commonjs/core/mixins/OxyServices.popup.js +352 -0
  19. package/lib/commonjs/core/mixins/OxyServices.popup.js.map +1 -0
  20. package/lib/commonjs/core/mixins/OxyServices.redirect.js +378 -0
  21. package/lib/commonjs/core/mixins/OxyServices.redirect.js.map +1 -0
  22. package/lib/commonjs/core/mixins/OxyServices.user.js +35 -24
  23. package/lib/commonjs/core/mixins/OxyServices.user.js.map +1 -1
  24. package/lib/commonjs/core/mixins/index.js +27 -15
  25. package/lib/commonjs/core/mixins/index.js.map +1 -1
  26. package/lib/commonjs/crypto/index.js +30 -0
  27. package/lib/commonjs/crypto/index.js.map +1 -1
  28. package/lib/commonjs/crypto/keyManager.js +902 -0
  29. package/lib/commonjs/crypto/keyManager.js.map +1 -0
  30. package/lib/commonjs/crypto/polyfill.js +14 -5
  31. package/lib/commonjs/crypto/polyfill.js.map +1 -1
  32. package/lib/commonjs/crypto/recoveryPhrase.js +152 -0
  33. package/lib/commonjs/crypto/recoveryPhrase.js.map +1 -0
  34. package/lib/commonjs/crypto/signatureService.js +289 -0
  35. package/lib/commonjs/crypto/signatureService.js.map +1 -0
  36. package/lib/commonjs/i18n/locales/en-US.json +1 -1
  37. package/lib/commonjs/index.js +40 -26
  38. package/lib/commonjs/index.js.map +1 -1
  39. package/lib/commonjs/models/interfaces.js +0 -15
  40. package/lib/commonjs/models/interfaces.js.map +1 -1
  41. package/lib/commonjs/ui/components/BottomSheetRouter.js +9 -1
  42. package/lib/commonjs/ui/components/BottomSheetRouter.js.map +1 -1
  43. package/lib/commonjs/ui/components/Icon.js.map +1 -1
  44. package/lib/commonjs/ui/components/IconButton/utils.js.map +1 -1
  45. package/lib/commonjs/ui/components/OxyProvider.js +41 -11
  46. package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
  47. package/lib/commonjs/ui/components/TextField/Adornment/utils.js.map +1 -1
  48. package/lib/commonjs/ui/components/TextField/helpers.js.map +1 -1
  49. package/lib/commonjs/ui/components/TouchableRipple/utils.js.map +1 -1
  50. package/lib/commonjs/ui/components/Typography/AnimatedText.js.map +1 -1
  51. package/lib/commonjs/ui/context/OxyContext.js +110 -199
  52. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  53. package/lib/commonjs/ui/context/hooks/useAuthOperations.js +150 -19
  54. package/lib/commonjs/ui/context/hooks/useAuthOperations.js.map +1 -1
  55. package/lib/commonjs/ui/context/hooks/useSessionManagement.js +279 -0
  56. package/lib/commonjs/ui/context/hooks/useSessionManagement.js.map +1 -0
  57. package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js +79 -72
  58. package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js.map +1 -1
  59. package/lib/commonjs/ui/hooks/queries/useAccountQueries.js +38 -51
  60. package/lib/commonjs/ui/hooks/queries/useAccountQueries.js.map +1 -1
  61. package/lib/commonjs/ui/hooks/queries/useSecurityQueries.js +3 -3
  62. package/lib/commonjs/ui/hooks/queries/useSecurityQueries.js.map +1 -1
  63. package/lib/commonjs/ui/hooks/queries/useServicesQueries.js +18 -12
  64. package/lib/commonjs/ui/hooks/queries/useServicesQueries.js.map +1 -1
  65. package/lib/commonjs/ui/hooks/useProfileEditing.js +3 -5
  66. package/lib/commonjs/ui/hooks/useProfileEditing.js.map +1 -1
  67. package/lib/commonjs/ui/hooks/useSessionManagement.js +4 -8
  68. package/lib/commonjs/ui/hooks/useSessionManagement.js.map +1 -1
  69. package/lib/commonjs/ui/hooks/useSessionSocket.js +162 -315
  70. package/lib/commonjs/ui/hooks/useSessionSocket.js.map +1 -1
  71. package/lib/commonjs/ui/hooks/useStorage.js +24 -58
  72. package/lib/commonjs/ui/hooks/useStorage.js.map +1 -1
  73. package/lib/commonjs/ui/index.js +50 -21
  74. package/lib/commonjs/ui/index.js.map +1 -1
  75. package/lib/commonjs/ui/navigation/routes.js +5 -1
  76. package/lib/commonjs/ui/navigation/routes.js.map +1 -1
  77. package/lib/commonjs/ui/screens/AccountCenterScreen.js +2 -2
  78. package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
  79. package/lib/commonjs/ui/screens/AccountOverviewScreen.js.map +1 -1
  80. package/lib/commonjs/ui/screens/AccountSettingsScreen.js +29 -24
  81. package/lib/commonjs/ui/screens/AccountSettingsScreen.js.map +1 -1
  82. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js +3 -3
  83. package/lib/commonjs/ui/screens/AccountSwitcherScreen.js.map +1 -1
  84. package/lib/commonjs/ui/screens/OxyAuthScreen.js +134 -66
  85. package/lib/commonjs/ui/screens/OxyAuthScreen.js.map +1 -1
  86. package/lib/commonjs/ui/screens/PrivacySettingsScreen.js +6 -13
  87. package/lib/commonjs/ui/screens/PrivacySettingsScreen.js.map +1 -1
  88. package/lib/commonjs/ui/stores/accountStore.js +2 -4
  89. package/lib/commonjs/ui/stores/accountStore.js.map +1 -1
  90. package/lib/commonjs/ui/stores/authStore.js +45 -32
  91. package/lib/commonjs/ui/stores/authStore.js.map +1 -1
  92. package/lib/commonjs/ui/styles/spacing.js +54 -2
  93. package/lib/commonjs/ui/styles/spacing.js.map +1 -1
  94. package/lib/commonjs/ui/utils/avatarUtils.js +37 -41
  95. package/lib/commonjs/ui/utils/avatarUtils.js.map +1 -1
  96. package/lib/commonjs/ui/utils/storageHelpers.js.map +1 -1
  97. package/lib/commonjs/utils/errorUtils.js +13 -0
  98. package/lib/commonjs/utils/errorUtils.js.map +1 -1
  99. package/lib/commonjs/utils/validationUtils.js +15 -1
  100. package/lib/commonjs/utils/validationUtils.js.map +1 -1
  101. package/lib/module/core/CrossDomainAuth.js +271 -0
  102. package/lib/module/core/CrossDomainAuth.js.map +1 -0
  103. package/lib/module/core/HttpService.js +82 -15
  104. package/lib/module/core/HttpService.js.map +1 -1
  105. package/lib/module/core/OxyServices.base.js +11 -4
  106. package/lib/module/core/OxyServices.base.js.map +1 -1
  107. package/lib/module/core/OxyServices.js +4 -1
  108. package/lib/module/core/OxyServices.js.map +1 -1
  109. package/lib/module/core/index.js +6 -1
  110. package/lib/module/core/index.js.map +1 -1
  111. package/lib/module/core/mixins/OxyServices.assets.js +16 -3
  112. package/lib/module/core/mixins/OxyServices.assets.js.map +1 -1
  113. package/lib/module/core/mixins/OxyServices.auth.js +73 -32
  114. package/lib/module/core/mixins/OxyServices.auth.js.map +1 -1
  115. package/lib/module/core/mixins/OxyServices.fedcm.js +286 -0
  116. package/lib/module/core/mixins/OxyServices.fedcm.js.map +1 -0
  117. package/lib/module/core/mixins/OxyServices.popup.js +349 -0
  118. package/lib/module/core/mixins/OxyServices.popup.js.map +1 -0
  119. package/lib/module/core/mixins/OxyServices.redirect.js +375 -0
  120. package/lib/module/core/mixins/OxyServices.redirect.js.map +1 -0
  121. package/lib/module/core/mixins/OxyServices.user.js +35 -24
  122. package/lib/module/core/mixins/OxyServices.user.js.map +1 -1
  123. package/lib/module/core/mixins/index.js +15 -3
  124. package/lib/module/core/mixins/index.js.map +1 -1
  125. package/lib/module/crypto/index.js +8 -4
  126. package/lib/module/crypto/index.js.map +1 -1
  127. package/lib/module/crypto/keyManager.js +899 -0
  128. package/lib/module/crypto/keyManager.js.map +1 -0
  129. package/lib/module/crypto/polyfill.js +6 -5
  130. package/lib/module/crypto/polyfill.js.map +1 -1
  131. package/lib/module/crypto/recoveryPhrase.js +147 -0
  132. package/lib/module/crypto/recoveryPhrase.js.map +1 -0
  133. package/lib/module/crypto/signatureService.js +286 -0
  134. package/lib/module/crypto/signatureService.js.map +1 -0
  135. package/lib/module/i18n/locales/en-US.json +1 -1
  136. package/lib/module/index.js +6 -9
  137. package/lib/module/index.js.map +1 -1
  138. package/lib/module/models/interfaces.js +0 -15
  139. package/lib/module/models/interfaces.js.map +1 -1
  140. package/lib/module/ui/components/BottomSheetRouter.js +6 -2
  141. package/lib/module/ui/components/BottomSheetRouter.js.map +1 -1
  142. package/lib/module/ui/components/Icon.js.map +1 -1
  143. package/lib/module/ui/components/IconButton/utils.js.map +1 -1
  144. package/lib/module/ui/components/OxyProvider.js +41 -11
  145. package/lib/module/ui/components/OxyProvider.js.map +1 -1
  146. package/lib/module/ui/components/TextField/Adornment/utils.js.map +1 -1
  147. package/lib/module/ui/components/TextField/helpers.js.map +1 -1
  148. package/lib/module/ui/components/TouchableRipple/utils.js.map +1 -1
  149. package/lib/module/ui/components/Typography/AnimatedText.js.map +1 -1
  150. package/lib/module/ui/context/OxyContext.js +112 -191
  151. package/lib/module/ui/context/OxyContext.js.map +1 -1
  152. package/lib/module/ui/context/hooks/useAuthOperations.js +150 -19
  153. package/lib/module/ui/context/hooks/useAuthOperations.js.map +1 -1
  154. package/lib/module/ui/context/hooks/useSessionManagement.js +274 -0
  155. package/lib/module/ui/context/hooks/useSessionManagement.js.map +1 -0
  156. package/lib/module/ui/hooks/mutations/useAccountMutations.js +80 -72
  157. package/lib/module/ui/hooks/mutations/useAccountMutations.js.map +1 -1
  158. package/lib/module/ui/hooks/queries/useAccountQueries.js +31 -44
  159. package/lib/module/ui/hooks/queries/useAccountQueries.js.map +1 -1
  160. package/lib/module/ui/hooks/queries/useSecurityQueries.js +1 -1
  161. package/lib/module/ui/hooks/queries/useSecurityQueries.js.map +1 -1
  162. package/lib/module/ui/hooks/queries/useServicesQueries.js +13 -7
  163. package/lib/module/ui/hooks/queries/useServicesQueries.js.map +1 -1
  164. package/lib/module/ui/hooks/useProfileEditing.js +3 -5
  165. package/lib/module/ui/hooks/useProfileEditing.js.map +1 -1
  166. package/lib/module/ui/hooks/useSessionManagement.js +4 -8
  167. package/lib/module/ui/hooks/useSessionManagement.js.map +1 -1
  168. package/lib/module/ui/hooks/useSessionSocket.js +162 -315
  169. package/lib/module/ui/hooks/useSessionSocket.js.map +1 -1
  170. package/lib/module/ui/hooks/useStorage.js +25 -59
  171. package/lib/module/ui/hooks/useStorage.js.map +1 -1
  172. package/lib/module/ui/index.js +15 -10
  173. package/lib/module/ui/index.js.map +1 -1
  174. package/lib/module/ui/navigation/routes.js +5 -1
  175. package/lib/module/ui/navigation/routes.js.map +1 -1
  176. package/lib/module/ui/screens/AccountCenterScreen.js +2 -2
  177. package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
  178. package/lib/module/ui/screens/AccountOverviewScreen.js.map +1 -1
  179. package/lib/module/ui/screens/AccountSettingsScreen.js +29 -24
  180. package/lib/module/ui/screens/AccountSettingsScreen.js.map +1 -1
  181. package/lib/module/ui/screens/AccountSwitcherScreen.js +3 -3
  182. package/lib/module/ui/screens/AccountSwitcherScreen.js.map +1 -1
  183. package/lib/module/ui/screens/OxyAuthScreen.js +135 -68
  184. package/lib/module/ui/screens/OxyAuthScreen.js.map +1 -1
  185. package/lib/module/ui/screens/PrivacySettingsScreen.js +6 -13
  186. package/lib/module/ui/screens/PrivacySettingsScreen.js.map +1 -1
  187. package/lib/module/ui/stores/accountStore.js +2 -4
  188. package/lib/module/ui/stores/accountStore.js.map +1 -1
  189. package/lib/module/ui/stores/authStore.js +45 -32
  190. package/lib/module/ui/stores/authStore.js.map +1 -1
  191. package/lib/module/ui/styles/spacing.js +6 -2
  192. package/lib/module/ui/styles/spacing.js.map +1 -1
  193. package/lib/module/ui/utils/avatarUtils.js +37 -40
  194. package/lib/module/ui/utils/avatarUtils.js.map +1 -1
  195. package/lib/module/ui/utils/storageHelpers.js.map +1 -1
  196. package/lib/module/utils/errorUtils.js +7 -0
  197. package/lib/module/utils/errorUtils.js.map +1 -1
  198. package/lib/module/utils/validationUtils.js +13 -0
  199. package/lib/module/utils/validationUtils.js.map +1 -1
  200. package/lib/typescript/core/CrossDomainAuth.d.ts +161 -0
  201. package/lib/typescript/core/CrossDomainAuth.d.ts.map +1 -0
  202. package/lib/typescript/core/HttpService.d.ts +1 -1
  203. package/lib/typescript/core/HttpService.d.ts.map +1 -1
  204. package/lib/typescript/core/OxyServices.base.d.ts +0 -6
  205. package/lib/typescript/core/OxyServices.base.d.ts.map +1 -1
  206. package/lib/typescript/core/OxyServices.d.ts +5 -36
  207. package/lib/typescript/core/OxyServices.d.ts.map +1 -1
  208. package/lib/typescript/core/index.d.ts +4 -0
  209. package/lib/typescript/core/index.d.ts.map +1 -1
  210. package/lib/typescript/core/mixins/OxyServices.analytics.d.ts.map +1 -1
  211. package/lib/typescript/core/mixins/OxyServices.assets.d.ts.map +1 -1
  212. package/lib/typescript/core/mixins/OxyServices.auth.d.ts +40 -20
  213. package/lib/typescript/core/mixins/OxyServices.auth.d.ts.map +1 -1
  214. package/lib/typescript/core/mixins/OxyServices.developer.d.ts.map +1 -1
  215. package/lib/typescript/core/mixins/OxyServices.devices.d.ts.map +1 -1
  216. package/lib/typescript/core/mixins/OxyServices.fedcm.d.ts +195 -0
  217. package/lib/typescript/core/mixins/OxyServices.fedcm.d.ts.map +1 -0
  218. package/lib/typescript/core/mixins/OxyServices.karma.d.ts.map +1 -1
  219. package/lib/typescript/core/mixins/OxyServices.language.d.ts.map +1 -1
  220. package/lib/typescript/core/mixins/OxyServices.location.d.ts.map +1 -1
  221. package/lib/typescript/core/mixins/OxyServices.payment.d.ts.map +1 -1
  222. package/lib/typescript/core/mixins/OxyServices.popup.d.ts +206 -0
  223. package/lib/typescript/core/mixins/OxyServices.popup.d.ts.map +1 -0
  224. package/lib/typescript/core/mixins/OxyServices.privacy.d.ts.map +1 -1
  225. package/lib/typescript/core/mixins/OxyServices.redirect.d.ts +246 -0
  226. package/lib/typescript/core/mixins/OxyServices.redirect.d.ts.map +1 -0
  227. package/lib/typescript/core/mixins/OxyServices.security.d.ts.map +1 -1
  228. package/lib/typescript/core/mixins/OxyServices.user.d.ts +6 -4
  229. package/lib/typescript/core/mixins/OxyServices.user.d.ts.map +1 -1
  230. package/lib/typescript/core/mixins/OxyServices.utility.d.ts.map +1 -1
  231. package/lib/typescript/core/mixins/index.d.ts +220 -8
  232. package/lib/typescript/core/mixins/index.d.ts.map +1 -1
  233. package/lib/typescript/crypto/index.d.ts +6 -3
  234. package/lib/typescript/crypto/index.d.ts.map +1 -1
  235. package/lib/typescript/crypto/keyManager.d.ts +190 -0
  236. package/lib/typescript/crypto/keyManager.d.ts.map +1 -0
  237. package/lib/typescript/crypto/polyfill.d.ts +4 -3
  238. package/lib/typescript/crypto/polyfill.d.ts.map +1 -1
  239. package/lib/typescript/crypto/recoveryPhrase.d.ts +59 -0
  240. package/lib/typescript/crypto/recoveryPhrase.d.ts.map +1 -0
  241. package/lib/typescript/crypto/signatureService.d.ts +87 -0
  242. package/lib/typescript/crypto/signatureService.d.ts.map +1 -0
  243. package/lib/typescript/index.d.ts +5 -6
  244. package/lib/typescript/index.d.ts.map +1 -1
  245. package/lib/typescript/models/interfaces.d.ts +2 -14
  246. package/lib/typescript/models/interfaces.d.ts.map +1 -1
  247. package/lib/typescript/models/session.d.ts +0 -9
  248. package/lib/typescript/models/session.d.ts.map +1 -1
  249. package/lib/typescript/types/bip39.d.ts +32 -0
  250. package/lib/typescript/ui/components/BottomSheetRouter.d.ts +5 -0
  251. package/lib/typescript/ui/components/BottomSheetRouter.d.ts.map +1 -1
  252. package/lib/typescript/ui/components/IconButton/utils.d.ts +1 -1
  253. package/lib/typescript/ui/components/OxyProvider.d.ts.map +1 -1
  254. package/lib/typescript/ui/components/TextField/Addons/Outline.d.ts +2 -2
  255. package/lib/typescript/ui/components/TextField/Adornment/utils.d.ts +1 -1
  256. package/lib/typescript/ui/components/TextField/Adornment/utils.d.ts.map +1 -1
  257. package/lib/typescript/ui/components/TextField/helpers.d.ts +8 -8
  258. package/lib/typescript/ui/components/TextField/types.d.ts +1 -0
  259. package/lib/typescript/ui/components/TextField/types.d.ts.map +1 -1
  260. package/lib/typescript/ui/components/types.d.ts +4 -0
  261. package/lib/typescript/ui/components/types.d.ts.map +1 -1
  262. package/lib/typescript/ui/context/OxyContext.d.ts +57 -3
  263. package/lib/typescript/ui/context/OxyContext.d.ts.map +1 -1
  264. package/lib/typescript/ui/context/hooks/useAuthOperations.d.ts +10 -3
  265. package/lib/typescript/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
  266. package/lib/typescript/ui/context/hooks/useSessionManagement.d.ts +41 -0
  267. package/lib/typescript/ui/context/hooks/useSessionManagement.d.ts.map +1 -0
  268. package/lib/typescript/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
  269. package/lib/typescript/ui/hooks/queries/useAccountQueries.d.ts.map +1 -1
  270. package/lib/typescript/ui/hooks/queries/useServicesQueries.d.ts.map +1 -1
  271. package/lib/typescript/ui/hooks/useProfileEditing.d.ts.map +1 -1
  272. package/lib/typescript/ui/hooks/useSessionManagement.d.ts.map +1 -1
  273. package/lib/typescript/ui/hooks/useSessionSocket.d.ts +1 -2
  274. package/lib/typescript/ui/hooks/useSessionSocket.d.ts.map +1 -1
  275. package/lib/typescript/ui/hooks/useStorage.d.ts +3 -9
  276. package/lib/typescript/ui/hooks/useStorage.d.ts.map +1 -1
  277. package/lib/typescript/ui/index.d.ts +6 -2
  278. package/lib/typescript/ui/index.d.ts.map +1 -1
  279. package/lib/typescript/ui/navigation/routes.d.ts +1 -1
  280. package/lib/typescript/ui/navigation/routes.d.ts.map +1 -1
  281. package/lib/typescript/ui/screens/AccountSettingsScreen.d.ts.map +1 -1
  282. package/lib/typescript/ui/screens/OxyAuthScreen.d.ts +1 -1
  283. package/lib/typescript/ui/screens/OxyAuthScreen.d.ts.map +1 -1
  284. package/lib/typescript/ui/screens/PrivacySettingsScreen.d.ts.map +1 -1
  285. package/lib/typescript/ui/stores/accountStore.d.ts.map +1 -1
  286. package/lib/typescript/ui/stores/authStore.d.ts +8 -7
  287. package/lib/typescript/ui/stores/authStore.d.ts.map +1 -1
  288. package/lib/typescript/ui/styles/spacing.d.ts +5 -0
  289. package/lib/typescript/ui/styles/spacing.d.ts.map +1 -1
  290. package/lib/typescript/ui/types/navigation.d.ts +2 -1
  291. package/lib/typescript/ui/types/navigation.d.ts.map +1 -1
  292. package/lib/typescript/ui/utils/avatarUtils.d.ts +2 -13
  293. package/lib/typescript/ui/utils/avatarUtils.d.ts.map +1 -1
  294. package/lib/typescript/ui/utils/storageHelpers.d.ts +0 -3
  295. package/lib/typescript/ui/utils/storageHelpers.d.ts.map +1 -1
  296. package/lib/typescript/utils/errorUtils.d.ts +6 -0
  297. package/lib/typescript/utils/errorUtils.d.ts.map +1 -1
  298. package/lib/typescript/utils/validationUtils.d.ts +8 -0
  299. package/lib/typescript/utils/validationUtils.d.ts.map +1 -1
  300. package/package.json +8 -7
  301. package/src/core/CrossDomainAuth.ts +307 -0
  302. package/src/core/HttpService.ts +99 -16
  303. package/src/core/OxyServices.base.ts +20 -3
  304. package/src/core/OxyServices.ts +7 -3
  305. package/src/core/index.ts +9 -1
  306. package/src/core/mixins/OxyServices.assets.ts +14 -3
  307. package/src/core/mixins/OxyServices.auth.ts +105 -36
  308. package/src/core/mixins/OxyServices.fedcm.ts +315 -0
  309. package/src/core/mixins/OxyServices.popup.ts +402 -0
  310. package/src/core/mixins/OxyServices.redirect.ts +397 -0
  311. package/src/core/mixins/OxyServices.user.ts +39 -24
  312. package/src/core/mixins/index.ts +19 -3
  313. package/src/crypto/index.ts +16 -5
  314. package/src/crypto/keyManager.ts +966 -0
  315. package/src/crypto/polyfill.ts +6 -5
  316. package/src/crypto/recoveryPhrase.ts +166 -0
  317. package/src/crypto/signatureService.ts +323 -0
  318. package/src/i18n/locales/en-US.json +1 -1
  319. package/src/index.ts +19 -15
  320. package/src/models/interfaces.ts +4 -16
  321. package/src/models/session.ts +2 -11
  322. package/src/types/bip39.d.ts +32 -0
  323. package/src/ui/components/BottomSheetRouter.tsx +6 -1
  324. package/src/ui/components/Icon.tsx +1 -1
  325. package/src/ui/components/IconButton/utils.ts +1 -1
  326. package/src/ui/components/OxyProvider.tsx +44 -12
  327. package/src/ui/components/TextField/Addons/Outline.tsx +2 -2
  328. package/src/ui/components/TextField/Adornment/utils.ts +2 -2
  329. package/src/ui/components/TextField/helpers.tsx +10 -10
  330. package/src/ui/components/TextField/types.tsx +1 -1
  331. package/src/ui/components/TouchableRipple/utils.ts +2 -2
  332. package/src/ui/components/Typography/AnimatedText.tsx +2 -2
  333. package/src/ui/components/types.tsx +6 -0
  334. package/src/ui/context/OxyContext.tsx +173 -195
  335. package/src/ui/context/hooks/useAuthOperations.ts +177 -36
  336. package/src/ui/context/hooks/useSessionManagement.ts +399 -0
  337. package/src/ui/hooks/mutations/useAccountMutations.ts +83 -76
  338. package/src/ui/hooks/queries/useAccountQueries.ts +29 -35
  339. package/src/ui/hooks/queries/useSecurityQueries.ts +1 -1
  340. package/src/ui/hooks/queries/useServicesQueries.ts +14 -6
  341. package/src/ui/hooks/useProfileEditing.ts +3 -3
  342. package/src/ui/hooks/useSessionManagement.ts +5 -10
  343. package/src/ui/hooks/useSessionSocket.ts +46 -175
  344. package/src/ui/hooks/useStorage.ts +24 -76
  345. package/src/ui/index.ts +22 -13
  346. package/src/ui/navigation/routes.ts +6 -2
  347. package/src/ui/screens/AccountCenterScreen.tsx +2 -2
  348. package/src/ui/screens/AccountOverviewScreen.tsx +1 -1
  349. package/src/ui/screens/AccountSettingsScreen.tsx +34 -37
  350. package/src/ui/screens/AccountSwitcherScreen.tsx +4 -4
  351. package/src/ui/screens/OxyAuthScreen.tsx +138 -64
  352. package/src/ui/screens/PrivacySettingsScreen.tsx +6 -12
  353. package/src/ui/stores/accountStore.ts +1 -11
  354. package/src/ui/stores/authStore.ts +43 -44
  355. package/src/ui/styles/spacing.ts +15 -2
  356. package/src/ui/types/navigation.ts +2 -2
  357. package/src/ui/utils/avatarUtils.ts +39 -46
  358. package/src/ui/utils/storageHelpers.ts +0 -4
  359. package/src/utils/__tests__/validationUtils.test.ts +16 -1
  360. package/src/utils/errorUtils.ts +8 -1
  361. package/src/utils/validationUtils.ts +12 -0
  362. package/lib/commonjs/core/services/SessionService.js +0 -163
  363. package/lib/commonjs/core/services/SessionService.js.map +0 -1
  364. package/lib/commonjs/core/services/TokenService.js +0 -220
  365. package/lib/commonjs/core/services/TokenService.js.map +0 -1
  366. package/lib/commonjs/crypto/types.js +0 -2
  367. package/lib/commonjs/crypto/types.js.map +0 -1
  368. package/lib/commonjs/ui/context/OxyContextBase.js +0 -21
  369. package/lib/commonjs/ui/context/OxyContextBase.js.map +0 -1
  370. package/lib/commonjs/ui/context/hooks/useStorage.js +0 -79
  371. package/lib/commonjs/ui/context/hooks/useStorage.js.map +0 -1
  372. package/lib/commonjs/ui/hooks/useAvatarPicker.js +0 -56
  373. package/lib/commonjs/ui/hooks/useAvatarPicker.js.map +0 -1
  374. package/lib/module/core/services/SessionService.js +0 -159
  375. package/lib/module/core/services/SessionService.js.map +0 -1
  376. package/lib/module/core/services/TokenService.js +0 -217
  377. package/lib/module/core/services/TokenService.js.map +0 -1
  378. package/lib/module/crypto/types.js +0 -2
  379. package/lib/module/crypto/types.js.map +0 -1
  380. package/lib/module/ui/context/OxyContextBase.js +0 -16
  381. package/lib/module/ui/context/OxyContextBase.js.map +0 -1
  382. package/lib/module/ui/context/hooks/useStorage.js +0 -74
  383. package/lib/module/ui/context/hooks/useStorage.js.map +0 -1
  384. package/lib/module/ui/hooks/useAvatarPicker.js +0 -50
  385. package/lib/module/ui/hooks/useAvatarPicker.js.map +0 -1
  386. package/lib/typescript/core/services/SessionService.d.ts +0 -78
  387. package/lib/typescript/core/services/SessionService.d.ts.map +0 -1
  388. package/lib/typescript/core/services/TokenService.d.ts +0 -72
  389. package/lib/typescript/core/services/TokenService.d.ts.map +0 -1
  390. package/lib/typescript/crypto/types.d.ts +0 -22
  391. package/lib/typescript/crypto/types.d.ts.map +0 -1
  392. package/lib/typescript/ui/context/OxyContextBase.d.ts +0 -63
  393. package/lib/typescript/ui/context/OxyContextBase.d.ts.map +0 -1
  394. package/lib/typescript/ui/context/hooks/useStorage.d.ts +0 -22
  395. package/lib/typescript/ui/context/hooks/useStorage.d.ts.map +0 -1
  396. package/lib/typescript/ui/hooks/useAvatarPicker.d.ts +0 -19
  397. package/lib/typescript/ui/hooks/useAvatarPicker.d.ts.map +0 -1
  398. package/src/core/services/SessionService.ts +0 -173
  399. package/src/core/services/TokenService.ts +0 -237
  400. package/src/crypto/types.ts +0 -23
  401. package/src/ui/context/OxyContextBase.tsx +0 -78
  402. package/src/ui/context/hooks/useStorage.ts +0 -104
  403. package/src/ui/hooks/useAvatarPicker.ts +0 -61
@@ -11,6 +11,11 @@ import { OxyServicesBase } from '../OxyServices.base';
11
11
  * Order matters for mixins - dependencies should be applied first.
12
12
  * This function ensures consistent composition across the codebase.
13
13
  *
14
+ * New cross-domain auth mixins added:
15
+ * - FedCM: Modern browser-native identity federation (Google-style)
16
+ * - Popup: OAuth2-style popup authentication
17
+ * - Redirect: Traditional redirect-based authentication
18
+ *
14
19
  * @returns The fully composed OxyServices class with all mixins applied
15
20
  */
16
21
  export declare function composeOxyServices(): {
@@ -756,12 +761,219 @@ export declare function composeOxyServices(): {
756
761
  __resetTokensForTests(): void;
757
762
  } & {
758
763
  new (...args: any[]): {
759
- registerIdentity(publicKey: string): Promise<{
760
- userId: string;
764
+ signInWithRedirect(options?: import("./OxyServices.redirect").RedirectAuthOptions): void;
765
+ signUpWithRedirect(options?: import("./OxyServices.redirect").RedirectAuthOptions): void;
766
+ handleAuthCallback(): import("..").SessionLoginResponse | null;
767
+ restoreSession(): boolean;
768
+ clearStoredSession(): void;
769
+ getStoredSessionId(): string | null;
770
+ buildAuthUrl(params: {
771
+ mode: string;
772
+ redirectUri: string;
773
+ state: string;
774
+ nonce: string;
775
+ clientId: string;
776
+ }): string;
777
+ storeTokens(accessToken: string, sessionId: string): void;
778
+ generateState(): string;
779
+ generateNonce(): string;
780
+ storeAuthState(state: string, nonce: string): void;
781
+ getStoredState(): string | null;
782
+ clearAuthState(): void;
783
+ savePreAuthUrl(url: string): void;
784
+ cleanAuthCallbackUrl(url: URL): void;
785
+ httpService: import("../HttpService").HttpService;
786
+ cloudURL: string;
787
+ config: import("../OxyServices.base").OxyConfig;
788
+ makeRequest<T>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("../HttpService").RequestOptions): Promise<T>;
789
+ getBaseURL(): string;
790
+ getClient(): import("../HttpService").HttpService;
791
+ getMetrics(): {
792
+ totalRequests: number;
793
+ successfulRequests: number;
794
+ failedRequests: number;
795
+ cacheHits: number;
796
+ cacheMisses: number;
797
+ averageResponseTime: number;
798
+ };
799
+ clearCache(): void;
800
+ clearCacheEntry(key: string): void;
801
+ getCacheStats(): {
802
+ size: number;
803
+ hits: number;
804
+ misses: number;
805
+ hitRate: number;
806
+ };
807
+ getCloudURL(): string;
808
+ setTokens(accessToken: string, refreshToken?: string): void;
809
+ clearTokens(): void;
810
+ getCurrentUserId(): string | null;
811
+ hasValidToken(): boolean;
812
+ getAccessToken(): string | null;
813
+ waitForAuth(timeoutMs?: number): Promise<boolean>;
814
+ withAuthRetry<T>(operation: () => Promise<T>, operationName: string, options?: {
815
+ maxRetries?: number;
816
+ retryDelay?: number;
817
+ authTimeoutMs?: number;
818
+ }): Promise<T>;
819
+ validate(): Promise<boolean>;
820
+ handleError(error: unknown): Error;
821
+ healthCheck(): Promise<{
822
+ status: string;
823
+ users?: number;
824
+ timestamp?: string;
825
+ [key: string]: any;
826
+ }>;
827
+ };
828
+ readonly AUTH_URL: "https://auth.oxy.so";
829
+ readonly TOKEN_STORAGE_KEY: "oxy_access_token";
830
+ readonly SESSION_STORAGE_KEY: "oxy_session_id";
831
+ readonly STATE_STORAGE_KEY: "oxy_auth_state";
832
+ readonly PRE_AUTH_URL_KEY: "oxy_pre_auth_url";
833
+ readonly NONCE_STORAGE_KEY: "oxy_auth_nonce";
834
+ __resetTokensForTests(): void;
835
+ } & {
836
+ new (...args: any[]): {
837
+ signInWithPopup(options?: import("./OxyServices.popup").PopupAuthOptions): Promise<import("..").SessionLoginResponse>;
838
+ signUpWithPopup(options?: import("./OxyServices.popup").PopupAuthOptions): Promise<import("..").SessionLoginResponse>;
839
+ silentSignIn(options?: import("./OxyServices.popup").SilentAuthOptions): Promise<import("..").SessionLoginResponse | null>;
840
+ openCenteredPopup(url: string, title: string, width: number, height: number): Window | null;
841
+ waitForPopupAuth(popup: Window, expectedState: string, timeout: number): Promise<import("..").SessionLoginResponse>;
842
+ waitForIframeAuth(iframe: HTMLIFrameElement, timeout: number, expectedOrigin: string): Promise<import("..").SessionLoginResponse | null>;
843
+ buildAuthUrl(params: {
844
+ mode: string;
845
+ state: string;
846
+ nonce: string;
847
+ clientId: string;
848
+ redirectUri: string;
849
+ }): string;
850
+ generateState(): string;
851
+ generateNonce(): string;
852
+ storeAuthState(state: string, nonce: string): void;
853
+ clearAuthState(state: string): void;
854
+ httpService: import("../HttpService").HttpService;
855
+ cloudURL: string;
856
+ config: import("../OxyServices.base").OxyConfig;
857
+ makeRequest<T>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("../HttpService").RequestOptions): Promise<T>;
858
+ getBaseURL(): string;
859
+ getClient(): import("../HttpService").HttpService;
860
+ getMetrics(): {
861
+ totalRequests: number;
862
+ successfulRequests: number;
863
+ failedRequests: number;
864
+ cacheHits: number;
865
+ cacheMisses: number;
866
+ averageResponseTime: number;
867
+ };
868
+ clearCache(): void;
869
+ clearCacheEntry(key: string): void;
870
+ getCacheStats(): {
871
+ size: number;
872
+ hits: number;
873
+ misses: number;
874
+ hitRate: number;
875
+ };
876
+ getCloudURL(): string;
877
+ setTokens(accessToken: string, refreshToken?: string): void;
878
+ clearTokens(): void;
879
+ getCurrentUserId(): string | null;
880
+ hasValidToken(): boolean;
881
+ getAccessToken(): string | null;
882
+ waitForAuth(timeoutMs?: number): Promise<boolean>;
883
+ withAuthRetry<T>(operation: () => Promise<T>, operationName: string, options?: {
884
+ maxRetries?: number;
885
+ retryDelay?: number;
886
+ authTimeoutMs?: number;
887
+ }): Promise<T>;
888
+ validate(): Promise<boolean>;
889
+ handleError(error: unknown): Error;
890
+ healthCheck(): Promise<{
891
+ status: string;
892
+ users?: number;
893
+ timestamp?: string;
894
+ [key: string]: any;
895
+ }>;
896
+ };
897
+ readonly AUTH_URL: "https://auth.oxy.so";
898
+ readonly POPUP_WIDTH: 500;
899
+ readonly POPUP_HEIGHT: 700;
900
+ readonly POPUP_TIMEOUT: 60000;
901
+ readonly SILENT_TIMEOUT: 5000;
902
+ __resetTokensForTests(): void;
903
+ } & {
904
+ new (...args: any[]): {
905
+ isFedCMSupported(): boolean;
906
+ signInWithFedCM(options?: import("./OxyServices.fedcm").FedCMAuthOptions): Promise<import("..").SessionLoginResponse>;
907
+ silentSignInWithFedCM(): Promise<import("..").SessionLoginResponse | null>;
908
+ requestIdentityCredential(options: {
909
+ configURL: string;
910
+ clientId: string;
911
+ nonce: string;
912
+ context?: string;
913
+ mediation?: "silent" | "optional" | "required";
914
+ }): Promise<{
915
+ token: string;
916
+ } | null>;
917
+ exchangeIdTokenForSession(idToken: string): Promise<import("..").SessionLoginResponse>;
918
+ revokeFedCMCredential(): Promise<void>;
919
+ getFedCMConfig(): import("./OxyServices.fedcm").FedCMConfig;
920
+ generateNonce(): string;
921
+ getClientId(): string;
922
+ httpService: import("../HttpService").HttpService;
923
+ cloudURL: string;
924
+ config: import("../OxyServices.base").OxyConfig;
925
+ makeRequest<T>(method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE", url: string, data?: any, options?: import("../HttpService").RequestOptions): Promise<T>;
926
+ getBaseURL(): string;
927
+ getClient(): import("../HttpService").HttpService;
928
+ getMetrics(): {
929
+ totalRequests: number;
930
+ successfulRequests: number;
931
+ failedRequests: number;
932
+ cacheHits: number;
933
+ cacheMisses: number;
934
+ averageResponseTime: number;
935
+ };
936
+ clearCache(): void;
937
+ clearCacheEntry(key: string): void;
938
+ getCacheStats(): {
939
+ size: number;
940
+ hits: number;
941
+ misses: number;
942
+ hitRate: number;
943
+ };
944
+ getCloudURL(): string;
945
+ setTokens(accessToken: string, refreshToken?: string): void;
946
+ clearTokens(): void;
947
+ getCurrentUserId(): string | null;
948
+ hasValidToken(): boolean;
949
+ getAccessToken(): string | null;
950
+ waitForAuth(timeoutMs?: number): Promise<boolean>;
951
+ withAuthRetry<T>(operation: () => Promise<T>, operationName: string, options?: {
952
+ maxRetries?: number;
953
+ retryDelay?: number;
954
+ authTimeoutMs?: number;
955
+ }): Promise<T>;
956
+ validate(): Promise<boolean>;
957
+ handleError(error: unknown): Error;
958
+ healthCheck(): Promise<{
959
+ status: string;
960
+ users?: number;
961
+ timestamp?: string;
962
+ [key: string]: any;
963
+ }>;
964
+ };
965
+ readonly DEFAULT_CONFIG_URL: "https://auth.oxy.so/fedcm.json";
966
+ readonly FEDCM_TIMEOUT: 60000;
967
+ isFedCMSupported(): boolean;
968
+ __resetTokensForTests(): void;
969
+ } & {
970
+ new (...args: any[]): {
971
+ register(publicKey: string, signature: string, timestamp: number): Promise<{
972
+ message: string;
761
973
  user: import("..").User;
762
974
  }>;
763
- requestChallenge(userId: string): Promise<import("./OxyServices.auth").ChallengeResponse>;
764
- verifyChallenge(userId: string, nonce: string, signature: string, timestamp: number, deviceName?: string, deviceFingerprint?: string): Promise<import("..").SessionLoginResponse>;
975
+ requestChallenge(publicKey: string): Promise<import("./OxyServices.auth").ChallengeResponse>;
976
+ verifyChallenge(publicKey: string, challenge: string, signature: string, timestamp: number, deviceName?: string, deviceFingerprint?: string): Promise<import("..").SessionLoginResponse>;
765
977
  checkPublicKeyRegistered(publicKey: string): Promise<import("./OxyServices.auth").PublicKeyCheckResponse>;
766
978
  getUserByPublicKey(publicKey: string): Promise<import("..").User>;
767
979
  getUserBySession(sessionId: string): Promise<import("..").User>;
@@ -769,12 +981,9 @@ export declare function composeOxyServices(): {
769
981
  sessionId: string;
770
982
  user: import("..").User | null;
771
983
  }[]>;
772
- getTokenBySession(sessionId: string, deviceId?: string): Promise<{
984
+ getTokenBySession(sessionId: string): Promise<{
773
985
  accessToken: string;
774
- refreshToken: string;
775
986
  expiresAt: string;
776
- sessionId: string;
777
- deviceId: string;
778
987
  }>;
779
988
  getSessionsBySessionId(sessionId: string): Promise<any[]>;
780
989
  logoutSession(sessionId: string, targetSessionId?: string): Promise<void>;
@@ -798,6 +1007,9 @@ export declare function composeOxyServices(): {
798
1007
  available: boolean;
799
1008
  message: string;
800
1009
  }>;
1010
+ signUp(username: string, email: string, password: string, deviceName?: string, deviceFingerprint?: any): Promise<import("..").SessionLoginResponse>;
1011
+ signIn(identifier: string, password: string, deviceName?: string, deviceFingerprint?: any): Promise<import("..").SessionLoginResponse>;
1012
+ signInWithEmail(email: string, password: string, deviceName?: string, deviceFingerprint?: any): Promise<import("..").SessionLoginResponse>;
801
1013
  httpService: import("../HttpService").HttpService;
802
1014
  cloudURL: string;
803
1015
  config: import("../OxyServices.base").OxyConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/mixins/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAetD;;;;;;;GAOG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AwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAA3mG,CAAC;sBAA0B,CAAC;yBAA6B,CAAC;;;;;;iBAAuhG,CAAC;qBAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAA3mG,CAAC;sBAA0B,CAAC;yBAA6B,CAAC;;;;;;iBAAuhG,CAAC;qBAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAA3mG,CAAC;sBAA0B,CAAC;yBAA6B,CAAC;;;;;;iBAAuhG,CAAC;qBAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAA3mG,CAAC;sBAA0B,CAAC;yBAA6B,CAAC;;;;;;iBAAuhG,CAAC;qBAAwB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAA3mG,CAAC;sBAA0B,CAAC;yBAA6B,CAAC;;;;;;iBAAuhG,CAAC;qBAAwB,CAAC;;;;;2BAFloM"}
@@ -1,9 +1,12 @@
1
1
  /**
2
2
  * Oxy Crypto Module
3
3
  *
4
- * Provides type definitions and polyfills for crypto operations.
5
- * Identity management (KeyManager, SignatureService) belongs ONLY in the Accounts app.
4
+ * Provides cryptographic identity management for the Oxy ecosystem.
5
+ * Handles key generation, secure storage, digital signatures, and recovery phrases.
6
6
  */
7
7
  import './polyfill';
8
- export { type BackupData } from './types';
8
+ export { KeyManager, type KeyPair } from './keyManager';
9
+ export { SignatureService, type SignedMessage, type AuthChallenge } from './signatureService';
10
+ export { RecoveryPhraseService, type RecoveryPhraseResult } from './recoveryPhrase';
11
+ export { KeyManager as default } from './keyManager';
9
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/crypto/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,YAAY,CAAC;AAGpB,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/crypto/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,YAAY,CAAC;AAEpB,OAAO,EAAE,UAAU,EAAE,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AACxD,OAAO,EACL,gBAAgB,EAChB,KAAK,aAAa,EAClB,KAAK,aAAa,EACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,qBAAqB,EACrB,KAAK,oBAAoB,EAC1B,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAE,UAAU,IAAI,OAAO,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,190 @@
1
+ /**
2
+ * Key Manager - ECDSA secp256k1 Key Generation and Storage
3
+ *
4
+ * Handles secure generation, storage, and retrieval of cryptographic keys.
5
+ * Private keys are stored securely using expo-secure-store and never leave the device.
6
+ */
7
+ import type { ECKeyPair } from 'elliptic';
8
+ export interface KeyPair {
9
+ publicKey: string;
10
+ privateKey: string;
11
+ }
12
+ export declare class KeyManager {
13
+ private static cachedPublicKey;
14
+ private static cachedHasIdentity;
15
+ private static cachedSharedPublicKey;
16
+ private static cachedHasSharedIdentity;
17
+ /**
18
+ * Invalidate cached identity state
19
+ * Called internally when identity is created/deleted/imported
20
+ */
21
+ private static invalidateCache;
22
+ /**
23
+ * Invalidate cached shared identity state
24
+ * Called internally when shared identity is created/deleted/imported
25
+ */
26
+ private static invalidateSharedCache;
27
+ /**
28
+ * Generate a new ECDSA secp256k1 key pair
29
+ * Returns the keys in hexadecimal format
30
+ */
31
+ static generateKeyPairSync(): KeyPair;
32
+ /**
33
+ * Generate a new key pair using secure random bytes
34
+ */
35
+ static generateKeyPair(): Promise<KeyPair>;
36
+ /**
37
+ * Create a shared identity accessible across all Oxy apps
38
+ *
39
+ * iOS: Stores in shared keychain group (requires entitlement configuration)
40
+ * Android: Stores in Account Manager (requires sharedUserId in manifest)
41
+ *
42
+ * This enables true cross-app SSO - when user signs in to one Oxy app,
43
+ * they're automatically signed in to all other Oxy apps.
44
+ *
45
+ * @returns Public key of the shared identity
46
+ * @throws Error if not on native platform or if sharing is not configured
47
+ */
48
+ static createSharedIdentity(): Promise<string>;
49
+ /**
50
+ * Get the shared public key (accessible across all Oxy apps)
51
+ *
52
+ * @returns Shared public key or null if no shared identity exists
53
+ */
54
+ static getSharedPublicKey(): Promise<string | null>;
55
+ /**
56
+ * Get the shared private key (for signing operations)
57
+ *
58
+ * WARNING: Only use this for signing operations within the app.
59
+ * The private key should NEVER be transmitted or exposed.
60
+ *
61
+ * @returns Shared private key or null if no shared identity exists
62
+ */
63
+ static getSharedPrivateKey(): Promise<string | null>;
64
+ /**
65
+ * Check if a shared identity exists (accessible across all Oxy apps)
66
+ *
67
+ * @returns True if shared identity exists, false otherwise
68
+ */
69
+ static hasSharedIdentity(): Promise<boolean>;
70
+ /**
71
+ * Import an existing key pair as shared identity
72
+ *
73
+ * This is used when:
74
+ * 1. User signs in to a new Oxy app for the first time
75
+ * 2. User has existing identity on another Oxy app
76
+ * 3. We want to sync the identity across apps
77
+ *
78
+ * @param privateKey - Private key in hex format
79
+ * @returns Public key
80
+ */
81
+ static importSharedIdentity(privateKey: string): Promise<string>;
82
+ /**
83
+ * Store session information in shared storage
84
+ *
85
+ * This allows all Oxy apps to access the same session without
86
+ * re-authenticating. When user signs in to one app, all apps
87
+ * get the session automatically.
88
+ *
89
+ * @param sessionId - Session ID from authentication
90
+ * @param accessToken - Access token for API calls
91
+ */
92
+ static storeSharedSession(sessionId: string, accessToken: string): Promise<void>;
93
+ /**
94
+ * Get shared session information
95
+ *
96
+ * This allows any Oxy app to check if user is already signed in
97
+ * via another Oxy app. Enables instant cross-app SSO.
98
+ *
99
+ * @returns Session data or null if no shared session exists
100
+ */
101
+ static getSharedSession(): Promise<{
102
+ sessionId: string;
103
+ accessToken: string;
104
+ } | null>;
105
+ /**
106
+ * Clear shared session (on logout)
107
+ *
108
+ * This signs out the user from ALL Oxy apps simultaneously.
109
+ * Call this when user explicitly logs out.
110
+ */
111
+ static clearSharedSession(): Promise<void>;
112
+ /**
113
+ * Migrate local identity to shared identity
114
+ *
115
+ * Call this when upgrading existing apps to use shared identities.
116
+ * Copies the device-specific identity to shared storage so it can
117
+ * be accessed by other Oxy apps.
118
+ *
119
+ * @returns True if migration was successful, false if no local identity exists
120
+ */
121
+ static migrateToSharedIdentity(): Promise<boolean>;
122
+ /**
123
+ * Generate and securely store a new key pair on the device
124
+ * Returns only the public key (private key is stored securely)
125
+ */
126
+ static createIdentity(): Promise<string>;
127
+ /**
128
+ * Import an existing key pair (e.g., from recovery phrase)
129
+ */
130
+ static importKeyPair(privateKey: string): Promise<string>;
131
+ /**
132
+ * Get the stored private key
133
+ * WARNING: Only use this for signing operations within the app
134
+ */
135
+ static getPrivateKey(): Promise<string | null>;
136
+ /**
137
+ * Get the stored public key (cached for performance)
138
+ */
139
+ static getPublicKey(): Promise<string | null>;
140
+ /**
141
+ * Check if an identity (key pair) exists on this device (cached for performance)
142
+ */
143
+ static hasIdentity(): Promise<boolean>;
144
+ /**
145
+ * Delete the stored identity (both keys)
146
+ * Use with EXTREME caution - this is irreversible without a recovery phrase
147
+ * This should ONLY be called when explicitly requested by the user
148
+ * @param skipBackup - If true, skip backup before deletion (default: false)
149
+ * @param force - If true, skip confirmation checks (default: false)
150
+ * @param userConfirmed - If true, user has explicitly confirmed deletion (default: false)
151
+ */
152
+ static deleteIdentity(skipBackup?: boolean, force?: boolean, userConfirmed?: boolean): Promise<void>;
153
+ /**
154
+ * Backup identity to SecureStore (separate backup storage)
155
+ * This provides a recovery mechanism if primary storage fails
156
+ */
157
+ static backupIdentity(): Promise<boolean>;
158
+ /**
159
+ * Verify identity integrity - checks if keys are valid and accessible
160
+ */
161
+ static verifyIdentityIntegrity(): Promise<boolean>;
162
+ /**
163
+ * Restore identity from backup if primary storage is corrupted
164
+ */
165
+ static restoreIdentityFromBackup(): Promise<boolean>;
166
+ /**
167
+ * Get the elliptic curve key object from the stored private key
168
+ * Used internally for signing operations
169
+ */
170
+ static getKeyPairObject(): Promise<ECKeyPair | null>;
171
+ /**
172
+ * Derive public key from a private key (without storing)
173
+ */
174
+ static derivePublicKey(privateKey: string): string;
175
+ /**
176
+ * Validate that a string is a valid public key
177
+ */
178
+ static isValidPublicKey(publicKey: string): boolean;
179
+ /**
180
+ * Validate that a string is a valid private key
181
+ */
182
+ static isValidPrivateKey(privateKey: string): boolean;
183
+ /**
184
+ * Get a shortened version of the public key for display
185
+ * Format: first 8 chars...last 8 chars
186
+ */
187
+ static shortenPublicKey(publicKey: string): string;
188
+ }
189
+ export default KeyManager;
190
+ //# sourceMappingURL=keyManager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keyManager.d.ts","sourceRoot":"","sources":["../../../src/crypto/keyManager.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AA2H1C,MAAM,WAAW,OAAO;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,UAAU;IAErB,OAAO,CAAC,MAAM,CAAC,eAAe,CAAuB;IACrD,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAwB;IACxD,OAAO,CAAC,MAAM,CAAC,qBAAqB,CAAuB;IAC3D,OAAO,CAAC,MAAM,CAAC,uBAAuB,CAAwB;IAE9D;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;IAK9B;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,qBAAqB;IAKpC;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,GAAE,OAAe,EAC3B,KAAK,GAAE,OAAe,EACtB,aAAa,GAAE,OAAe,GAC7B,OAAO,CAAC,IAAI,CAAC;IAkDhB;;;OAGG;WACU,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IA6B/C;;OAEG;WACU,uBAAuB,IAAI,OAAO,CAAC,OAAO,CAAC;IA2CxD;;OAEG;WACU,yBAAyB,IAAI,OAAO,CAAC,OAAO,CAAC;IAsD1D;;;OAGG;WACU,gBAAgB,IAAI,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;IAS1D;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAKlD;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IASnD;;OAEG;IACH,MAAM,CAAC,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAWrD;;;OAGG;IACH,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;CAInD;AAED,eAAe,UAAU,CAAC"}
@@ -5,8 +5,9 @@
5
5
  * before any crypto operations are performed.
6
6
  *
7
7
  * Polyfills included:
8
- * - Buffer: Required by crypto libraries
9
- * - crypto.getRandomValues: Required for secure random number generation
8
+ * - Buffer: Required by bip39 and other crypto libraries
9
+ * - crypto.getRandomValues: Required by bip39 for secure random number generation
10
10
  */
11
- export {};
11
+ import { Buffer } from 'buffer';
12
+ export { Buffer };
12
13
  //# sourceMappingURL=polyfill.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"polyfill.d.ts","sourceRoot":"","sources":["../../../src/crypto/polyfill.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
1
+ {"version":3,"file":"polyfill.d.ts","sourceRoot":"","sources":["../../../src/crypto/polyfill.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAkEhC,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Recovery Phrase Service - BIP39 Mnemonic Generation
3
+ *
4
+ * Handles generation and restoration of recovery phrases (mnemonic seeds)
5
+ * for backing up and restoring user identities.
6
+ *
7
+ * Note: This module requires the polyfill to be loaded first (done via crypto/index.ts)
8
+ */
9
+ export interface RecoveryPhraseResult {
10
+ phrase: string;
11
+ words: string[];
12
+ publicKey: string;
13
+ }
14
+ export declare class RecoveryPhraseService {
15
+ /**
16
+ * Generate a new identity with a recovery phrase
17
+ * Returns the mnemonic phrase (should only be shown once to the user)
18
+ */
19
+ static generateIdentityWithRecovery(): Promise<RecoveryPhraseResult>;
20
+ /**
21
+ * Generate a 24-word recovery phrase for higher security
22
+ */
23
+ static generateIdentityWithRecovery24(): Promise<RecoveryPhraseResult>;
24
+ /**
25
+ * Restore an identity from a recovery phrase
26
+ */
27
+ static restoreFromPhrase(phrase: string): Promise<string>;
28
+ /**
29
+ * Validate a recovery phrase without importing it
30
+ */
31
+ static validatePhrase(phrase: string): boolean;
32
+ /**
33
+ * Get the word list for autocomplete/validation
34
+ */
35
+ static getWordList(): string[];
36
+ /**
37
+ * Check if a word is valid in the BIP39 word list
38
+ */
39
+ static isValidWord(word: string): boolean;
40
+ /**
41
+ * Get suggestions for a partial word
42
+ */
43
+ static getSuggestions(partial: string, limit?: number): string[];
44
+ /**
45
+ * Derive the public key from a phrase without storing
46
+ * Useful for verification before importing
47
+ */
48
+ static derivePublicKeyFromPhrase(phrase: string): Promise<string>;
49
+ /**
50
+ * Convert a phrase to its word array
51
+ */
52
+ static phraseToWords(phrase: string): string[];
53
+ /**
54
+ * Convert a word array to a phrase string
55
+ */
56
+ static wordsToPhrase(words: string[]): string;
57
+ }
58
+ export default RecoveryPhraseService;
59
+ //# sourceMappingURL=recoveryPhrase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recoveryPhrase.d.ts","sourceRoot":"","sources":["../../../src/crypto/recoveryPhrase.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAiBH,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,qBAAqB;IAChC;;;OAGG;WACU,4BAA4B,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAsB1E;;OAEG;WACU,8BAA8B,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAgB5E;;OAEG;WACU,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAmB/D;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAK9C;;OAEG;IACH,MAAM,CAAC,WAAW,IAAI,MAAM,EAAE;IAI9B;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIzC;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,GAAE,MAAU,GAAG,MAAM,EAAE;IAOnE;;;OAGG;WACU,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAcvE;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE;IAI9C;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM;CAG9C;AAED,eAAe,qBAAqB,CAAC"}
@@ -0,0 +1,87 @@
1
+ /**
2
+ * Signature Service - ECDSA Digital Signatures
3
+ *
4
+ * Handles signing and verification of messages using ECDSA secp256k1.
5
+ * Used for authenticating requests and proving identity ownership.
6
+ */
7
+ export interface SignedMessage {
8
+ message: string;
9
+ signature: string;
10
+ publicKey: string;
11
+ timestamp: number;
12
+ }
13
+ export interface AuthChallenge {
14
+ challenge: string;
15
+ publicKey: string;
16
+ timestamp: number;
17
+ }
18
+ export declare class SignatureService {
19
+ /**
20
+ * Generate a random challenge string (for offline use)
21
+ * Uses expo-crypto in React Native, crypto.randomBytes in Node.js
22
+ */
23
+ static generateChallenge(): Promise<string>;
24
+ /**
25
+ * Hash a message using SHA-256
26
+ */
27
+ static hashMessage(message: string): Promise<string>;
28
+ /**
29
+ * Sign a message using the stored private key
30
+ * Returns the signature in DER format (hex encoded)
31
+ */
32
+ static sign(message: string): Promise<string>;
33
+ /**
34
+ * Sign a message with an explicit private key (without storing)
35
+ * Useful for one-time operations or testing
36
+ */
37
+ static signWithKey(message: string, privateKey: string): Promise<string>;
38
+ /**
39
+ * Verify a signature against a message and public key
40
+ */
41
+ static verify(message: string, signature: string, publicKey: string): Promise<boolean>;
42
+ /**
43
+ * Synchronous verification (for Node.js backend)
44
+ * Uses crypto module directly for hashing
45
+ * Note: This method should only be used in Node.js environments
46
+ */
47
+ static verifySync(message: string, signature: string, publicKey: string): boolean;
48
+ /**
49
+ * Create a signed message object with metadata
50
+ */
51
+ static createSignedMessage(message: string): Promise<SignedMessage>;
52
+ /**
53
+ * Verify a signed message object
54
+ * Checks both signature validity and timestamp freshness
55
+ */
56
+ static verifySignedMessage(signedMessage: SignedMessage, maxAgeMs?: number): Promise<boolean>;
57
+ /**
58
+ * Create a signed authentication challenge response
59
+ * Used for challenge-response authentication
60
+ */
61
+ static signChallenge(challenge: string): Promise<AuthChallenge>;
62
+ /**
63
+ * Verify a challenge response
64
+ */
65
+ static verifyChallengeResponse(originalChallenge: string, response: AuthChallenge, maxAgeMs?: number): Promise<boolean>;
66
+ /**
67
+ * Create a registration signature
68
+ * Used when registering a new identity with the server
69
+ * Format matches server expectation: oxy:register:{publicKey}:{timestamp}
70
+ */
71
+ static createRegistrationSignature(): Promise<{
72
+ signature: string;
73
+ publicKey: string;
74
+ timestamp: number;
75
+ }>;
76
+ /**
77
+ * Sign arbitrary data for API requests
78
+ * Creates a canonical string representation and signs it
79
+ */
80
+ static signRequestData(data: Record<string, unknown>): Promise<{
81
+ signature: string;
82
+ publicKey: string;
83
+ timestamp: number;
84
+ }>;
85
+ }
86
+ export default SignatureService;
87
+ //# sourceMappingURL=signatureService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signatureService.d.ts","sourceRoot":"","sources":["../../../src/crypto/signatureService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAiEH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,qBAAa,gBAAgB;IAC3B;;;OAGG;WACU,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC;IA0BjD;;OAEG;WACU,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAI1D;;;OAGG;WACU,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAWnD;;;OAGG;WACU,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAO9E;;OAEG;WACU,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAU5F;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO;IAkBjF;;OAEG;WACU,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAkBzE;;;OAGG;WACU,mBA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