@oxyhq/services 28.0.0 → 29.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (324) hide show
  1. package/NOTICE +10 -9
  2. package/README.md +65 -2
  3. package/android/src/main/java/so/oxy/devicesession/OxyDeviceSessionModule.kt +178 -0
  4. package/android/src/main/java/so/oxy/devicesession/OxyDeviceSessionProvider.kt +99 -0
  5. package/android/src/main/java/so/oxy/devicesession/OxyDeviceSessionStore.kt +115 -0
  6. package/expo-module.config.json +1 -0
  7. package/lib/commonjs/index.js +60 -16
  8. package/lib/commonjs/index.js.map +1 -1
  9. package/lib/commonjs/ui/boot/runProviderColdBoot.js +7 -0
  10. package/lib/commonjs/ui/boot/runProviderColdBoot.js.map +1 -1
  11. package/lib/commonjs/ui/client.js +12 -7
  12. package/lib/commonjs/ui/client.js.map +1 -1
  13. package/lib/commonjs/ui/components/OxyAccountDialogScreen.js +10 -27
  14. package/lib/commonjs/ui/components/OxyAccountDialogScreen.js.map +1 -1
  15. package/lib/commonjs/ui/components/OxyAuthChooser.js +132 -44
  16. package/lib/commonjs/ui/components/OxyAuthChooser.js.map +1 -1
  17. package/lib/commonjs/ui/components/OxyProvider.js +4 -2
  18. package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
  19. package/lib/commonjs/ui/components/SurfaceScreen.js +31 -3
  20. package/lib/commonjs/ui/components/SurfaceScreen.js.map +1 -1
  21. package/lib/commonjs/ui/components/authChooser/AccountsMenuView.js +209 -84
  22. package/lib/commonjs/ui/components/authChooser/AccountsMenuView.js.map +1 -1
  23. package/lib/commonjs/ui/components/authChooser/SignInEntryView.js +25 -7
  24. package/lib/commonjs/ui/components/authChooser/SignInEntryView.js.map +1 -1
  25. package/lib/commonjs/ui/components/authChooser/primitives.js +35 -22
  26. package/lib/commonjs/ui/components/authChooser/primitives.js.map +1 -1
  27. package/lib/commonjs/ui/components/authChooser/types.js +11 -0
  28. package/lib/commonjs/ui/components/authChooser/types.js.map +1 -1
  29. package/lib/commonjs/ui/context/OxyContext.js +257 -306
  30. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  31. package/lib/commonjs/ui/context/hooks/useAuthOperations.js +27 -37
  32. package/lib/commonjs/ui/context/hooks/useAuthOperations.js.map +1 -1
  33. package/lib/commonjs/ui/context/oxyContextHelpers.js +0 -29
  34. package/lib/commonjs/ui/context/oxyContextHelpers.js.map +1 -1
  35. package/lib/commonjs/ui/context/useOxyAccountGraph.js +6 -17
  36. package/lib/commonjs/ui/context/useOxyAccountGraph.js.map +1 -1
  37. package/lib/commonjs/ui/hooks/accountDialogSnapshot.js +42 -0
  38. package/lib/commonjs/ui/hooks/accountDialogSnapshot.js.map +1 -0
  39. package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js +0 -19
  40. package/lib/commonjs/ui/hooks/mutations/useAccountMutations.js.map +1 -1
  41. package/lib/commonjs/ui/hooks/useDeviceSwitcher.js +57 -0
  42. package/lib/commonjs/ui/hooks/useDeviceSwitcher.js.map +1 -0
  43. package/lib/commonjs/ui/hooks/useI18n.js +22 -3
  44. package/lib/commonjs/ui/hooks/useI18n.js.map +1 -1
  45. package/lib/commonjs/ui/hooks/useSessionManagement.js +46 -153
  46. package/lib/commonjs/ui/hooks/useSessionManagement.js.map +1 -1
  47. package/lib/commonjs/ui/index.js +12 -7
  48. package/lib/commonjs/ui/index.js.map +1 -1
  49. package/lib/commonjs/ui/navigation/routes.js +85 -73
  50. package/lib/commonjs/ui/navigation/routes.js.map +1 -1
  51. package/lib/commonjs/ui/navigation/surfaces.js +8 -7
  52. package/lib/commonjs/ui/navigation/surfaces.js.map +1 -1
  53. package/lib/commonjs/ui/runtime/createOxyRuntime.js +433 -0
  54. package/lib/commonjs/ui/runtime/createOxyRuntime.js.map +1 -0
  55. package/lib/commonjs/ui/runtime/index.js +63 -0
  56. package/lib/commonjs/ui/runtime/index.js.map +1 -0
  57. package/lib/commonjs/ui/runtime/runtimeContext.js +83 -0
  58. package/lib/commonjs/ui/runtime/runtimeContext.js.map +1 -0
  59. package/lib/commonjs/ui/runtime/types.js +6 -0
  60. package/lib/commonjs/ui/runtime/types.js.map +1 -0
  61. package/lib/commonjs/ui/runtime/useRuntimeSnapshot.js +57 -0
  62. package/lib/commonjs/ui/runtime/useRuntimeSnapshot.js.map +1 -0
  63. package/lib/commonjs/ui/server.js +1 -2
  64. package/lib/commonjs/ui/server.js.map +1 -1
  65. package/lib/commonjs/ui/session/authStore.js +45 -9
  66. package/lib/commonjs/ui/session/authStore.js.map +1 -1
  67. package/lib/commonjs/ui/session/sharedDeviceCredentialStore.js +306 -0
  68. package/lib/commonjs/ui/session/sharedDeviceCredentialStore.js.map +1 -0
  69. package/lib/commonjs/ui/stores/authStore.js +154 -55
  70. package/lib/commonjs/ui/stores/authStore.js.map +1 -1
  71. package/lib/commonjs/ui/utils/avatarUtils.js +2 -36
  72. package/lib/commonjs/ui/utils/avatarUtils.js.map +1 -1
  73. package/lib/module/index.js +16 -8
  74. package/lib/module/index.js.map +1 -1
  75. package/lib/module/ui/boot/runProviderColdBoot.js +7 -0
  76. package/lib/module/ui/boot/runProviderColdBoot.js.map +1 -1
  77. package/lib/module/ui/client.js +1 -2
  78. package/lib/module/ui/client.js.map +1 -1
  79. package/lib/module/ui/components/OxyAccountDialogScreen.js +10 -27
  80. package/lib/module/ui/components/OxyAccountDialogScreen.js.map +1 -1
  81. package/lib/module/ui/components/OxyAuthChooser.js +134 -44
  82. package/lib/module/ui/components/OxyAuthChooser.js.map +1 -1
  83. package/lib/module/ui/components/OxyProvider.js +5 -3
  84. package/lib/module/ui/components/OxyProvider.js.map +1 -1
  85. package/lib/module/ui/components/SurfaceScreen.js +33 -5
  86. package/lib/module/ui/components/SurfaceScreen.js.map +1 -1
  87. package/lib/module/ui/components/authChooser/AccountsMenuView.js +210 -85
  88. package/lib/module/ui/components/authChooser/AccountsMenuView.js.map +1 -1
  89. package/lib/module/ui/components/authChooser/SignInEntryView.js +25 -7
  90. package/lib/module/ui/components/authChooser/SignInEntryView.js.map +1 -1
  91. package/lib/module/ui/components/authChooser/primitives.js +35 -22
  92. package/lib/module/ui/components/authChooser/primitives.js.map +1 -1
  93. package/lib/module/ui/components/authChooser/types.js +11 -0
  94. package/lib/module/ui/components/authChooser/types.js.map +1 -1
  95. package/lib/module/ui/context/OxyContext.js +251 -303
  96. package/lib/module/ui/context/OxyContext.js.map +1 -1
  97. package/lib/module/ui/context/hooks/useAuthOperations.js +27 -37
  98. package/lib/module/ui/context/hooks/useAuthOperations.js.map +1 -1
  99. package/lib/module/ui/context/oxyContextHelpers.js +0 -28
  100. package/lib/module/ui/context/oxyContextHelpers.js.map +1 -1
  101. package/lib/module/ui/context/useOxyAccountGraph.js +6 -17
  102. package/lib/module/ui/context/useOxyAccountGraph.js.map +1 -1
  103. package/lib/module/ui/hooks/accountDialogSnapshot.js +38 -0
  104. package/lib/module/ui/hooks/accountDialogSnapshot.js.map +1 -0
  105. package/lib/module/ui/hooks/mutations/useAccountMutations.js +0 -19
  106. package/lib/module/ui/hooks/mutations/useAccountMutations.js.map +1 -1
  107. package/lib/module/ui/hooks/useDeviceSwitcher.js +53 -0
  108. package/lib/module/ui/hooks/useDeviceSwitcher.js.map +1 -0
  109. package/lib/module/ui/hooks/useI18n.js +24 -4
  110. package/lib/module/ui/hooks/useI18n.js.map +1 -1
  111. package/lib/module/ui/hooks/useSessionManagement.js +47 -155
  112. package/lib/module/ui/hooks/useSessionManagement.js.map +1 -1
  113. package/lib/module/ui/index.js +1 -2
  114. package/lib/module/ui/index.js.map +1 -1
  115. package/lib/module/ui/navigation/routes.js +84 -72
  116. package/lib/module/ui/navigation/routes.js.map +1 -1
  117. package/lib/module/ui/navigation/surfaces.js +6 -6
  118. package/lib/module/ui/navigation/surfaces.js.map +1 -1
  119. package/lib/module/ui/runtime/createOxyRuntime.js +430 -0
  120. package/lib/module/ui/runtime/createOxyRuntime.js.map +1 -0
  121. package/lib/module/ui/runtime/index.js +15 -0
  122. package/lib/module/ui/runtime/index.js.map +1 -0
  123. package/lib/module/ui/runtime/runtimeContext.js +75 -0
  124. package/lib/module/ui/runtime/runtimeContext.js.map +1 -0
  125. package/lib/module/ui/runtime/types.js +4 -0
  126. package/lib/module/ui/runtime/types.js.map +1 -0
  127. package/lib/module/ui/runtime/useRuntimeSnapshot.js +52 -0
  128. package/lib/module/ui/runtime/useRuntimeSnapshot.js.map +1 -0
  129. package/lib/module/ui/server.js +0 -1
  130. package/lib/module/ui/server.js.map +1 -1
  131. package/lib/module/ui/session/authStore.js +46 -11
  132. package/lib/module/ui/session/authStore.js.map +1 -1
  133. package/lib/module/ui/session/sharedDeviceCredentialStore.js +302 -0
  134. package/lib/module/ui/session/sharedDeviceCredentialStore.js.map +1 -0
  135. package/lib/module/ui/stores/authStore.js +154 -55
  136. package/lib/module/ui/stores/authStore.js.map +1 -1
  137. package/lib/module/ui/utils/avatarUtils.js +2 -35
  138. package/lib/module/ui/utils/avatarUtils.js.map +1 -1
  139. package/lib/typescript/commonjs/index.d.ts +5 -3
  140. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  141. package/lib/typescript/commonjs/ui/boot/runProviderColdBoot.d.ts.map +1 -1
  142. package/lib/typescript/commonjs/ui/client.d.ts +1 -2
  143. package/lib/typescript/commonjs/ui/client.d.ts.map +1 -1
  144. package/lib/typescript/commonjs/ui/components/OxyAccountDialogScreen.d.ts.map +1 -1
  145. package/lib/typescript/commonjs/ui/components/OxyAuthChooser.d.ts.map +1 -1
  146. package/lib/typescript/commonjs/ui/components/OxyProvider.d.ts.map +1 -1
  147. package/lib/typescript/commonjs/ui/components/SurfaceScreen.d.ts.map +1 -1
  148. package/lib/typescript/commonjs/ui/components/authChooser/AccountsMenuView.d.ts +11 -4
  149. package/lib/typescript/commonjs/ui/components/authChooser/AccountsMenuView.d.ts.map +1 -1
  150. package/lib/typescript/commonjs/ui/components/authChooser/SignInEntryView.d.ts +3 -1
  151. package/lib/typescript/commonjs/ui/components/authChooser/SignInEntryView.d.ts.map +1 -1
  152. package/lib/typescript/commonjs/ui/components/authChooser/primitives.d.ts +18 -6
  153. package/lib/typescript/commonjs/ui/components/authChooser/primitives.d.ts.map +1 -1
  154. package/lib/typescript/commonjs/ui/components/authChooser/types.d.ts +33 -1
  155. package/lib/typescript/commonjs/ui/components/authChooser/types.d.ts.map +1 -1
  156. package/lib/typescript/commonjs/ui/context/OxyContext.d.ts +35 -4
  157. package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
  158. package/lib/typescript/commonjs/ui/context/hooks/useAuthOperations.d.ts +8 -12
  159. package/lib/typescript/commonjs/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
  160. package/lib/typescript/commonjs/ui/context/oxyContextHelpers.d.ts +0 -2
  161. package/lib/typescript/commonjs/ui/context/oxyContextHelpers.d.ts.map +1 -1
  162. package/lib/typescript/commonjs/ui/context/oxyContextTypes.d.ts +9 -1
  163. package/lib/typescript/commonjs/ui/context/oxyContextTypes.d.ts.map +1 -1
  164. package/lib/typescript/commonjs/ui/context/useOxyAccountGraph.d.ts +1 -3
  165. package/lib/typescript/commonjs/ui/context/useOxyAccountGraph.d.ts.map +1 -1
  166. package/lib/typescript/commonjs/ui/hooks/accountDialogSnapshot.d.ts +15 -0
  167. package/lib/typescript/commonjs/ui/hooks/accountDialogSnapshot.d.ts.map +1 -0
  168. package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
  169. package/lib/typescript/commonjs/ui/hooks/useDeviceSwitcher.d.ts +49 -0
  170. package/lib/typescript/commonjs/ui/hooks/useDeviceSwitcher.d.ts.map +1 -0
  171. package/lib/typescript/commonjs/ui/hooks/useI18n.d.ts +13 -0
  172. package/lib/typescript/commonjs/ui/hooks/useI18n.d.ts.map +1 -1
  173. package/lib/typescript/commonjs/ui/hooks/useSessionManagement.d.ts +23 -18
  174. package/lib/typescript/commonjs/ui/hooks/useSessionManagement.d.ts.map +1 -1
  175. package/lib/typescript/commonjs/ui/index.d.ts +1 -2
  176. package/lib/typescript/commonjs/ui/index.d.ts.map +1 -1
  177. package/lib/typescript/commonjs/ui/navigation/routes.d.ts +15 -1
  178. package/lib/typescript/commonjs/ui/navigation/routes.d.ts.map +1 -1
  179. package/lib/typescript/commonjs/ui/navigation/surfaces.d.ts.map +1 -1
  180. package/lib/typescript/commonjs/ui/runtime/createOxyRuntime.d.ts +144 -0
  181. package/lib/typescript/commonjs/ui/runtime/createOxyRuntime.d.ts.map +1 -0
  182. package/lib/typescript/commonjs/ui/runtime/index.d.ts +16 -0
  183. package/lib/typescript/commonjs/ui/runtime/index.d.ts.map +1 -0
  184. package/lib/typescript/commonjs/ui/runtime/runtimeContext.d.ts +43 -0
  185. package/lib/typescript/commonjs/ui/runtime/runtimeContext.d.ts.map +1 -0
  186. package/lib/typescript/commonjs/ui/runtime/types.d.ts +89 -0
  187. package/lib/typescript/commonjs/ui/runtime/types.d.ts.map +1 -0
  188. package/lib/typescript/commonjs/ui/runtime/useRuntimeSnapshot.d.ts +23 -0
  189. package/lib/typescript/commonjs/ui/runtime/useRuntimeSnapshot.d.ts.map +1 -0
  190. package/lib/typescript/commonjs/ui/server.d.ts +0 -1
  191. package/lib/typescript/commonjs/ui/server.d.ts.map +1 -1
  192. package/lib/typescript/commonjs/ui/session/authStore.d.ts +60 -9
  193. package/lib/typescript/commonjs/ui/session/authStore.d.ts.map +1 -1
  194. package/lib/typescript/commonjs/ui/session/sharedDeviceCredentialStore.d.ts +32 -0
  195. package/lib/typescript/commonjs/ui/session/sharedDeviceCredentialStore.d.ts.map +1 -0
  196. package/lib/typescript/commonjs/ui/stores/authStore.d.ts +49 -5
  197. package/lib/typescript/commonjs/ui/stores/authStore.d.ts.map +1 -1
  198. package/lib/typescript/commonjs/ui/types/navigation.d.ts +26 -0
  199. package/lib/typescript/commonjs/ui/types/navigation.d.ts.map +1 -1
  200. package/lib/typescript/commonjs/ui/utils/avatarUtils.d.ts +2 -10
  201. package/lib/typescript/commonjs/ui/utils/avatarUtils.d.ts.map +1 -1
  202. package/lib/typescript/module/index.d.ts +5 -3
  203. package/lib/typescript/module/index.d.ts.map +1 -1
  204. package/lib/typescript/module/ui/boot/runProviderColdBoot.d.ts.map +1 -1
  205. package/lib/typescript/module/ui/client.d.ts +1 -2
  206. package/lib/typescript/module/ui/client.d.ts.map +1 -1
  207. package/lib/typescript/module/ui/components/OxyAccountDialogScreen.d.ts.map +1 -1
  208. package/lib/typescript/module/ui/components/OxyAuthChooser.d.ts.map +1 -1
  209. package/lib/typescript/module/ui/components/OxyProvider.d.ts.map +1 -1
  210. package/lib/typescript/module/ui/components/SurfaceScreen.d.ts.map +1 -1
  211. package/lib/typescript/module/ui/components/authChooser/AccountsMenuView.d.ts +11 -4
  212. package/lib/typescript/module/ui/components/authChooser/AccountsMenuView.d.ts.map +1 -1
  213. package/lib/typescript/module/ui/components/authChooser/SignInEntryView.d.ts +3 -1
  214. package/lib/typescript/module/ui/components/authChooser/SignInEntryView.d.ts.map +1 -1
  215. package/lib/typescript/module/ui/components/authChooser/primitives.d.ts +18 -6
  216. package/lib/typescript/module/ui/components/authChooser/primitives.d.ts.map +1 -1
  217. package/lib/typescript/module/ui/components/authChooser/types.d.ts +33 -1
  218. package/lib/typescript/module/ui/components/authChooser/types.d.ts.map +1 -1
  219. package/lib/typescript/module/ui/context/OxyContext.d.ts +35 -4
  220. package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
  221. package/lib/typescript/module/ui/context/hooks/useAuthOperations.d.ts +8 -12
  222. package/lib/typescript/module/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
  223. package/lib/typescript/module/ui/context/oxyContextHelpers.d.ts +0 -2
  224. package/lib/typescript/module/ui/context/oxyContextHelpers.d.ts.map +1 -1
  225. package/lib/typescript/module/ui/context/oxyContextTypes.d.ts +9 -1
  226. package/lib/typescript/module/ui/context/oxyContextTypes.d.ts.map +1 -1
  227. package/lib/typescript/module/ui/context/useOxyAccountGraph.d.ts +1 -3
  228. package/lib/typescript/module/ui/context/useOxyAccountGraph.d.ts.map +1 -1
  229. package/lib/typescript/module/ui/hooks/accountDialogSnapshot.d.ts +15 -0
  230. package/lib/typescript/module/ui/hooks/accountDialogSnapshot.d.ts.map +1 -0
  231. package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
  232. package/lib/typescript/module/ui/hooks/useDeviceSwitcher.d.ts +49 -0
  233. package/lib/typescript/module/ui/hooks/useDeviceSwitcher.d.ts.map +1 -0
  234. package/lib/typescript/module/ui/hooks/useI18n.d.ts +13 -0
  235. package/lib/typescript/module/ui/hooks/useI18n.d.ts.map +1 -1
  236. package/lib/typescript/module/ui/hooks/useSessionManagement.d.ts +23 -18
  237. package/lib/typescript/module/ui/hooks/useSessionManagement.d.ts.map +1 -1
  238. package/lib/typescript/module/ui/index.d.ts +1 -2
  239. package/lib/typescript/module/ui/index.d.ts.map +1 -1
  240. package/lib/typescript/module/ui/navigation/routes.d.ts +15 -1
  241. package/lib/typescript/module/ui/navigation/routes.d.ts.map +1 -1
  242. package/lib/typescript/module/ui/navigation/surfaces.d.ts.map +1 -1
  243. package/lib/typescript/module/ui/runtime/createOxyRuntime.d.ts +144 -0
  244. package/lib/typescript/module/ui/runtime/createOxyRuntime.d.ts.map +1 -0
  245. package/lib/typescript/module/ui/runtime/index.d.ts +16 -0
  246. package/lib/typescript/module/ui/runtime/index.d.ts.map +1 -0
  247. package/lib/typescript/module/ui/runtime/runtimeContext.d.ts +43 -0
  248. package/lib/typescript/module/ui/runtime/runtimeContext.d.ts.map +1 -0
  249. package/lib/typescript/module/ui/runtime/types.d.ts +89 -0
  250. package/lib/typescript/module/ui/runtime/types.d.ts.map +1 -0
  251. package/lib/typescript/module/ui/runtime/useRuntimeSnapshot.d.ts +23 -0
  252. package/lib/typescript/module/ui/runtime/useRuntimeSnapshot.d.ts.map +1 -0
  253. package/lib/typescript/module/ui/server.d.ts +0 -1
  254. package/lib/typescript/module/ui/server.d.ts.map +1 -1
  255. package/lib/typescript/module/ui/session/authStore.d.ts +60 -9
  256. package/lib/typescript/module/ui/session/authStore.d.ts.map +1 -1
  257. package/lib/typescript/module/ui/session/sharedDeviceCredentialStore.d.ts +32 -0
  258. package/lib/typescript/module/ui/session/sharedDeviceCredentialStore.d.ts.map +1 -0
  259. package/lib/typescript/module/ui/stores/authStore.d.ts +49 -5
  260. package/lib/typescript/module/ui/stores/authStore.d.ts.map +1 -1
  261. package/lib/typescript/module/ui/types/navigation.d.ts +26 -0
  262. package/lib/typescript/module/ui/types/navigation.d.ts.map +1 -1
  263. package/lib/typescript/module/ui/utils/avatarUtils.d.ts +2 -10
  264. package/lib/typescript/module/ui/utils/avatarUtils.d.ts.map +1 -1
  265. package/package.json +6 -7
  266. package/plugins/withSharedDeviceSessionProvider.js +102 -0
  267. package/plugins/withSharedDeviceSessionReader.js +57 -0
  268. package/src/__tests__/esmSourcePurity.test.ts +61 -0
  269. package/src/index.ts +31 -9
  270. package/src/ui/boot/runProviderColdBoot.ts +7 -0
  271. package/src/ui/client.ts +1 -2
  272. package/src/ui/components/OxyAccountDialogScreen.tsx +10 -29
  273. package/src/ui/components/OxyAuthChooser.tsx +149 -50
  274. package/src/ui/components/OxyProvider.tsx +7 -5
  275. package/src/ui/components/SurfaceScreen.tsx +28 -4
  276. package/src/ui/components/authChooser/AccountsMenuView.tsx +246 -96
  277. package/src/ui/components/authChooser/SignInEntryView.tsx +31 -8
  278. package/src/ui/components/authChooser/primitives.tsx +37 -23
  279. package/src/ui/components/authChooser/types.ts +34 -1
  280. package/src/ui/context/OxyContext.tsx +269 -324
  281. package/src/ui/context/hooks/useAuthOperations.ts +32 -35
  282. package/src/ui/context/oxyContextHelpers.ts +0 -30
  283. package/src/ui/context/oxyContextTypes.ts +9 -1
  284. package/src/ui/context/useOxyAccountGraph.ts +5 -19
  285. package/src/ui/hooks/accountDialogSnapshot.ts +37 -0
  286. package/src/ui/hooks/mutations/useAccountMutations.ts +0 -19
  287. package/src/ui/hooks/queries/__tests__/userCache.test.ts +12 -1
  288. package/src/ui/hooks/useDeviceSwitcher.ts +110 -0
  289. package/src/ui/hooks/useI18n.ts +23 -3
  290. package/src/ui/hooks/useSessionManagement.ts +62 -211
  291. package/src/ui/index.ts +1 -2
  292. package/src/ui/navigation/routes.ts +85 -75
  293. package/src/ui/navigation/surfaces.ts +6 -9
  294. package/src/ui/runtime/createOxyRuntime.ts +623 -0
  295. package/src/ui/runtime/index.ts +34 -0
  296. package/src/ui/runtime/runtimeContext.tsx +111 -0
  297. package/src/ui/runtime/types.ts +110 -0
  298. package/src/ui/runtime/useRuntimeSnapshot.ts +52 -0
  299. package/src/ui/server.ts +0 -1
  300. package/src/ui/session/__tests__/authStore.test.ts +90 -0
  301. package/src/ui/session/__tests__/sharedDeviceCredentialStore.test.ts +289 -0
  302. package/src/ui/session/authStore.ts +78 -9
  303. package/src/ui/session/sharedDeviceCredentialStore.ts +318 -0
  304. package/src/ui/stores/authStore.ts +171 -43
  305. package/src/ui/types/navigation.ts +26 -0
  306. package/src/ui/utils/avatarUtils.ts +2 -37
  307. package/lib/commonjs/ui/hooks/useSwitchableAccounts.js +0 -64
  308. package/lib/commonjs/ui/hooks/useSwitchableAccounts.js.map +0 -1
  309. package/lib/commonjs/ui/stores/accountStore.js +0 -221
  310. package/lib/commonjs/ui/stores/accountStore.js.map +0 -1
  311. package/lib/module/ui/hooks/useSwitchableAccounts.js +0 -60
  312. package/lib/module/ui/hooks/useSwitchableAccounts.js.map +0 -1
  313. package/lib/module/ui/stores/accountStore.js +0 -213
  314. package/lib/module/ui/stores/accountStore.js.map +0 -1
  315. package/lib/typescript/commonjs/ui/hooks/useSwitchableAccounts.d.ts +0 -23
  316. package/lib/typescript/commonjs/ui/hooks/useSwitchableAccounts.d.ts.map +0 -1
  317. package/lib/typescript/commonjs/ui/stores/accountStore.d.ts +0 -27
  318. package/lib/typescript/commonjs/ui/stores/accountStore.d.ts.map +0 -1
  319. package/lib/typescript/module/ui/hooks/useSwitchableAccounts.d.ts +0 -23
  320. package/lib/typescript/module/ui/hooks/useSwitchableAccounts.d.ts.map +0 -1
  321. package/lib/typescript/module/ui/stores/accountStore.d.ts +0 -27
  322. package/lib/typescript/module/ui/stores/accountStore.d.ts.map +0 -1
  323. package/src/ui/hooks/useSwitchableAccounts.ts +0 -75
  324. package/src/ui/stores/accountStore.ts +0 -264
@@ -0,0 +1,43 @@
1
+ import type { DeviceDirectory } from '@oxyhq/contracts';
2
+ import type { DeviceContext, User } from '@oxyhq/core';
3
+ import type { OxyRuntime } from './createOxyRuntime.js';
4
+ import type { OxyRuntimeStatus } from './types.js';
5
+ export declare const OxyRuntimeHandleProvider: import("react").Provider<OxyRuntime | null>;
6
+ export declare class OxyRuntimeMissingError extends Error {
7
+ readonly code = "oxy_runtime_missing";
8
+ constructor();
9
+ }
10
+ /** The runtime this provider owns. THROWS when no `<OxyProvider>` is mounted. */
11
+ export declare function useOxyRuntime(): OxyRuntime;
12
+ export interface ActiveAccount {
13
+ /**
14
+ * The human whose authentication backs the session — the audit actor. Equal
15
+ * to {@link ActiveAccount.account} unless a delegated context is active.
16
+ */
17
+ principal: User | null;
18
+ /** The account the session acts AS — what a profile header renders. */
19
+ account: User | null;
20
+ /** The resolved `principal acting as account` pair, when a directory is held. */
21
+ context: DeviceContext | null;
22
+ /** Whether the actor and the subject are different accounts. */
23
+ isDelegated: boolean;
24
+ status: OxyRuntimeStatus;
25
+ }
26
+ /**
27
+ * Who this app is running as, with the actor and the subject kept apart.
28
+ *
29
+ * Unlike `useOxy()`, this re-renders only when one of those five facts moves —
30
+ * a locale change, a dialog opening or a session-list refresh does not reach it.
31
+ */
32
+ export declare function useActiveAccount(): ActiveAccount;
33
+ /**
34
+ * The device directory — every principal on this device and the contexts each
35
+ * may act as (ADR 0002).
36
+ *
37
+ * `null` until something calls `runtime.refreshDirectory()`. A client that
38
+ * never asks for one never pays for the round trip.
39
+ */
40
+ export declare function useDeviceDirectory(): DeviceDirectory | null;
41
+ /** The whole runtime snapshot. Prefer a narrower hook where one exists. */
42
+ export declare function useOxySnapshot(): ReturnType<OxyRuntime['getSnapshot']>;
43
+ //# sourceMappingURL=runtimeContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimeContext.d.ts","sourceRoot":"","sources":["../../../../../src/ui/runtime/runtimeContext.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAS,CAAC;AAgBhD,eAAO,MAAM,wBAAwB,6CAAmC,CAAC;AAKzE,qBAAa,sBAAuB,SAAQ,KAAK;IAC/C,QAAQ,CAAC,IAAI,yBAAyB;;CAMvC;AAED,iFAAiF;AACjF,wBAAgB,aAAa,IAAI,UAAU,CAM1C;AAED,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IACvB,uEAAuE;IACvE,OAAO,EAAE,IAAI,GAAG,IAAI,CAAC;IACrB,iFAAiF;IACjF,OAAO,EAAE,aAAa,GAAG,IAAI,CAAC;IAC9B,gEAAgE;IAChE,WAAW,EAAE,OAAO,CAAC;IACrB,MAAM,EAAE,gBAAgB,CAAC;CAC1B;AA2BD;;;;;GAKG;AACH,wBAAgB,gBAAgB,IAAI,aAAa,CAEhD;AAKD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,IAAI,eAAe,GAAG,IAAI,CAE3D;AAED,2EAA2E;AAC3E,wBAAgB,cAAc,IAAI,UAAU,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC,CAEtE"}
@@ -0,0 +1,89 @@
1
+ import type { DeviceDirectory, DeviceSessionState } from '@oxyhq/contracts';
2
+ import type { ClientSession, DeviceContext, User } from '@oxyhq/core';
3
+ /**
4
+ * The runtime's coarse verdict about this device's session.
5
+ *
6
+ * `'booting'` is NOT "signed out but we are still looking": it is the honest
7
+ * "undetermined" that every readiness gate in the SDK exists to express, and it
8
+ * ends exactly once at the first cold-boot resolution. `'error'` is reserved for
9
+ * a resolved boot that produced no account AND recorded a failure — a failed
10
+ * sign-in against a signed-out device is `'signed_out'` with an `error`, because
11
+ * the device really is signed out.
12
+ */
13
+ export type OxyRuntimeStatus = 'booting' | 'authenticated' | 'signed_out' | 'error';
14
+ /**
15
+ * Whether a bearer usable for private calls is planted right now.
16
+ *
17
+ * `'refreshing'` covers both halves of the gap the SDK already tracked with two
18
+ * separate booleans: a bearer that is present but whose readiness gate is shut
19
+ * (a commit in flight), and an authenticated account whose bearer has been
20
+ * invalidated and is being re-minted. Both mean the same thing to a caller —
21
+ * wait, do not treat this as signed out.
22
+ */
23
+ export type OxyTokenStatus = 'missing' | 'refreshing' | 'ready' | 'error';
24
+ export interface OxyRuntimeError {
25
+ message: string;
26
+ code: string;
27
+ }
28
+ /**
29
+ * The ONE observable state of an `OxyRuntime` (ADR 0004).
30
+ *
31
+ * Frozen and referentially stable: a new object is published only when
32
+ * something actually changed, so `useSyncExternalStore` can compare by identity
33
+ * and a selector over an unchanged field never re-renders.
34
+ *
35
+ * Every field is either a fact the runtime owns or a pure derivation of one.
36
+ * There is no second writable store: `sessions`, `activeSessionId`, `status`
37
+ * and `tokenStatus` are computed by the one snapshot builder, so two of them can
38
+ * never disagree about the same device.
39
+ */
40
+ export interface OxyRuntimeSnapshot {
41
+ status: OxyRuntimeStatus;
42
+ /**
43
+ * The device DIRECTORY (ADR 0002) — principals and the contexts each may act
44
+ * as. `null` until something asks for one; the flat lane never pays for it.
45
+ */
46
+ device: DeviceDirectory | null;
47
+ /**
48
+ * The flat, server-authoritative device state. Kept beside {@link device}
49
+ * because it is what the compatibility projections below are derived from,
50
+ * and because the two describe the same device at the same `revision`.
51
+ */
52
+ deviceState: DeviceSessionState | null;
53
+ /** The active `principal acting as account` pair, when a directory is held. */
54
+ activeContext: DeviceContext | null;
55
+ /**
56
+ * The human whose authentication backs the session — the audit actor.
57
+ *
58
+ * Equal to {@link account} on a device with no directory and on any
59
+ * non-delegated context: the flat lane cannot tell the two apart, and saying
60
+ * so by making them the same object is more honest than leaving this `null`.
61
+ */
62
+ principal: User | null;
63
+ /** The account the session acts AS — what a profile header renders. */
64
+ account: User | null;
65
+ tokenStatus: OxyTokenStatus;
66
+ /**
67
+ * Whether the first cold boot has concluded. Monotonic: once `true` it never
68
+ * reverts, so a later transient signed-out state is never mistaken for
69
+ * "still booting".
70
+ */
71
+ authResolved: boolean;
72
+ /** A context activation / account switch is in flight. */
73
+ switching: boolean;
74
+ error: OxyRuntimeError | null;
75
+ sessions: ClientSession[];
76
+ activeSessionId: string | null;
77
+ /** A sign-in / sign-out operation is in flight. */
78
+ isLoading: boolean;
79
+ /** The local display/bookkeeping storage has resolved. */
80
+ storageReady: boolean;
81
+ /** A bearer is planted on the client instance right now. */
82
+ hasAccessToken: boolean;
83
+ /**
84
+ * The commit gate. Shut while a session commit is mid-flight so a consumer
85
+ * cannot fire a private call between the token landing and the projection.
86
+ */
87
+ tokenReady: boolean;
88
+ }
89
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/ui/runtime/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC5E,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEtE;;;;;;;;;GASG;AACH,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,eAAe,GAAG,YAAY,GAAG,OAAO,CAAC;AAEpF;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,YAAY,GAAG,OAAO,GAAG,OAAO,CAAC;AAE1E,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,gBAAgB,CAAC;IAEzB;;;OAGG;IACH,MAAM,EAAE,eAAe,GAAG,IAAI,CAAC;IAE/B;;;;OAIG;IACH,WAAW,EAAE,kBAAkB,GAAG,IAAI,CAAC;IAEvC,+EAA+E;IAC/E,aAAa,EAAE,aAAa,GAAG,IAAI,CAAC;IAEpC;;;;;;OAMG;IACH,SAAS,EAAE,IAAI,GAAG,IAAI,CAAC;IAEvB,uEAAuE;IACvE,OAAO,EAAE,IAAI,GAAG,IAAI,CAAC;IAErB,WAAW,EAAE,cAAc,CAAC;IAE5B;;;;OAIG;IACH,YAAY,EAAE,OAAO,CAAC;IAEtB,0DAA0D;IAC1D,SAAS,EAAE,OAAO,CAAC;IAEnB,KAAK,EAAE,eAAe,GAAG,IAAI,CAAC;IAM9B,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAE/B,mDAAmD;IACnD,SAAS,EAAE,OAAO,CAAC;IAEnB,0DAA0D;IAC1D,YAAY,EAAE,OAAO,CAAC;IAEtB,4DAA4D;IAC5D,cAAc,EAAE,OAAO,CAAC;IAExB;;;OAGG;IACH,UAAU,EAAE,OAAO,CAAC;CACrB"}
@@ -0,0 +1,23 @@
1
+ import type { OxyRuntime } from './createOxyRuntime.js';
2
+ import type { OxyRuntimeSnapshot } from './types.js';
3
+ /**
4
+ * Subscribe to the whole runtime snapshot.
5
+ *
6
+ * The runtime publishes a frozen object only when a fact actually changed, so
7
+ * identity comparison is exact: a locale change, a dialog opening or an
8
+ * unrelated query settling does not wake anything subscribed here.
9
+ */
10
+ export declare function useRuntimeSnapshot(runtime: OxyRuntime): OxyRuntimeSnapshot;
11
+ /**
12
+ * Subscribe to one derived value of the runtime snapshot.
13
+ *
14
+ * The selection is cached against the snapshot it was computed from, which is
15
+ * what makes a selector returning a fresh object (`{user, isAuthenticated}`)
16
+ * safe here: `useSyncExternalStore` calls `getSnapshot` several times per
17
+ * commit and would otherwise see a new object every call and loop.
18
+ *
19
+ * `selector` must be stable — hoist it to module scope or wrap it in
20
+ * `useCallback`. An inline arrow re-subscribes on every render.
21
+ */
22
+ export declare function useRuntimeSelector<T>(runtime: OxyRuntime, selector: (snapshot: OxyRuntimeSnapshot) => T, isEqual?: (a: T, b: T) => boolean): T;
23
+ //# sourceMappingURL=useRuntimeSnapshot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useRuntimeSnapshot.d.ts","sourceRoot":"","sources":["../../../../../src/ui/runtime/useRuntimeSnapshot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAoB,CAAC;AACrD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAS,CAAC;AAElD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,UAAU,GAAG,kBAAkB,CAE1E;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,OAAO,EAAE,UAAU,EACnB,QAAQ,EAAE,CAAC,QAAQ,EAAE,kBAAkB,KAAK,CAAC,EAC7C,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,GAChC,CAAC,CAqBH"}
@@ -22,7 +22,6 @@ export declare const useStorage: () => {
22
22
  };
23
23
  export declare const ProfileScreen: () => null;
24
24
  export declare const useAuthStore: () => {};
25
- export declare const useAccountStore: () => {};
26
25
  export declare const toast: (() => void) & {
27
26
  success: () => void;
28
27
  error: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../../src/ui/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,eAAO,MAAM,WAAW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K;;;;;;;CAUjB,CAAC;AAGF,OAAO,EACH,eAAe,EACf,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,GACtB,MAAM,0BAAuB,CAAC;AAC/B,YAAY,EAAE,sBAAsB,EAAE,MAAM,0BAAuB,CAAC"}
@@ -1,25 +1,76 @@
1
1
  /**
2
2
  * Platform `AuthStateStore` for `@oxyhq/services`.
3
3
  *
4
- * The zero-cookie device model persists the durable device credential
5
- * (`deviceId` + `deviceSecret`) per origin (web) / per device (native), and the
6
- * SDK re-mints the access token from that credential on cold boot. `@oxyhq/core`
7
- * owns the store shape + logic (`createWebAuthStateStore` /
8
- * `createNativeAuthStateStore`); this module only selects the platform storage
9
- * seam:
4
+ * The device model persists the durable device credential (`deviceId` +
5
+ * `deviceSecret`) per origin (web) / per device (native), and the SDK re-mints
6
+ * the access token from that credential on cold boot. `@oxyhq/core` owns the
7
+ * store shape + logic (`createWebAuthStateStore` / `createNativeAuthStateStore` /
8
+ * `createMemoryAuthStateStore`); this module only selects the seam:
10
9
  *
10
+ * - `storage: 'ephemeral'` → `createMemoryAuthStateStore()`, on EVERY platform.
11
11
  * - web → `createWebAuthStateStore()` (localStorage, in-memory fallback).
12
12
  * - native → `createNativeAuthStateStore(secureKV)` for the SESSION blob over
13
13
  * the shared `createNativeSecureKeyValueStorage()` adapter
14
- * (`expo-secure-store`, AsyncStorage fallback).
14
+ * (`expo-secure-store`, AsyncStorage fallback), WRAPPED so every credential
15
+ * it persists is also mirrored into the device-wide shared slot.
16
+ *
17
+ * The native wrapper is how several official apps end up on ONE `DeviceSession`
18
+ * (and therefore one active context): whichever app proves a credential publishes
19
+ * it, and a later-installed sibling adopts it during cold boot instead of asking
20
+ * for the Commons identity key. The mirror is additive — it can neither change
21
+ * nor fail the app's own durable write.
15
22
  */
16
- import { type AuthStateStore } from '@oxyhq/core';
23
+ import { type AuthStateStore, type SessionMode } from '@oxyhq/core';
24
+ export interface PlatformAuthStateStoreOptions {
25
+ /**
26
+ * Who owns the session this provider resolves. Only `'account'` mirrors into
27
+ * the device-wide shared slot.
28
+ *
29
+ * `'identity'` (the vault) is deliberately excluded, which keeps its storage
30
+ * behaviour byte-for-byte what it is today. The vault's credential is a
31
+ * perfectly valid device credential, so publishing it would arguably be
32
+ * correct — but it would also let every ordinary app on the device join the
33
+ * vault's device session as a side effect of the vault persisting a token, and
34
+ * "a background write changes which session five other apps boot into" is not
35
+ * a decision a storage seam gets to make.
36
+ */
37
+ sessionMode?: SessionMode;
38
+ /**
39
+ * Whether this origin/app may persist a durable device credential AT ALL.
40
+ *
41
+ * `'ephemeral'` stores nothing durable and mirrors nothing: the session lives
42
+ * in memory for the lifetime of the page and is gone on reload. Its one caller
43
+ * is `auth.oxy.so` with the browser hub enabled (issue #937 Phase 5, ADR 0003),
44
+ * where the durable credential for the browser profile is the server-side
45
+ * DeviceSession behind the `__Host-oxy-device` handle.
46
+ *
47
+ * See `OxyProviderProps.deviceCredentialStorage` for why the answer to "let the
48
+ * hub be authoritative" is to stop persisting the other credential rather than
49
+ * to consult it second.
50
+ */
51
+ storage?: 'persistent' | 'ephemeral';
52
+ }
17
53
  /**
18
54
  * Build the platform {@link AuthStateStore} for this runtime.
19
55
  *
20
56
  * Native persists the SESSION blob (`deviceId` + `deviceSecret` + cached access
21
57
  * token) per-app in SecureStore; the SDK re-mints the access token from the
22
58
  * device credential on the next cold boot.
59
+ *
60
+ * ## The ephemeral check is FIRST, and the order is load-bearing
61
+ *
62
+ * It short-circuits above the `isReactNative()` branch so an ephemeral caller can
63
+ * never reach the native path — and therefore can never reach the shared-slot
64
+ * mirroring wrapper. Checked after that branch instead, an origin that has
65
+ * declined to persist a credential would publish one into the device-wide slot
66
+ * every sibling app adopts on cold boot: it would keep nothing itself while
67
+ * deciding which session five other apps boot into.
68
+ *
69
+ * That is unreachable today because the only ephemeral caller is a web origin, so
70
+ * `isReactNative()` is false there anyway. Unreachable today is exactly the kind
71
+ * of guarantee that stops holding when someone adds the second caller, so it is
72
+ * structural here rather than incidental, and
73
+ * `__tests__/session/authStoreEphemeral.test.ts` holds the ordering directly.
23
74
  */
24
- export declare function createPlatformAuthStateStore(): AuthStateStore;
75
+ export declare function createPlatformAuthStateStore(options?: PlatformAuthStateStoreOptions): AuthStateStore;
25
76
  //# sourceMappingURL=authStore.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"authStore.d.ts","sourceRoot":"","sources":["../../../../../src/ui/session/authStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,aAAa,CAAC;AAIrB;;;;;;GAMG;AACH,wBAAgB,4BAA4B,IAAI,cAAc,CAM7D"}
1
+ {"version":3,"file":"authStore.d.ts","sourceRoot":"","sources":["../../../../../src/ui/session/authStore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAKL,KAAK,cAAc,EACnB,KAAK,WAAW,EACjB,MAAM,aAAa,CAAC;AAKrB,MAAM,WAAW,6BAA6B;IAC5C;;;;;;;;;;;OAWG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,EAAE,YAAY,GAAG,WAAW,CAAC;CACtC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,GAAE,6BAAkC,GAC1C,cAAc,CAiBhB"}
@@ -0,0 +1,32 @@
1
+ import { type SharedDeviceCredentialStore } from '@oxyhq/core';
2
+ /**
3
+ * The iOS Keychain Access Group every official Oxy app declares in its
4
+ * entitlements. Shared with the identity slots — the group is the app-group
5
+ * boundary, not the secret's identity.
6
+ */
7
+ export declare const IOS_KEYCHAIN_ACCESS_GROUP = "group.so.oxy.shared";
8
+ /**
9
+ * The iOS `keychainService` for the DEVICE SESSION credential. Deliberately
10
+ * distinct from every identity and recovery service; do not reuse one of those
11
+ * here, and do not drop it (an item written with no service shares the legacy
12
+ * identity slot's namespace inside the group).
13
+ */
14
+ export declare const IOS_DEVICE_SESSION_KEYCHAIN_SERVICE = "oxy_device_session";
15
+ /** The single key holding the JSON-encoded `{deviceId, deviceSecret}` pair. */
16
+ export declare const SHARED_DEVICE_SESSION_STORAGE_KEY = "oxy_shared_device_session_v1";
17
+ /**
18
+ * The shared DeviceSession credential slot for this runtime, or `null` when
19
+ * there is none.
20
+ *
21
+ * The branch is on the PLATFORM, not on which module happens to load, because
22
+ * `expo-secure-store` loads perfectly well on Android — it would just quietly
23
+ * ignore `keychainAccessGroup` and read a package-private item, which looks
24
+ * exactly like an empty shared slot. This is the same iOS-vs-Android split
25
+ * `KeyManager` makes for the shared identity, for the same reason.
26
+ *
27
+ * Any other native platform gets the broker, which answers `unsupported` when
28
+ * the module is not linked — so the lane is simply off, which is the safe
29
+ * direction.
30
+ */
31
+ export declare function createPlatformSharedDeviceCredentialStore(): SharedDeviceCredentialStore | null;
32
+ //# sourceMappingURL=sharedDeviceCredentialStore.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sharedDeviceCredentialStore.d.ts","sourceRoot":"","sources":["../../../../../src/ui/session/sharedDeviceCredentialStore.ts"],"names":[],"mappings":"AAyCA,OAAO,EAIL,KAAK,2BAA2B,EACjC,MAAM,aAAa,CAAC;AAErB;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,wBAAwB,CAAC;AAE/D;;;;;GAKG;AACH,eAAO,MAAM,mCAAmC,uBAAuB,CAAC;AAExE,+EAA+E;AAC/E,eAAO,MAAM,iCAAiC,iCAAiC,CAAC;AA0OhF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,yCAAyC,IAAI,2BAA2B,GAAG,IAAI,CAK9F"}
@@ -1,17 +1,61 @@
1
1
  import type { User } from '@oxyhq/core';
2
+ import type { OxyRuntime } from '../runtime/index.js';
3
+ /**
4
+ * The signed-in user, as a zustand-shaped read/write surface.
5
+ *
6
+ * It used to BE a zustand store, and that made it a second owner of the
7
+ * session: the provider wrote `user`/`isAuthenticated` here, `SessionClient`
8
+ * wrote the same facts into its device state, and nothing reconciled them —
9
+ * when they disagreed, which one was right was not answerable. It is now a
10
+ * projection of the ONE `OxyRuntime` (ADR 0004): reads come off the runtime
11
+ * snapshot and writes go into the runtime, so there is nothing left to drift.
12
+ *
13
+ * The zustand SHAPE is kept deliberately — `useAuthStore(selector)`,
14
+ * `.getState()`, `.setState()`, `.subscribe()` — because a dozen call sites
15
+ * across this package and the Commons app read the user out of band, from
16
+ * mutation success handlers and cache helpers that are not inside a render.
17
+ * Rewriting them is Phase 8's cut, not this one's.
18
+ *
19
+ * `fetchUser` and `lastUserFetch` are GONE rather than projected: they were a
20
+ * five-minute profile cache with zero readers anywhere in the monorepo, and the
21
+ * Query cache has owned that job since long before this change.
22
+ */
2
23
  export interface AuthState {
3
24
  user: User | null;
4
25
  isAuthenticated: boolean;
5
26
  isLoading: boolean;
6
27
  error: string | null;
7
- lastUserFetch: number | null;
8
28
  loginSuccess: (user: User) => void;
9
29
  loginFailure: (error: string) => void;
10
30
  logout: () => void;
11
- fetchUser: (oxyServices: {
12
- getCurrentUser: () => Promise<User>;
13
- }, forceRefresh?: boolean) => Promise<void>;
31
+ /** Replace the signed-in profile after a write (a rename, a new avatar). */
14
32
  setUser: (user: User) => void;
15
33
  }
16
- export declare const useAuthStore: import("zustand").UseBoundStore<import("zustand").StoreApi<AuthState>>;
34
+ /** The subset of `AuthState` a caller may push back in through `setState`. */
35
+ export type AuthStatePatch = Partial<Pick<AuthState, 'user' | 'isLoading' | 'error'>>;
36
+ /**
37
+ * Point this surface at the provider's runtime. Called once by
38
+ * `OxyRuntimeProvider`; the returned function detaches it again on unmount.
39
+ *
40
+ * With nothing bound, reads answer signed-out and writes are dropped. That is
41
+ * the honest answer for the two places it happens — the SSR shim, and a unit
42
+ * test poking the store with no provider mounted — and it is why binding is an
43
+ * explicit call rather than a lazily-created default runtime, which is exactly
44
+ * the fabricated-forever-loading runtime ADR 0004 deleted.
45
+ */
46
+ export declare function bindAuthStoreToRuntime(runtime: OxyRuntime): () => void;
47
+ declare function useAuthStoreHook<T>(selector: (state: AuthState) => T): T;
48
+ /**
49
+ * Read the signed-in user. Zustand-shaped, projected from the runtime.
50
+ *
51
+ * A selector that builds an object must be wrapped in `useShallow` (as every
52
+ * call site here already does) — otherwise a structurally-equal result reads as
53
+ * a change on every publish.
54
+ */
55
+ export declare const useAuthStore: typeof useAuthStoreHook & {
56
+ getState: () => AuthState;
57
+ setState: (patch: AuthStatePatch) => void;
58
+ subscribe: (listener: () => void) => (() => void);
59
+ };
60
+ export {};
17
61
  //# sourceMappingURL=authStore.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"authStore.d.ts","sourceRoot":"","sources":["../../../../../src/ui/stores/authStore.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAIxC,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,eAAe,EAAE,OAAO,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAE7B,YAAY,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACnC,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,SAAS,EAAE,CAAC,WAAW,EAAE;QAAE,cAAc,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;KAAE,EAAE,YAAY,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3G,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;CAC/B;AAED,eAAO,MAAM,YAAY,wEA0CtB,CAAC"}
1
+ {"version":3,"file":"authStore.d.ts","sourceRoot":"","sources":["../../../../../src/ui/stores/authStore.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAY,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,IAAI,GAAG,IAAI,CAAC;IAClB,eAAe,EAAE,OAAO,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IAErB,YAAY,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IACnC,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,4EAA4E;IAC5E,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;CAC/B;AAED,8EAA8E;AAC9E,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW,GAAG,OAAO,CAAC,CAAC,CAAC;AAuEtF;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,IAAI,CActE;AA6BD,iBAAS,gBAAgB,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,CAAC,GAAG,CAAC,CAejE;AAED;;;;;;GAMG;AACH,eAAO,MAAM,YAAY;oBAnDJ,SAAS;sBAEL,cAAc,KAAG,IAAI;0BAkBjB,MAAM,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC;CAmCpD,CAAC"}
@@ -123,5 +123,31 @@ export interface OxyProviderProps {
123
123
  * @default false
124
124
  */
125
125
  backgroundSession?: boolean;
126
+ /**
127
+ * Whether this origin/app may persist the durable device credential
128
+ * (`deviceId` + `deviceSecret`) at all.
129
+ *
130
+ * `'persistent'` (the default, and every app's behaviour) stores it — web
131
+ * localStorage per origin, SecureStore per app on native — so the SDK can
132
+ * re-mint an access token on the next cold boot.
133
+ *
134
+ * `'ephemeral'` stores NOTHING durable: the session lives in memory for the
135
+ * lifetime of the page and is gone on reload. It exists for ONE caller,
136
+ * `auth.oxy.so` with the browser hub enabled (issue #937 Phase 5, ADR 0003),
137
+ * where the durable credential for the browser profile is the server-side
138
+ * DeviceSession behind the `__Host-oxy-device` handle. Two durable
139
+ * credentials for one origin is the dual authority that phase exists to
140
+ * remove — revoking the hub while a localStorage secret still mints would
141
+ * make a sign-out look like it worked — so the way to let the hub be
142
+ * authoritative is to stop persisting the other one, not to consult it
143
+ * second.
144
+ *
145
+ * Do NOT reach for this to make an app "more private". A relying-party
146
+ * origin set to `'ephemeral'` simply signs the user out on every reload,
147
+ * because nothing else on that origin remembers the device.
148
+ *
149
+ * @default 'persistent'
150
+ */
151
+ deviceCredentialStorage?: 'persistent' | 'ephemeral';
126
152
  }
127
153
  //# sourceMappingURL=navigation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../../../src/ui/types/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAiB,WAAW,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAgB,CAAC;AAElD,MAAM,WAAW,cAAc;IAC3B,SAAS,EAAE,MAAM,OAAO,CAAC;IACzB,MAAM,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAE5B,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,M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;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;;;;;;;;;;;;;;;OAiBG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;IACtC;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,uBAAuB,CAAC,EAAE,YAAY,GAAG,WAAW,CAAC;CACxD"}
@@ -2,16 +2,8 @@ import type { OxyServices, User } from '@oxyhq/core';
2
2
  import type { UserProfileUpdate } from '@oxyhq/contracts';
3
3
  import type { QueryClient } from '@tanstack/react-query';
4
4
  /**
5
- * Refreshes avatar in accountStore with cache-busted URL to force image reload.
6
- *
7
- * @param sessionId - The session ID for the account to update
8
- * @param avatarFileId - The new avatar file ID
9
- * @param oxyServices - OxyServices instance to generate download URL
10
- */
11
- export declare function refreshAvatarInStore(sessionId: string, avatarFileId: string, oxyServices: OxyServices): void;
12
- /**
13
- * Updates user profile with avatar and handles all side effects (query invalidation, accountStore update).
14
- * This function can be used from within OxyContext provider without requiring useOxy hook.
5
+ * Updates user profile with avatar and handles all side effects (cache writes,
6
+ * query invalidation). Usable from inside the provider without `useOxy`.
15
7
  *
16
8
  * @param updates - Profile updates including avatar
17
9
  * @param oxyServices - OxyServices instance
@@ -1 +1 @@
1
- {"version":3,"file":"avatarUtils.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/avatarUtils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAG1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAOzD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,WAAW,GACvB,IAAI,CAON;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,iBAAiB,EAC1B,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,MAAM,GAAG,IAAI,EAC9B,WAAW,EAAE,WAAW,EACxB,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAChC,OAAO,CAAC,IAAI,CAAC,CAyCf"}
1
+ {"version":3,"file":"avatarUtils.d.ts","sourceRoot":"","sources":["../../../../../src/ui/utils/avatarUtils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAE1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAOzD;;;;;;;;;;GAUG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,iBAAiB,EAC1B,WAAW,EAAE,WAAW,EACxB,eAAe,EAAE,MAAM,GAAG,IAAI,EAC9B,WAAW,EAAE,WAAW,EACxB,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAChC,OAAO,CAAC,IAAI,CAAC,CA2Bf"}
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "@oxyhq/services",
3
- "version": "28.0.0",
3
+ "version": "29.0.0",
4
4
  "description": "OxyHQ Expo/React Native SDK — UI components, screens, and native features",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
7
7
  "types": "lib/typescript/commonjs/index.d.ts",
8
8
  "react-native": "src/index.ts",
9
9
  "source": "src/index.ts",
10
- "sideEffects": false,
11
10
  "publishConfig": {
12
11
  "access": "public"
13
12
  },
@@ -139,7 +138,7 @@
139
138
  }
140
139
  },
141
140
  "dependencies": {
142
- "@oxyhq/contracts": "0.25.0",
141
+ "@oxyhq/contracts": "0.26.0",
143
142
  "@simplewebauthn/browser": "^13.3.0",
144
143
  "color": "^4.2.3"
145
144
  },
@@ -148,10 +147,10 @@
148
147
  "@commitlint/cli": "^21.2.1",
149
148
  "@commitlint/config-conventional": "^21.2.0",
150
149
  "@expo/vector-icons": "^15.0.3",
151
- "@oxyhq/core": "20.0.0",
150
+ "@oxyhq/core": "21.0.0",
152
151
  "@react-native-async-storage/async-storage": "^2.0.0",
153
152
  "@react-native-community/netinfo": "^11.4.1",
154
- "@react-native/babel-preset": "^0.86.0",
153
+ "@react-native/babel-preset": "^0.86.2",
155
154
  "@release-it/conventional-changelog": "^10.0.6",
156
155
  "@tanstack/query-async-storage-persister": "^5.101",
157
156
  "@tanstack/query-sync-storage-persister": "^5.101",
@@ -184,14 +183,14 @@
184
183
  "react-native-svg": "15.15.5",
185
184
  "release-it": "^19.0.6",
186
185
  "socket.io-client": "^4.8.1",
187
- "ts-jest": "^29.4.0",
186
+ "ts-jest": "^29.4.12",
188
187
  "typescript": "^5.9.2",
189
188
  "zustand": "^5.0.14"
190
189
  },
191
190
  "peerDependencies": {
192
191
  "@expo/vector-icons": "^15.0.3",
193
192
  "@oxyhq/bloom": ">=0.59.0",
194
- "@oxyhq/core": "^20.0.0",
193
+ "@oxyhq/core": "^21.0.0",
195
194
  "@react-native-async-storage/async-storage": "^2.0.0",
196
195
  "@react-native-community/netinfo": ">=11.4.1",
197
196
  "@tanstack/query-async-storage-persister": "^5.101",
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Config plugin: withSharedDeviceSessionProvider (UID-member hub apps).
3
+ *
4
+ * The shared DeviceSession credential is how several official Oxy apps end up on
5
+ * ONE `DeviceSession` — and therefore one globally active account context —
6
+ * WITHOUT any of them reading Commons's private identity key. This plugin wires
7
+ * the Android side of `@oxyhq/services`:
8
+ *
9
+ * - Defines a `signature`-level permission
10
+ * `so.oxy.shared.permission.READ_DEVICE_SESSION`. `signature` means only apps
11
+ * signed with the SAME certificate (the shared Oxy release keystore) can hold
12
+ * it — the trust boundary is the signing key, not the deprecated `sharedUserId`.
13
+ * - Requests that same permission so this app can also read cross-authority.
14
+ * - Declares `OxyDeviceSessionProvider` at authority
15
+ * `${applicationId}.devicesession` (AGP substitutes `${applicationId}` at
16
+ * build), guarded by that permission. The provider is READ-only across the
17
+ * process boundary: a sibling may join the device session, never overwrite it.
18
+ * - Adds `<queries>` entries so Android 11+ package-visibility filtering never
19
+ * hides the sibling providers from the resolver.
20
+ *
21
+ * WHICH APPS USE THIS PLUGIN: exactly the apps listed in `PROVIDER_AUTHORITIES`
22
+ * below, which must be apps inside the `so.oxy.shared` UID. UID members share one
23
+ * data directory, so they all serve the SAME file and the sweep in
24
+ * `OxyDeviceSessionModule` is deterministic whichever one answers. An app that is
25
+ * same-signature but outside that UID must use `withSharedDeviceSessionReader`
26
+ * instead — hosting from there would publish a second, independent copy of "the
27
+ * shared credential" and make the winner depend on list order.
28
+ *
29
+ * Keep this list identical to `PROVIDER_AUTHORITIES` in
30
+ * `android/src/main/java/so/oxy/devicesession/OxyDeviceSessionModule.kt`.
31
+ *
32
+ * This is deliberately a SEPARATE permission and a SEPARATE provider from
33
+ * `withSharedIdentityProvider`. Two secrets with different blast radii: the
34
+ * identity key is self-custody and irreplaceable, the device credential is
35
+ * server-revocable and re-publishable. An app that only needs a session gets only
36
+ * the second one.
37
+ */
38
+ const { withAndroidManifest } = require('@expo/config-plugins');
39
+
40
+ const READ_DEVICE_SESSION_PERMISSION = 'so.oxy.shared.permission.READ_DEVICE_SESSION';
41
+ const PROVIDER_CLASS = 'so.oxy.devicesession.OxyDeviceSessionProvider';
42
+ const PROVIDER_AUTHORITIES = [
43
+ 'so.oxy.accounts.devicesession',
44
+ 'so.oxy.accounts.dev.devicesession',
45
+ 'so.oxy.commons.devicesession',
46
+ 'so.oxy.commons.dev.devicesession',
47
+ ];
48
+
49
+ module.exports = function withSharedDeviceSessionProvider(config) {
50
+ return withAndroidManifest(config, (modConfig) => {
51
+ const manifest = modConfig.modResults.manifest;
52
+
53
+ // 1. Define the signature-level permission.
54
+ manifest['permission'] = manifest['permission'] ?? [];
55
+ if (!manifest['permission'].some((p) => p.$['android:name'] === READ_DEVICE_SESSION_PERMISSION)) {
56
+ manifest['permission'].push({
57
+ $: {
58
+ 'android:name': READ_DEVICE_SESSION_PERMISSION,
59
+ 'android:protectionLevel': 'signature',
60
+ },
61
+ });
62
+ }
63
+
64
+ // 2. Request it (a hub app reads its siblings too — prod ⇆ dev variant).
65
+ manifest['uses-permission'] = manifest['uses-permission'] ?? [];
66
+ if (!manifest['uses-permission'].some((p) => p.$['android:name'] === READ_DEVICE_SESSION_PERMISSION)) {
67
+ manifest['uses-permission'].push({ $: { 'android:name': READ_DEVICE_SESSION_PERMISSION } });
68
+ }
69
+
70
+ // 3. Make the sibling provider authorities visible under package filtering.
71
+ manifest['queries'] = manifest['queries'] ?? [];
72
+ if (manifest['queries'].length === 0) {
73
+ manifest['queries'].push({});
74
+ }
75
+ const queries = manifest['queries'][0];
76
+ queries.provider = queries.provider ?? [];
77
+ for (const authority of PROVIDER_AUTHORITIES) {
78
+ if (!queries.provider.some((p) => p.$['android:authorities'] === authority)) {
79
+ queries.provider.push({ $: { 'android:authorities': authority } });
80
+ }
81
+ }
82
+
83
+ // 4. Host the provider.
84
+ const app = manifest.application?.[0];
85
+ if (!app) {
86
+ throw new Error('withSharedDeviceSessionProvider: AndroidManifest has no <application>');
87
+ }
88
+ app.provider = app.provider ?? [];
89
+ if (!app.provider.some((p) => p.$['android:name'] === PROVIDER_CLASS)) {
90
+ app.provider.push({
91
+ $: {
92
+ 'android:name': PROVIDER_CLASS,
93
+ 'android:authorities': '${applicationId}.devicesession',
94
+ 'android:exported': 'true',
95
+ 'android:permission': READ_DEVICE_SESSION_PERMISSION,
96
+ },
97
+ });
98
+ }
99
+
100
+ return modConfig;
101
+ });
102
+ };