@oxyhq/services 22.12.5 → 22.13.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 (446) hide show
  1. package/README.md +16 -46
  2. package/lib/commonjs/index.js +18 -12
  3. package/lib/commonjs/index.js.map +1 -1
  4. package/lib/commonjs/ui/boot/runProviderColdBoot.js +51 -9
  5. package/lib/commonjs/ui/boot/runProviderColdBoot.js.map +1 -1
  6. package/lib/commonjs/ui/client.js +0 -13
  7. package/lib/commonjs/ui/client.js.map +1 -1
  8. package/lib/commonjs/ui/components/OxyAccountDialogScreen.js +27 -4
  9. package/lib/commonjs/ui/components/OxyAccountDialogScreen.js.map +1 -1
  10. package/lib/commonjs/ui/components/OxyAuthChooser.js +72 -1123
  11. package/lib/commonjs/ui/components/OxyAuthChooser.js.map +1 -1
  12. package/lib/commonjs/ui/components/OxyConsentScreen.js +50 -12
  13. package/lib/commonjs/ui/components/OxyConsentScreen.js.map +1 -1
  14. package/lib/commonjs/ui/components/OxyProvider.js +4 -4
  15. package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
  16. package/lib/commonjs/ui/components/OxySignInButton.js +74 -40
  17. package/lib/commonjs/ui/components/OxySignInButton.js.map +1 -1
  18. package/lib/commonjs/ui/components/authChooser/AccountsMenuView.js +527 -0
  19. package/lib/commonjs/ui/components/authChooser/AccountsMenuView.js.map +1 -0
  20. package/lib/commonjs/ui/components/authChooser/SignInEntryView.js +90 -0
  21. package/lib/commonjs/ui/components/authChooser/SignInEntryView.js.map +1 -0
  22. package/lib/commonjs/ui/components/authChooser/SignInRequestView.js +144 -0
  23. package/lib/commonjs/ui/components/authChooser/SignInRequestView.js.map +1 -0
  24. package/lib/commonjs/ui/components/authChooser/SignUpView.js +188 -0
  25. package/lib/commonjs/ui/components/authChooser/SignUpView.js.map +1 -0
  26. package/lib/commonjs/ui/components/authChooser/TroubleDisclosure.js +63 -0
  27. package/lib/commonjs/ui/components/authChooser/TroubleDisclosure.js.map +1 -0
  28. package/lib/commonjs/ui/components/authChooser/primitives.js +169 -0
  29. package/lib/commonjs/ui/components/authChooser/primitives.js.map +1 -0
  30. package/lib/commonjs/ui/components/authChooser/requestSurfaces.js +149 -0
  31. package/lib/commonjs/ui/components/authChooser/requestSurfaces.js.map +1 -0
  32. package/lib/commonjs/ui/components/authChooser/signInProgress.js +54 -0
  33. package/lib/commonjs/ui/components/authChooser/signInProgress.js.map +1 -0
  34. package/lib/commonjs/ui/components/{oxyAuthChooserStyles.js → authChooser/styles.js} +19 -1
  35. package/lib/commonjs/ui/components/authChooser/styles.js.map +1 -0
  36. package/lib/commonjs/ui/components/authChooser/types.js +59 -0
  37. package/lib/commonjs/ui/components/authChooser/types.js.map +1 -0
  38. package/lib/commonjs/ui/components/authChooser/useUsernameAvailability.js +50 -0
  39. package/lib/commonjs/ui/components/authChooser/useUsernameAvailability.js.map +1 -0
  40. package/lib/commonjs/ui/context/OxyContext.js +205 -30
  41. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  42. package/lib/commonjs/ui/context/commitSessionFlow.js +46 -0
  43. package/lib/commonjs/ui/context/commitSessionFlow.js.map +1 -1
  44. package/lib/commonjs/ui/context/hooks/useAuthOperations.js +15 -2
  45. package/lib/commonjs/ui/context/hooks/useAuthOperations.js.map +1 -1
  46. package/lib/commonjs/ui/context/useOxyAccountGraph.js +13 -5
  47. package/lib/commonjs/ui/context/useOxyAccountGraph.js.map +1 -1
  48. package/lib/commonjs/ui/hooks/useSwitchableAccounts.js +6 -1
  49. package/lib/commonjs/ui/hooks/useSwitchableAccounts.js.map +1 -1
  50. package/lib/commonjs/ui/index.js +0 -13
  51. package/lib/commonjs/ui/index.js.map +1 -1
  52. package/lib/commonjs/ui/oauth/browserAuthTransport.js +170 -0
  53. package/lib/commonjs/ui/oauth/browserAuthTransport.js.map +1 -0
  54. package/lib/commonjs/ui/oauth/completeOAuthCode.js +78 -0
  55. package/lib/commonjs/ui/oauth/completeOAuthCode.js.map +1 -0
  56. package/lib/commonjs/ui/oauth/legacyRedirectLanes.js +48 -0
  57. package/lib/commonjs/ui/oauth/legacyRedirectLanes.js.map +1 -0
  58. package/lib/commonjs/ui/oauth/oauthHandshake.js +53 -0
  59. package/lib/commonjs/ui/oauth/oauthHandshake.js.map +1 -0
  60. package/lib/commonjs/ui/oauth/oauthPopup.js +276 -0
  61. package/lib/commonjs/ui/oauth/oauthPopup.js.map +1 -0
  62. package/lib/commonjs/ui/oauth/oauthPopupMessages.js +141 -0
  63. package/lib/commonjs/ui/oauth/oauthPopupMessages.js.map +1 -0
  64. package/lib/commonjs/ui/oauth/types.js +2 -0
  65. package/lib/commonjs/ui/oauth/types.js.map +1 -0
  66. package/lib/commonjs/ui/server.js +2 -5
  67. package/lib/commonjs/ui/server.js.map +1 -1
  68. package/lib/commonjs/ui/session/authStore.js +6 -75
  69. package/lib/commonjs/ui/session/authStore.js.map +1 -1
  70. package/lib/commonjs/ui/session/createSessionClient.js +11 -3
  71. package/lib/commonjs/ui/session/createSessionClient.js.map +1 -1
  72. package/lib/commonjs/ui/session/identityBinding.js +95 -0
  73. package/lib/commonjs/ui/session/identityBinding.js.map +1 -0
  74. package/lib/commonjs/ui/session/index.js +13 -0
  75. package/lib/commonjs/ui/session/index.js.map +1 -1
  76. package/lib/commonjs/ui/session/nativeSecureStorage.js +90 -0
  77. package/lib/commonjs/ui/session/nativeSecureStorage.js.map +1 -0
  78. package/lib/commonjs/ui/session/tokenTransport.js +11 -1
  79. package/lib/commonjs/ui/session/tokenTransport.js.map +1 -1
  80. package/lib/commonjs/ui/utils/crossOriginRestore.js +3 -2
  81. package/lib/commonjs/ui/utils/crossOriginRestore.js.map +1 -1
  82. package/lib/commonjs/ui/utils/deliveryPlatform.js +58 -0
  83. package/lib/commonjs/ui/utils/deliveryPlatform.js.map +1 -0
  84. package/lib/commonjs/ui/utils/oauthReturn.js +33 -49
  85. package/lib/commonjs/ui/utils/oauthReturn.js.map +1 -1
  86. package/lib/module/index.js +9 -4
  87. package/lib/module/index.js.map +1 -1
  88. package/lib/module/ui/boot/runProviderColdBoot.js +51 -9
  89. package/lib/module/ui/boot/runProviderColdBoot.js.map +1 -1
  90. package/lib/module/ui/client.js +0 -1
  91. package/lib/module/ui/client.js.map +1 -1
  92. package/lib/module/ui/components/OxyAccountDialogScreen.js +27 -4
  93. package/lib/module/ui/components/OxyAccountDialogScreen.js.map +1 -1
  94. package/lib/module/ui/components/OxyAuthChooser.js +76 -1128
  95. package/lib/module/ui/components/OxyAuthChooser.js.map +1 -1
  96. package/lib/module/ui/components/OxyConsentScreen.js +50 -12
  97. package/lib/module/ui/components/OxyConsentScreen.js.map +1 -1
  98. package/lib/module/ui/components/OxyProvider.js +4 -4
  99. package/lib/module/ui/components/OxyProvider.js.map +1 -1
  100. package/lib/module/ui/components/OxySignInButton.js +76 -42
  101. package/lib/module/ui/components/OxySignInButton.js.map +1 -1
  102. package/lib/module/ui/components/authChooser/AccountsMenuView.js +523 -0
  103. package/lib/module/ui/components/authChooser/AccountsMenuView.js.map +1 -0
  104. package/lib/module/ui/components/authChooser/SignInEntryView.js +85 -0
  105. package/lib/module/ui/components/authChooser/SignInEntryView.js.map +1 -0
  106. package/lib/module/ui/components/authChooser/SignInRequestView.js +139 -0
  107. package/lib/module/ui/components/authChooser/SignInRequestView.js.map +1 -0
  108. package/lib/module/ui/components/authChooser/SignUpView.js +184 -0
  109. package/lib/module/ui/components/authChooser/SignUpView.js.map +1 -0
  110. package/lib/module/ui/components/authChooser/TroubleDisclosure.js +59 -0
  111. package/lib/module/ui/components/authChooser/TroubleDisclosure.js.map +1 -0
  112. package/lib/module/ui/components/authChooser/primitives.js +163 -0
  113. package/lib/module/ui/components/authChooser/primitives.js.map +1 -0
  114. package/lib/module/ui/components/authChooser/requestSurfaces.js +139 -0
  115. package/lib/module/ui/components/authChooser/requestSurfaces.js.map +1 -0
  116. package/lib/module/ui/components/authChooser/signInProgress.js +50 -0
  117. package/lib/module/ui/components/authChooser/signInProgress.js.map +1 -0
  118. package/lib/module/ui/components/{oxyAuthChooserStyles.js → authChooser/styles.js} +19 -1
  119. package/lib/module/ui/components/authChooser/styles.js.map +1 -0
  120. package/lib/module/ui/components/authChooser/types.js +55 -0
  121. package/lib/module/ui/components/authChooser/types.js.map +1 -0
  122. package/lib/module/ui/components/authChooser/useUsernameAvailability.js +46 -0
  123. package/lib/module/ui/components/authChooser/useUsernameAvailability.js.map +1 -0
  124. package/lib/module/ui/context/OxyContext.js +208 -33
  125. package/lib/module/ui/context/OxyContext.js.map +1 -1
  126. package/lib/module/ui/context/commitSessionFlow.js +45 -0
  127. package/lib/module/ui/context/commitSessionFlow.js.map +1 -1
  128. package/lib/module/ui/context/hooks/useAuthOperations.js +15 -2
  129. package/lib/module/ui/context/hooks/useAuthOperations.js.map +1 -1
  130. package/lib/module/ui/context/useOxyAccountGraph.js +13 -5
  131. package/lib/module/ui/context/useOxyAccountGraph.js.map +1 -1
  132. package/lib/module/ui/hooks/useSwitchableAccounts.js +6 -1
  133. package/lib/module/ui/hooks/useSwitchableAccounts.js.map +1 -1
  134. package/lib/module/ui/index.js +0 -1
  135. package/lib/module/ui/index.js.map +1 -1
  136. package/lib/module/ui/oauth/browserAuthTransport.js +167 -0
  137. package/lib/module/ui/oauth/browserAuthTransport.js.map +1 -0
  138. package/lib/module/ui/oauth/completeOAuthCode.js +75 -0
  139. package/lib/module/ui/oauth/completeOAuthCode.js.map +1 -0
  140. package/lib/module/ui/oauth/legacyRedirectLanes.js +44 -0
  141. package/lib/module/ui/oauth/legacyRedirectLanes.js.map +1 -0
  142. package/lib/module/ui/oauth/oauthHandshake.js +50 -0
  143. package/lib/module/ui/oauth/oauthHandshake.js.map +1 -0
  144. package/lib/module/ui/oauth/oauthPopup.js +268 -0
  145. package/lib/module/ui/oauth/oauthPopup.js.map +1 -0
  146. package/lib/module/ui/oauth/oauthPopupMessages.js +135 -0
  147. package/lib/module/ui/oauth/oauthPopupMessages.js.map +1 -0
  148. package/lib/module/ui/oauth/types.js +2 -0
  149. package/lib/module/ui/oauth/types.js.map +1 -0
  150. package/lib/module/ui/server.js +0 -2
  151. package/lib/module/ui/server.js.map +1 -1
  152. package/lib/module/ui/session/authStore.js +5 -75
  153. package/lib/module/ui/session/authStore.js.map +1 -1
  154. package/lib/module/ui/session/createSessionClient.js +11 -3
  155. package/lib/module/ui/session/createSessionClient.js.map +1 -1
  156. package/lib/module/ui/session/identityBinding.js +89 -0
  157. package/lib/module/ui/session/identityBinding.js.map +1 -0
  158. package/lib/module/ui/session/index.js +5 -2
  159. package/lib/module/ui/session/index.js.map +1 -1
  160. package/lib/module/ui/session/nativeSecureStorage.js +88 -0
  161. package/lib/module/ui/session/nativeSecureStorage.js.map +1 -0
  162. package/lib/module/ui/session/tokenTransport.js +11 -1
  163. package/lib/module/ui/session/tokenTransport.js.map +1 -1
  164. package/lib/module/ui/utils/crossOriginRestore.js +4 -3
  165. package/lib/module/ui/utils/crossOriginRestore.js.map +1 -1
  166. package/lib/module/ui/utils/deliveryPlatform.js +55 -0
  167. package/lib/module/ui/utils/deliveryPlatform.js.map +1 -0
  168. package/lib/module/ui/utils/oauthReturn.js +35 -50
  169. package/lib/module/ui/utils/oauthReturn.js.map +1 -1
  170. package/lib/typescript/commonjs/index.d.ts +4 -1
  171. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  172. package/lib/typescript/commonjs/ui/boot/runProviderColdBoot.d.ts +34 -2
  173. package/lib/typescript/commonjs/ui/boot/runProviderColdBoot.d.ts.map +1 -1
  174. package/lib/typescript/commonjs/ui/client.d.ts +0 -1
  175. package/lib/typescript/commonjs/ui/client.d.ts.map +1 -1
  176. package/lib/typescript/commonjs/ui/components/OxyAccountDialogScreen.d.ts.map +1 -1
  177. package/lib/typescript/commonjs/ui/components/OxyAuthChooser.d.ts +21 -29
  178. package/lib/typescript/commonjs/ui/components/OxyAuthChooser.d.ts.map +1 -1
  179. package/lib/typescript/commonjs/ui/components/OxyConsentScreen.d.ts.map +1 -1
  180. package/lib/typescript/commonjs/ui/components/OxyProvider.d.ts.map +1 -1
  181. package/lib/typescript/commonjs/ui/components/OxySignInButton.d.ts +17 -12
  182. package/lib/typescript/commonjs/ui/components/OxySignInButton.d.ts.map +1 -1
  183. package/lib/typescript/commonjs/ui/components/authChooser/AccountsMenuView.d.ts +38 -0
  184. package/lib/typescript/commonjs/ui/components/authChooser/AccountsMenuView.d.ts.map +1 -0
  185. package/lib/typescript/commonjs/ui/components/authChooser/SignInEntryView.d.ts +32 -0
  186. package/lib/typescript/commonjs/ui/components/authChooser/SignInEntryView.d.ts.map +1 -0
  187. package/lib/typescript/commonjs/ui/components/authChooser/SignInRequestView.d.ts +34 -0
  188. package/lib/typescript/commonjs/ui/components/authChooser/SignInRequestView.d.ts.map +1 -0
  189. package/lib/typescript/commonjs/ui/components/authChooser/SignUpView.d.ts +34 -0
  190. package/lib/typescript/commonjs/ui/components/authChooser/SignUpView.d.ts.map +1 -0
  191. package/lib/typescript/commonjs/ui/components/authChooser/TroubleDisclosure.d.ts +43 -0
  192. package/lib/typescript/commonjs/ui/components/authChooser/TroubleDisclosure.d.ts.map +1 -0
  193. package/lib/typescript/commonjs/ui/components/authChooser/primitives.d.ts +55 -0
  194. package/lib/typescript/commonjs/ui/components/authChooser/primitives.d.ts.map +1 -0
  195. package/lib/typescript/commonjs/ui/components/authChooser/requestSurfaces.d.ts +54 -0
  196. package/lib/typescript/commonjs/ui/components/authChooser/requestSurfaces.d.ts.map +1 -0
  197. package/lib/typescript/commonjs/ui/components/authChooser/signInProgress.d.ts +26 -0
  198. package/lib/typescript/commonjs/ui/components/authChooser/signInProgress.d.ts.map +1 -0
  199. package/lib/typescript/{module/ui/components/oxyAuthChooserStyles.d.ts → commonjs/ui/components/authChooser/styles.d.ts} +19 -1
  200. package/lib/typescript/commonjs/ui/components/authChooser/styles.d.ts.map +1 -0
  201. package/lib/typescript/commonjs/ui/components/authChooser/types.d.ts +85 -0
  202. package/lib/typescript/commonjs/ui/components/authChooser/types.d.ts.map +1 -0
  203. package/lib/typescript/commonjs/ui/components/authChooser/useUsernameAvailability.d.ts +16 -0
  204. package/lib/typescript/commonjs/ui/components/authChooser/useUsernameAvailability.d.ts.map +1 -0
  205. package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
  206. package/lib/typescript/commonjs/ui/context/commitSessionFlow.d.ts +40 -0
  207. package/lib/typescript/commonjs/ui/context/commitSessionFlow.d.ts.map +1 -1
  208. package/lib/typescript/commonjs/ui/context/hooks/useAuthOperations.d.ts +11 -2
  209. package/lib/typescript/commonjs/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
  210. package/lib/typescript/commonjs/ui/context/oxyContextTypes.d.ts +44 -1
  211. package/lib/typescript/commonjs/ui/context/oxyContextTypes.d.ts.map +1 -1
  212. package/lib/typescript/commonjs/ui/context/useOxyAccountGraph.d.ts +7 -1
  213. package/lib/typescript/commonjs/ui/context/useOxyAccountGraph.d.ts.map +1 -1
  214. package/lib/typescript/commonjs/ui/hooks/useSwitchableAccounts.d.ts.map +1 -1
  215. package/lib/typescript/commonjs/ui/index.d.ts +0 -1
  216. package/lib/typescript/commonjs/ui/index.d.ts.map +1 -1
  217. package/lib/typescript/commonjs/ui/oauth/browserAuthTransport.d.ts +56 -0
  218. package/lib/typescript/commonjs/ui/oauth/browserAuthTransport.d.ts.map +1 -0
  219. package/lib/typescript/commonjs/ui/oauth/completeOAuthCode.d.ts +49 -0
  220. package/lib/typescript/commonjs/ui/oauth/completeOAuthCode.d.ts.map +1 -0
  221. package/lib/typescript/commonjs/ui/oauth/legacyRedirectLanes.d.ts +40 -0
  222. package/lib/typescript/commonjs/ui/oauth/legacyRedirectLanes.d.ts.map +1 -0
  223. package/lib/typescript/commonjs/ui/oauth/oauthHandshake.d.ts +50 -0
  224. package/lib/typescript/commonjs/ui/oauth/oauthHandshake.d.ts.map +1 -0
  225. package/lib/typescript/commonjs/ui/oauth/oauthPopup.d.ts +83 -0
  226. package/lib/typescript/commonjs/ui/oauth/oauthPopup.d.ts.map +1 -0
  227. package/lib/typescript/commonjs/ui/oauth/oauthPopupMessages.d.ts +67 -0
  228. package/lib/typescript/commonjs/ui/oauth/oauthPopupMessages.d.ts.map +1 -0
  229. package/lib/typescript/commonjs/ui/oauth/types.d.ts +176 -0
  230. package/lib/typescript/commonjs/ui/oauth/types.d.ts.map +1 -0
  231. package/lib/typescript/commonjs/ui/server.d.ts +0 -2
  232. package/lib/typescript/commonjs/ui/server.d.ts.map +1 -1
  233. package/lib/typescript/commonjs/ui/session/authStore.d.ts +3 -7
  234. package/lib/typescript/commonjs/ui/session/authStore.d.ts.map +1 -1
  235. package/lib/typescript/commonjs/ui/session/createSessionClient.d.ts +8 -1
  236. package/lib/typescript/commonjs/ui/session/createSessionClient.d.ts.map +1 -1
  237. package/lib/typescript/commonjs/ui/session/identityBinding.d.ts +66 -0
  238. package/lib/typescript/commonjs/ui/session/identityBinding.d.ts.map +1 -0
  239. package/lib/typescript/commonjs/ui/session/index.d.ts +6 -2
  240. package/lib/typescript/commonjs/ui/session/index.d.ts.map +1 -1
  241. package/lib/typescript/commonjs/ui/session/nativeSecureStorage.d.ts +25 -0
  242. package/lib/typescript/commonjs/ui/session/nativeSecureStorage.d.ts.map +1 -0
  243. package/lib/typescript/commonjs/ui/session/tokenTransport.d.ts +8 -1
  244. package/lib/typescript/commonjs/ui/session/tokenTransport.d.ts.map +1 -1
  245. package/lib/typescript/commonjs/ui/types/navigation.d.ts +44 -0
  246. package/lib/typescript/commonjs/ui/types/navigation.d.ts.map +1 -1
  247. package/lib/typescript/commonjs/ui/utils/crossOriginRestore.d.ts.map +1 -1
  248. package/lib/typescript/commonjs/ui/utils/deliveryPlatform.d.ts +33 -0
  249. package/lib/typescript/commonjs/ui/utils/deliveryPlatform.d.ts.map +1 -0
  250. package/lib/typescript/commonjs/ui/utils/oauthReturn.d.ts +11 -16
  251. package/lib/typescript/commonjs/ui/utils/oauthReturn.d.ts.map +1 -1
  252. package/lib/typescript/module/index.d.ts +4 -1
  253. package/lib/typescript/module/index.d.ts.map +1 -1
  254. package/lib/typescript/module/ui/boot/runProviderColdBoot.d.ts +34 -2
  255. package/lib/typescript/module/ui/boot/runProviderColdBoot.d.ts.map +1 -1
  256. package/lib/typescript/module/ui/client.d.ts +0 -1
  257. package/lib/typescript/module/ui/client.d.ts.map +1 -1
  258. package/lib/typescript/module/ui/components/OxyAccountDialogScreen.d.ts.map +1 -1
  259. package/lib/typescript/module/ui/components/OxyAuthChooser.d.ts +21 -29
  260. package/lib/typescript/module/ui/components/OxyAuthChooser.d.ts.map +1 -1
  261. package/lib/typescript/module/ui/components/OxyConsentScreen.d.ts.map +1 -1
  262. package/lib/typescript/module/ui/components/OxyProvider.d.ts.map +1 -1
  263. package/lib/typescript/module/ui/components/OxySignInButton.d.ts +17 -12
  264. package/lib/typescript/module/ui/components/OxySignInButton.d.ts.map +1 -1
  265. package/lib/typescript/module/ui/components/authChooser/AccountsMenuView.d.ts +38 -0
  266. package/lib/typescript/module/ui/components/authChooser/AccountsMenuView.d.ts.map +1 -0
  267. package/lib/typescript/module/ui/components/authChooser/SignInEntryView.d.ts +32 -0
  268. package/lib/typescript/module/ui/components/authChooser/SignInEntryView.d.ts.map +1 -0
  269. package/lib/typescript/module/ui/components/authChooser/SignInRequestView.d.ts +34 -0
  270. package/lib/typescript/module/ui/components/authChooser/SignInRequestView.d.ts.map +1 -0
  271. package/lib/typescript/module/ui/components/authChooser/SignUpView.d.ts +34 -0
  272. package/lib/typescript/module/ui/components/authChooser/SignUpView.d.ts.map +1 -0
  273. package/lib/typescript/module/ui/components/authChooser/TroubleDisclosure.d.ts +43 -0
  274. package/lib/typescript/module/ui/components/authChooser/TroubleDisclosure.d.ts.map +1 -0
  275. package/lib/typescript/module/ui/components/authChooser/primitives.d.ts +55 -0
  276. package/lib/typescript/module/ui/components/authChooser/primitives.d.ts.map +1 -0
  277. package/lib/typescript/module/ui/components/authChooser/requestSurfaces.d.ts +54 -0
  278. package/lib/typescript/module/ui/components/authChooser/requestSurfaces.d.ts.map +1 -0
  279. package/lib/typescript/module/ui/components/authChooser/signInProgress.d.ts +26 -0
  280. package/lib/typescript/module/ui/components/authChooser/signInProgress.d.ts.map +1 -0
  281. package/lib/typescript/{commonjs/ui/components/oxyAuthChooserStyles.d.ts → module/ui/components/authChooser/styles.d.ts} +19 -1
  282. package/lib/typescript/module/ui/components/authChooser/styles.d.ts.map +1 -0
  283. package/lib/typescript/module/ui/components/authChooser/types.d.ts +85 -0
  284. package/lib/typescript/module/ui/components/authChooser/types.d.ts.map +1 -0
  285. package/lib/typescript/module/ui/components/authChooser/useUsernameAvailability.d.ts +16 -0
  286. package/lib/typescript/module/ui/components/authChooser/useUsernameAvailability.d.ts.map +1 -0
  287. package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
  288. package/lib/typescript/module/ui/context/commitSessionFlow.d.ts +40 -0
  289. package/lib/typescript/module/ui/context/commitSessionFlow.d.ts.map +1 -1
  290. package/lib/typescript/module/ui/context/hooks/useAuthOperations.d.ts +11 -2
  291. package/lib/typescript/module/ui/context/hooks/useAuthOperations.d.ts.map +1 -1
  292. package/lib/typescript/module/ui/context/oxyContextTypes.d.ts +44 -1
  293. package/lib/typescript/module/ui/context/oxyContextTypes.d.ts.map +1 -1
  294. package/lib/typescript/module/ui/context/useOxyAccountGraph.d.ts +7 -1
  295. package/lib/typescript/module/ui/context/useOxyAccountGraph.d.ts.map +1 -1
  296. package/lib/typescript/module/ui/hooks/useSwitchableAccounts.d.ts.map +1 -1
  297. package/lib/typescript/module/ui/index.d.ts +0 -1
  298. package/lib/typescript/module/ui/index.d.ts.map +1 -1
  299. package/lib/typescript/module/ui/oauth/browserAuthTransport.d.ts +56 -0
  300. package/lib/typescript/module/ui/oauth/browserAuthTransport.d.ts.map +1 -0
  301. package/lib/typescript/module/ui/oauth/completeOAuthCode.d.ts +49 -0
  302. package/lib/typescript/module/ui/oauth/completeOAuthCode.d.ts.map +1 -0
  303. package/lib/typescript/module/ui/oauth/legacyRedirectLanes.d.ts +40 -0
  304. package/lib/typescript/module/ui/oauth/legacyRedirectLanes.d.ts.map +1 -0
  305. package/lib/typescript/module/ui/oauth/oauthHandshake.d.ts +50 -0
  306. package/lib/typescript/module/ui/oauth/oauthHandshake.d.ts.map +1 -0
  307. package/lib/typescript/module/ui/oauth/oauthPopup.d.ts +83 -0
  308. package/lib/typescript/module/ui/oauth/oauthPopup.d.ts.map +1 -0
  309. package/lib/typescript/module/ui/oauth/oauthPopupMessages.d.ts +67 -0
  310. package/lib/typescript/module/ui/oauth/oauthPopupMessages.d.ts.map +1 -0
  311. package/lib/typescript/module/ui/oauth/types.d.ts +176 -0
  312. package/lib/typescript/module/ui/oauth/types.d.ts.map +1 -0
  313. package/lib/typescript/module/ui/server.d.ts +0 -2
  314. package/lib/typescript/module/ui/server.d.ts.map +1 -1
  315. package/lib/typescript/module/ui/session/authStore.d.ts +3 -7
  316. package/lib/typescript/module/ui/session/authStore.d.ts.map +1 -1
  317. package/lib/typescript/module/ui/session/createSessionClient.d.ts +8 -1
  318. package/lib/typescript/module/ui/session/createSessionClient.d.ts.map +1 -1
  319. package/lib/typescript/module/ui/session/identityBinding.d.ts +66 -0
  320. package/lib/typescript/module/ui/session/identityBinding.d.ts.map +1 -0
  321. package/lib/typescript/module/ui/session/index.d.ts +6 -2
  322. package/lib/typescript/module/ui/session/index.d.ts.map +1 -1
  323. package/lib/typescript/module/ui/session/nativeSecureStorage.d.ts +25 -0
  324. package/lib/typescript/module/ui/session/nativeSecureStorage.d.ts.map +1 -0
  325. package/lib/typescript/module/ui/session/tokenTransport.d.ts +8 -1
  326. package/lib/typescript/module/ui/session/tokenTransport.d.ts.map +1 -1
  327. package/lib/typescript/module/ui/types/navigation.d.ts +44 -0
  328. package/lib/typescript/module/ui/types/navigation.d.ts.map +1 -1
  329. package/lib/typescript/module/ui/utils/crossOriginRestore.d.ts.map +1 -1
  330. package/lib/typescript/module/ui/utils/deliveryPlatform.d.ts +33 -0
  331. package/lib/typescript/module/ui/utils/deliveryPlatform.d.ts.map +1 -0
  332. package/lib/typescript/module/ui/utils/oauthReturn.d.ts +11 -16
  333. package/lib/typescript/module/ui/utils/oauthReturn.d.ts.map +1 -1
  334. package/package.json +6 -8
  335. package/src/index.ts +19 -5
  336. package/src/ui/boot/__tests__/coldBootWebAuthMode.test.ts +281 -0
  337. package/src/ui/boot/runProviderColdBoot.ts +83 -13
  338. package/src/ui/client.ts +0 -1
  339. package/src/ui/components/OxyAccountDialogScreen.tsx +33 -4
  340. package/src/ui/components/OxyAuthChooser.tsx +100 -1230
  341. package/src/ui/components/OxyConsentScreen.tsx +56 -13
  342. package/src/ui/components/OxyProvider.tsx +4 -4
  343. package/src/ui/components/OxySignInButton.tsx +119 -78
  344. package/src/ui/components/__tests__/OxyConsentScreen.test.tsx +27 -0
  345. package/src/ui/components/authChooser/AccountsMenuView.tsx +569 -0
  346. package/src/ui/components/authChooser/SignInEntryView.tsx +115 -0
  347. package/src/ui/components/authChooser/SignInRequestView.tsx +163 -0
  348. package/src/ui/components/authChooser/SignUpView.tsx +174 -0
  349. package/src/ui/components/authChooser/TroubleDisclosure.tsx +81 -0
  350. package/src/ui/components/authChooser/primitives.tsx +144 -0
  351. package/src/ui/components/authChooser/requestSurfaces.tsx +116 -0
  352. package/src/ui/components/authChooser/signInProgress.ts +54 -0
  353. package/src/ui/components/{oxyAuthChooserStyles.ts → authChooser/styles.ts} +18 -0
  354. package/src/ui/components/authChooser/types.ts +101 -0
  355. package/src/ui/components/authChooser/useUsernameAvailability.ts +60 -0
  356. package/src/ui/context/OxyContext.tsx +226 -24
  357. package/src/ui/context/__tests__/commitSessionFlow.test.ts +102 -0
  358. package/src/ui/context/commitSessionFlow.ts +64 -0
  359. package/src/ui/context/hooks/useAuthOperations.ts +26 -1
  360. package/src/ui/context/oxyContextTypes.ts +45 -1
  361. package/src/ui/context/useOxyAccountGraph.ts +19 -5
  362. package/src/ui/hooks/useSwitchableAccounts.ts +12 -1
  363. package/src/ui/index.ts +0 -1
  364. package/src/ui/oauth/__tests__/browserAuthTransport.test.ts +335 -0
  365. package/src/ui/oauth/__tests__/completeOAuthCode.test.ts +142 -0
  366. package/src/ui/oauth/__tests__/oauthPopup.test.ts +352 -0
  367. package/src/ui/oauth/__tests__/oauthPopupMessages.test.ts +189 -0
  368. package/src/ui/oauth/__tests__/sharedCompletionPath.test.ts +174 -0
  369. package/src/ui/oauth/browserAuthTransport.ts +193 -0
  370. package/src/ui/oauth/completeOAuthCode.ts +93 -0
  371. package/src/ui/oauth/legacyRedirectLanes.ts +43 -0
  372. package/src/ui/oauth/oauthHandshake.ts +74 -0
  373. package/src/ui/oauth/oauthPopup.ts +277 -0
  374. package/src/ui/oauth/oauthPopupMessages.ts +136 -0
  375. package/src/ui/oauth/types.ts +150 -0
  376. package/src/ui/server.ts +0 -2
  377. package/src/ui/session/__tests__/createSessionClient.test.ts +26 -0
  378. package/src/ui/session/__tests__/tokenTransport.test.ts +34 -0
  379. package/src/ui/session/authStore.ts +5 -89
  380. package/src/ui/session/createSessionClient.ts +15 -2
  381. package/src/ui/session/identityBinding.ts +116 -0
  382. package/src/ui/session/index.ts +6 -2
  383. package/src/ui/session/nativeSecureStorage.ts +98 -0
  384. package/src/ui/session/tokenTransport.ts +14 -1
  385. package/src/ui/types/navigation.ts +44 -1
  386. package/src/ui/utils/__tests__/crossOriginRestore.test.ts +17 -0
  387. package/src/ui/utils/crossOriginRestore.ts +7 -6
  388. package/src/ui/utils/deliveryPlatform.ts +65 -0
  389. package/src/ui/utils/oauthReturn.ts +38 -62
  390. package/lib/commonjs/assets/assets/fonts/Inter/Inter_18pt-Black.ttf +0 -0
  391. package/lib/commonjs/assets/assets/fonts/Inter/Inter_18pt-Bold.ttf +0 -0
  392. package/lib/commonjs/assets/assets/fonts/Inter/Inter_18pt-ExtraBold.ttf +0 -0
  393. package/lib/commonjs/assets/assets/fonts/Inter/Inter_18pt-Light.ttf +0 -0
  394. package/lib/commonjs/assets/assets/fonts/Inter/Inter_18pt-Medium.ttf +0 -0
  395. package/lib/commonjs/assets/assets/fonts/Inter/Inter_18pt-Regular.ttf +0 -0
  396. package/lib/commonjs/assets/assets/fonts/Inter/Inter_18pt-SemiBold.ttf +0 -0
  397. package/lib/commonjs/assets/fonts/Inter/Inter_18pt-Black.ttf +0 -0
  398. package/lib/commonjs/assets/fonts/Inter/Inter_18pt-Bold.ttf +0 -0
  399. package/lib/commonjs/assets/fonts/Inter/Inter_18pt-ExtraBold.ttf +0 -0
  400. package/lib/commonjs/assets/fonts/Inter/Inter_18pt-Light.ttf +0 -0
  401. package/lib/commonjs/assets/fonts/Inter/Inter_18pt-Medium.ttf +0 -0
  402. package/lib/commonjs/assets/fonts/Inter/Inter_18pt-Regular.ttf +0 -0
  403. package/lib/commonjs/assets/fonts/Inter/Inter_18pt-SemiBold.ttf +0 -0
  404. package/lib/commonjs/ui/components/FontLoader.js +0 -35
  405. package/lib/commonjs/ui/components/FontLoader.js.map +0 -1
  406. package/lib/commonjs/ui/components/FontLoader.native.js +0 -88
  407. package/lib/commonjs/ui/components/FontLoader.native.js.map +0 -1
  408. package/lib/commonjs/ui/components/oxyAuthChooserStyles.js.map +0 -1
  409. package/lib/module/assets/assets/fonts/Inter/Inter_18pt-Black.ttf +0 -0
  410. package/lib/module/assets/assets/fonts/Inter/Inter_18pt-Bold.ttf +0 -0
  411. package/lib/module/assets/assets/fonts/Inter/Inter_18pt-ExtraBold.ttf +0 -0
  412. package/lib/module/assets/assets/fonts/Inter/Inter_18pt-Light.ttf +0 -0
  413. package/lib/module/assets/assets/fonts/Inter/Inter_18pt-Medium.ttf +0 -0
  414. package/lib/module/assets/assets/fonts/Inter/Inter_18pt-Regular.ttf +0 -0
  415. package/lib/module/assets/assets/fonts/Inter/Inter_18pt-SemiBold.ttf +0 -0
  416. package/lib/module/assets/fonts/Inter/Inter_18pt-Black.ttf +0 -0
  417. package/lib/module/assets/fonts/Inter/Inter_18pt-Bold.ttf +0 -0
  418. package/lib/module/assets/fonts/Inter/Inter_18pt-ExtraBold.ttf +0 -0
  419. package/lib/module/assets/fonts/Inter/Inter_18pt-Light.ttf +0 -0
  420. package/lib/module/assets/fonts/Inter/Inter_18pt-Medium.ttf +0 -0
  421. package/lib/module/assets/fonts/Inter/Inter_18pt-Regular.ttf +0 -0
  422. package/lib/module/assets/fonts/Inter/Inter_18pt-SemiBold.ttf +0 -0
  423. package/lib/module/ui/components/FontLoader.js +0 -29
  424. package/lib/module/ui/components/FontLoader.js.map +0 -1
  425. package/lib/module/ui/components/FontLoader.native.js +0 -83
  426. package/lib/module/ui/components/FontLoader.native.js.map +0 -1
  427. package/lib/module/ui/components/oxyAuthChooserStyles.js.map +0 -1
  428. package/lib/typescript/commonjs/ui/components/FontLoader.d.ts +0 -24
  429. package/lib/typescript/commonjs/ui/components/FontLoader.d.ts.map +0 -1
  430. package/lib/typescript/commonjs/ui/components/FontLoader.native.d.ts +0 -13
  431. package/lib/typescript/commonjs/ui/components/FontLoader.native.d.ts.map +0 -1
  432. package/lib/typescript/commonjs/ui/components/oxyAuthChooserStyles.d.ts.map +0 -1
  433. package/lib/typescript/module/ui/components/FontLoader.d.ts +0 -24
  434. package/lib/typescript/module/ui/components/FontLoader.d.ts.map +0 -1
  435. package/lib/typescript/module/ui/components/FontLoader.native.d.ts +0 -13
  436. package/lib/typescript/module/ui/components/FontLoader.native.d.ts.map +0 -1
  437. package/lib/typescript/module/ui/components/oxyAuthChooserStyles.d.ts.map +0 -1
  438. package/src/assets/fonts/Inter/Inter_18pt-Black.ttf +0 -0
  439. package/src/assets/fonts/Inter/Inter_18pt-Bold.ttf +0 -0
  440. package/src/assets/fonts/Inter/Inter_18pt-ExtraBold.ttf +0 -0
  441. package/src/assets/fonts/Inter/Inter_18pt-Light.ttf +0 -0
  442. package/src/assets/fonts/Inter/Inter_18pt-Medium.ttf +0 -0
  443. package/src/assets/fonts/Inter/Inter_18pt-Regular.ttf +0 -0
  444. package/src/assets/fonts/Inter/Inter_18pt-SemiBold.ttf +0 -0
  445. package/src/ui/components/FontLoader.native.tsx +0 -88
  446. package/src/ui/components/FontLoader.tsx +0 -27
@@ -6,91 +6,22 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.createPlatformAuthStateStore = createPlatformAuthStateStore;
7
7
  var _core = require("@oxyhq/core");
8
8
  var _storageHelpers = require("../utils/storageHelpers.js");
9
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); } /**
9
+ var _nativeSecureStorage = require("./nativeSecureStorage.js");
10
+ /**
10
11
  * Platform `AuthStateStore` for `@oxyhq/services`.
11
12
  *
12
13
  * The zero-cookie device model persists the durable device credential
13
14
  * (`deviceId` + `deviceSecret`) per origin (web) / per device (native), and the
14
15
  * SDK re-mints the access token from that credential on cold boot. `@oxyhq/core`
15
16
  * owns the store shape + logic (`createWebAuthStateStore` /
16
- * `createNativeAuthStateStore`); this module only supplies the platform storage
17
+ * `createNativeAuthStateStore`); this module only selects the platform storage
17
18
  * seam:
18
19
  *
19
20
  * - web → `createWebAuthStateStore()` (localStorage, in-memory fallback).
20
21
  * - native → `createNativeAuthStateStore(secureKV)` for the SESSION blob over
21
- * `expo-secure-store` (AsyncStorage fallback).
22
- *
23
- * `expo-secure-store` is loaded via a runtime-computed dynamic import (the same
24
- * optional-native-module pattern `OxyProvider` uses for netinfo / keyboard
25
- * controller), so the web bundle never pulls it and a device without it falls
26
- * back to AsyncStorage rather than crashing.
27
- */
28
- // Variable indirection so Metro's static analyzer never traces expo-secure-store
29
- // into the web bundle; the module is native-only and optional.
30
- const SECURE_STORE_MODULE = 'expo-secure-store';
31
- let secureStorePromise = null;
32
-
33
- /**
34
- * Resolve the `expo-secure-store` module once (memoised), or `null` when it is
35
- * unavailable — callers then fall back to AsyncStorage. Never throws.
22
+ * the shared `createNativeSecureKeyValueStorage()` adapter
23
+ * (`expo-secure-store`, AsyncStorage fallback).
36
24
  */
37
- function loadSecureStore() {
38
- if (!secureStorePromise) {
39
- const moduleName = SECURE_STORE_MODULE;
40
- secureStorePromise = (specifier => new Promise(r => r(`${specifier}`)).then(s => _interopRequireWildcard(require(s))))(moduleName).then(mod => {
41
- if (typeof mod.getItemAsync === 'function' && typeof mod.setItemAsync === 'function' && typeof mod.deleteItemAsync === 'function') {
42
- return {
43
- getItemAsync: mod.getItemAsync.bind(mod),
44
- setItemAsync: mod.setItemAsync.bind(mod),
45
- deleteItemAsync: mod.deleteItemAsync.bind(mod)
46
- };
47
- }
48
- return null;
49
- }).catch(() => null);
50
- }
51
- return secureStorePromise;
52
- }
53
-
54
- /**
55
- * A native `NativeKeyValueStorage` that prefers `expo-secure-store` (encrypted
56
- * at rest) and falls back to AsyncStorage when SecureStore is not installed.
57
- * The SecureStore module is resolved lazily on first access so construction
58
- * stays synchronous.
59
- */
60
- function createNativeSecureKeyValueStorage() {
61
- let asyncStorage = null;
62
- const getAsyncStorage = async () => {
63
- if (!asyncStorage) {
64
- asyncStorage = await (0, _storageHelpers.createPlatformStorage)();
65
- }
66
- return asyncStorage;
67
- };
68
- return {
69
- getItem: async key => {
70
- const secure = await loadSecureStore();
71
- if (secure) {
72
- return secure.getItemAsync(key);
73
- }
74
- return (await getAsyncStorage()).getItem(key);
75
- },
76
- setItem: async (key, value) => {
77
- const secure = await loadSecureStore();
78
- if (secure) {
79
- await secure.setItemAsync(key, value);
80
- return;
81
- }
82
- await (await getAsyncStorage()).setItem(key, value);
83
- },
84
- removeItem: async key => {
85
- const secure = await loadSecureStore();
86
- if (secure) {
87
- await secure.deleteItemAsync(key);
88
- return;
89
- }
90
- await (await getAsyncStorage()).removeItem(key);
91
- }
92
- };
93
- }
94
25
 
95
26
  /**
96
27
  * Build the platform {@link AuthStateStore} for this runtime.
@@ -103,6 +34,6 @@ function createPlatformAuthStateStore() {
103
34
  if (!(0, _storageHelpers.isReactNative)()) {
104
35
  return (0, _core.createWebAuthStateStore)();
105
36
  }
106
- return (0, _core.createNativeAuthStateStore)(createNativeSecureKeyValueStorage());
37
+ return (0, _core.createNativeAuthStateStore)((0, _nativeSecureStorage.createNativeSecureKeyValueStorage)());
107
38
  }
108
39
  //# sourceMappingURL=authStore.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_core","require","_storageHelpers","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","SECURE_STORE_MODULE","secureStorePromise","loadSecureStore","moduleName","specifier","Promise","then","s","mod","getItemAsync","setItemAsync","deleteItemAsync","bind","catch","createNativeSecureKeyValueStorage","asyncStorage","getAsyncStorage","createPlatformStorage","getItem","key","secure","setItem","value","removeItem","createPlatformAuthStateStore","isReactNative","createWebAuthStateStore","createNativeAuthStateStore"],"sourceRoot":"../../../../src","sources":["ui/session/authStore.ts"],"mappings":";;;;;;AAmBA,IAAAA,KAAA,GAAAC,OAAA;AAMA,IAAAC,eAAA,GAAAD,OAAA;AAA+E,SAAAE,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAH,uBAAA,YAAAA,CAAAC,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF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MAAMlB,eAAe,CAAC,CAAC;MACtC,IAAIkB,MAAM,EAAE;QACV,MAAMA,MAAM,CAACT,eAAe,CAACQ,GAAG,CAAC;QACjC;MACF;MACA,MAAM,CAAC,MAAMH,eAAe,CAAC,CAAC,EAAEO,UAAU,CAACJ,GAAG,CAAC;IACjD;EACF,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASK,4BAA4BA,CAAA,EAAmB;EAC7D,IAAI,CAAC,IAAAC,6BAAa,EAAC,CAAC,EAAE;IACpB,OAAO,IAAAC,6BAAuB,EAAC,CAAC;EAClC;EAEA,OAAO,IAAAC,gCAA0B,EAACb,iCAAiC,CAAC,CAAC,CAAC;AACxE","ignoreList":[]}
1
+ {"version":3,"names":["_core","require","_storageHelpers","_nativeSecureStorage","createPlatformAuthStateStore","isReactNative","createWebAuthStateStore","createNativeAuthStateStore","createNativeSecureKeyValueStorage"],"sourceRoot":"../../../../src","sources":["ui/session/authStore.ts"],"mappings":";;;;;;AAeA,IAAAA,KAAA,GAAAC,OAAA;AAKA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,oBAAA,GAAAF,OAAA;AArBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,4BAA4BA,CAAA,EAAmB;EAC7D,IAAI,CAAC,IAAAC,6BAAa,EAAC,CAAC,EAAE;IACpB,OAAO,IAAAC,6BAAuB,EAAC,CAAC;EAClC;EAEA,OAAO,IAAAC,gCAA0B,EAAC,IAAAC,sDAAiC,EAAC,CAAC,CAAC;AACxE","ignoreList":[]}
@@ -33,14 +33,22 @@ var _tokenTransport = require("./tokenTransport.js");
33
33
  *
34
34
  * The realtime socket uses bearer when authenticated, or deviceId+deviceSecret
35
35
  * when signed out (after the one-shot join redirect).
36
+ *
37
+ * `getPinnedAccountId` reports the account an IDENTITY-BOUND provider
38
+ * (`sessionMode: 'identity'`) is pinned to, and `null` for every account-mode
39
+ * provider — which is exactly the value `SessionClient` and the transport read
40
+ * when the option is absent, so account mode is unchanged. While it reports an
41
+ * account, the client tracks device state truthfully but never re-binds its
42
+ * bearer to the device's mutable active account.
36
43
  */
37
- function createSessionClient(oxyServices, onUnauthenticated) {
44
+ function createSessionClient(oxyServices, onUnauthenticated, getPinnedAccountId) {
38
45
  const host = (0, _core.createSessionClientHost)(oxyServices);
39
- const transport = (0, _tokenTransport.createTokenTransport)(oxyServices);
46
+ const transport = (0, _tokenTransport.createTokenTransport)(oxyServices, getPinnedAccountId);
40
47
  const client = new _core.SessionClient(host, {
41
48
  transport,
42
49
  socketFactory: _socket.io,
43
- onUnauthenticated
50
+ onUnauthenticated,
51
+ getPinnedAccountId
44
52
  });
45
53
  return {
46
54
  client,
@@ -1 +1 @@
1
- {"version":3,"names":["_socket","require","_core","_tokenTransport","createSessionClient","oxyServices","onUnauthenticated","host","createSessionClientHost","transport","createTokenTransport","client","SessionClient","socketFactory","io"],"sourceRoot":"../../../../src","sources":["ui/session/createSessionClient.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAMA,IAAAE,eAAA,GAAAF,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,mBAAmBA,CACjCC,WAAwB,EACxBC,iBAAwD,EAIxD;EACA,MAAMC,IAAI,GAAG,IAAAC,6BAAuB,EAACH,WAAW,CAAC;EACjD,MAAMI,SAAS,GAAG,IAAAC,oCAAoB,EAACL,WAAW,CAAC;EACnD,MAAMM,MAAM,GAAG,IAAIC,mBAAa,CAACL,IAAI,EAAE;IAAEE,SAAS;IAAEI,aAAa,EAAEC,UAAE;IAAER;EAAkB,CAAC,CAAC;EAC3F,OAAO;IAAEK,MAAM;IAAEJ;EAAK,CAAC;AACzB","ignoreList":[]}
1
+ {"version":3,"names":["_socket","require","_core","_tokenTransport","createSessionClient","oxyServices","onUnauthenticated","getPinnedAccountId","host","createSessionClientHost","transport","createTokenTransport","client","SessionClient","socketFactory","io"],"sourceRoot":"../../../../src","sources":["ui/session/createSessionClient.ts"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAMA,IAAAE,eAAA,GAAAF,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,mBAAmBA,CACjCC,WAAwB,EACxBC,iBAAwD,EACxDC,kBAAwC,EAIxC;EACA,MAAMC,IAAI,GAAG,IAAAC,6BAAuB,EAACJ,WAAW,CAAC;EACjD,MAAMK,SAAS,GAAG,IAAAC,oCAAoB,EAACN,WAAW,EAAEE,kBAAkB,CAAC;EACvE,MAAMK,MAAM,GAAG,IAAIC,mBAAa,CAACL,IAAI,EAAE;IACrCE,SAAS;IACTI,aAAa,EAAEC,UAAE;IACjBT,iBAAiB;IACjBC;EACF,CAAC,CAAC;EACF,OAAO;IAAEK,MAAM;IAAEJ;EAAK,CAAC;AACzB","ignoreList":[]}
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.IdentityBoundSessionError = void 0;
7
+ exports.createIdentitySessionBinding = createIdentitySessionBinding;
8
+ var _core = require("@oxyhq/core");
9
+ var _storageHelpers = require("../utils/storageHelpers.js");
10
+ var _nativeSecureStorage = require("./nativeSecureStorage.js");
11
+ /**
12
+ * Identity-bound sessions — the PLATFORM half of `sessionMode: 'identity'`.
13
+ *
14
+ * `@oxyhq/core` owns everything platform-agnostic about an identity-bound
15
+ * session: the pin store shapes, `resolveIdentityPin`,
16
+ * `establishIdentitySession`, and the pinned cold-boot / re-mint lanes. What it
17
+ * deliberately leaves out is WHICH pin store a given runtime should use, so this
18
+ * module supplies it — web `localStorage` vs the same native SecureStore adapter
19
+ * the device credential already persists through — and adds the one piece of
20
+ * state the provider needs on top: a memoised, SYNCHRONOUSLY readable pinned
21
+ * account id.
22
+ *
23
+ * Why the memo matters: `SessionClient.getPinnedAccountId` is a synchronous read
24
+ * on the socket/apply path, while resolving the pin is asynchronous (a storage
25
+ * read plus a keychain read, through `resolveIdentityPin`). The provider
26
+ * resolves it before the cold boot and after every (re-)established identity
27
+ * session; every read after that is free.
28
+ */
29
+
30
+ /**
31
+ * The provider-scoped identity binding: the core {@link IdentityBinding} handed
32
+ * to the cold boot and the re-mint handler, plus the resolved pin the projection
33
+ * and `SessionClient` bind to.
34
+ */
35
+
36
+ /**
37
+ * Thrown by every account-graph mutation while the provider runs in
38
+ * `sessionMode: 'identity'`.
39
+ *
40
+ * An identity-bound app's user is the owner of the local identity key — fixed,
41
+ * for the lifetime of that key. Switching it is not a temporarily-unavailable
42
+ * operation that could be retried, it is not part of this mode's contract at
43
+ * all, so the surfaces reject loudly rather than resolving to a no-op that would
44
+ * read to the caller as a successful switch.
45
+ */
46
+ class IdentityBoundSessionError extends Error {
47
+ name = 'IdentityBoundSessionError';
48
+ code = 'identity_bound_session';
49
+ constructor(operation) {
50
+ super(`"${operation}" is unavailable while the session is identity-bound (sessionMode: "identity"): this app authenticates as the owner of the local identity key and cannot switch accounts.`);
51
+ this.operation = operation;
52
+ }
53
+ }
54
+
55
+ /**
56
+ * Build the identity binding for this runtime. Called ONCE per provider mount,
57
+ * and ONLY when `sessionMode: 'identity'` — account-mode providers never
58
+ * construct a pin store.
59
+ */
60
+ exports.IdentityBoundSessionError = IdentityBoundSessionError;
61
+ function createIdentitySessionBinding() {
62
+ const pinStore = (0, _storageHelpers.isReactNative)() ? (0, _core.createNativeIdentityPinStore)((0, _nativeSecureStorage.createNativeSecureKeyValueStorage)()) : (0, _core.createWebIdentityPinStore)();
63
+ const binding = {
64
+ pinStore
65
+ };
66
+
67
+ // Only a RESOLVED (non-null) pin is memoised. A `null` outcome is either "not
68
+ // pinned yet" or an indeterminate key read (locked keychain), and caching
69
+ // either one would leave this client permanently unpinned for the rest of the
70
+ // process — the exact state in which it would start following the device's
71
+ // mutable active account.
72
+ let pinnedAccountId = null;
73
+ let inFlight = null;
74
+ const resolve = () => {
75
+ if (!inFlight) {
76
+ inFlight = (0, _core.resolveIdentityPin)(binding).then(pin => {
77
+ pinnedAccountId = pin?.accountId ?? null;
78
+ return pinnedAccountId;
79
+ }).finally(() => {
80
+ inFlight = null;
81
+ });
82
+ }
83
+ return inFlight;
84
+ };
85
+ return {
86
+ binding,
87
+ getPinnedAccountId: () => pinnedAccountId,
88
+ ensurePinnedAccountId: () => pinnedAccountId !== null ? Promise.resolve(pinnedAccountId) : resolve(),
89
+ refreshPinnedAccountId: () => {
90
+ pinnedAccountId = null;
91
+ return resolve();
92
+ }
93
+ };
94
+ }
95
+ //# sourceMappingURL=identityBinding.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_core","require","_storageHelpers","_nativeSecureStorage","IdentityBoundSessionError","Error","name","code","constructor","operation","exports","createIdentitySessionBinding","pinStore","isReactNative","createNativeIdentityPinStore","createNativeSecureKeyValueStorage","createWebIdentityPinStore","binding","pinnedAccountId","inFlight","resolve","resolveIdentityPin","then","pin","accountId","finally","getPinnedAccountId","ensurePinnedAccountId","Promise","refreshPinnedAccountId"],"sourceRoot":"../../../../src","sources":["ui/session/identityBinding.ts"],"mappings":";;;;;;;AAkBA,IAAAA,KAAA,GAAAC,OAAA;AAMA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,oBAAA,GAAAF,OAAA;AAzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAUA;AAC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AEA,CAAA,KAAM;MAC5BX,eAAe,GAAG,IAAI;MACtB,OAAOE,OAAO,CAAC,CAAC;IAClB;EACF,CAAC;AACH","ignoreList":[]}
@@ -3,6 +3,12 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ Object.defineProperty(exports, "IdentityBoundSessionError", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _identityBinding.IdentityBoundSessionError;
10
+ }
11
+ });
6
12
  Object.defineProperty(exports, "accountIdsOf", {
7
13
  enumerable: true,
8
14
  get: function () {
@@ -21,6 +27,12 @@ Object.defineProperty(exports, "activeUserOf", {
21
27
  return _core.activeUserOf;
22
28
  }
23
29
  });
30
+ Object.defineProperty(exports, "createIdentitySessionBinding", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _identityBinding.createIdentitySessionBinding;
34
+ }
35
+ });
24
36
  Object.defineProperty(exports, "createPlatformAuthStateStore", {
25
37
  enumerable: true,
26
38
  get: function () {
@@ -54,5 +66,6 @@ Object.defineProperty(exports, "deviceStateToClientSessions", {
54
66
  var _createSessionClient = require("./createSessionClient.js");
55
67
  var _tokenTransport = require("./tokenTransport.js");
56
68
  var _authStore = require("./authStore.js");
69
+ var _identityBinding = require("./identityBinding.js");
57
70
  var _core = require("@oxyhq/core");
58
71
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_createSessionClient","require","_tokenTransport","_authStore","_core"],"sourceRoot":"../../../../src","sources":["ui/session/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,IAAAA,oBAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,KAAA,GAAAH,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["_createSessionClient","require","_tokenTransport","_authStore","_identityBinding","_core"],"sourceRoot":"../../../../src","sources":["ui/session/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,IAAAA,oBAAA,GAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,UAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AAEA,IAAAI,KAAA,GAAAJ,OAAA","ignoreList":[]}
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createNativeSecureKeyValueStorage = createNativeSecureKeyValueStorage;
7
+ var _storageHelpers = require("../utils/storageHelpers.js");
8
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); } /**
9
+ * The native secure key/value seam every durable `@oxyhq/core` store in this
10
+ * package is built on.
11
+ *
12
+ * `@oxyhq/core` owns the store LOGIC (`createNativeAuthStateStore` for the
13
+ * zero-cookie device credential, `createNativeIdentityPinStore` for the identity
14
+ * pin) and takes its persistence as an injected `NativeKeyValueStorage`. This
15
+ * module supplies that injection ONCE, so those stores can never drift onto
16
+ * different backings — a device credential in SecureStore and a pin in
17
+ * AsyncStorage would resolve differently after a keystore reset.
18
+ *
19
+ * `expo-secure-store` is loaded via a runtime-computed dynamic import (the same
20
+ * optional-native-module pattern `OxyProvider` uses for netinfo / keyboard
21
+ * controller), so the web bundle never pulls it and a device without it falls
22
+ * back to AsyncStorage rather than crashing.
23
+ */
24
+ // Variable indirection so Metro's static analyzer never traces expo-secure-store
25
+ // into the web bundle; the module is native-only and optional.
26
+ const SECURE_STORE_MODULE = 'expo-secure-store';
27
+ let secureStorePromise = null;
28
+
29
+ /**
30
+ * Resolve the `expo-secure-store` module once (memoised), or `null` when it is
31
+ * unavailable — callers then fall back to AsyncStorage. Never throws.
32
+ */
33
+ function loadSecureStore() {
34
+ if (!secureStorePromise) {
35
+ const moduleName = SECURE_STORE_MODULE;
36
+ secureStorePromise = (specifier => new Promise(r => r(`${specifier}`)).then(s => _interopRequireWildcard(require(s))))(moduleName).then(mod => {
37
+ if (typeof mod.getItemAsync === 'function' && typeof mod.setItemAsync === 'function' && typeof mod.deleteItemAsync === 'function') {
38
+ return {
39
+ getItemAsync: mod.getItemAsync.bind(mod),
40
+ setItemAsync: mod.setItemAsync.bind(mod),
41
+ deleteItemAsync: mod.deleteItemAsync.bind(mod)
42
+ };
43
+ }
44
+ return null;
45
+ }).catch(() => null);
46
+ }
47
+ return secureStorePromise;
48
+ }
49
+
50
+ /**
51
+ * A native `NativeKeyValueStorage` that prefers `expo-secure-store` (encrypted
52
+ * at rest) and falls back to AsyncStorage when SecureStore is not installed.
53
+ * The SecureStore module is resolved lazily on first access so construction
54
+ * stays synchronous.
55
+ */
56
+ function createNativeSecureKeyValueStorage() {
57
+ let asyncStorage = null;
58
+ const getAsyncStorage = async () => {
59
+ if (!asyncStorage) {
60
+ asyncStorage = await (0, _storageHelpers.createPlatformStorage)();
61
+ }
62
+ return asyncStorage;
63
+ };
64
+ return {
65
+ getItem: async key => {
66
+ const secure = await loadSecureStore();
67
+ if (secure) {
68
+ return secure.getItemAsync(key);
69
+ }
70
+ return (await getAsyncStorage()).getItem(key);
71
+ },
72
+ setItem: async (key, value) => {
73
+ const secure = await loadSecureStore();
74
+ if (secure) {
75
+ await secure.setItemAsync(key, value);
76
+ return;
77
+ }
78
+ await (await getAsyncStorage()).setItem(key, value);
79
+ },
80
+ removeItem: async key => {
81
+ const secure = await loadSecureStore();
82
+ if (secure) {
83
+ await secure.deleteItemAsync(key);
84
+ return;
85
+ }
86
+ await (await getAsyncStorage()).removeItem(key);
87
+ }
88
+ };
89
+ }
90
+ //# sourceMappingURL=nativeSecureStorage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_storageHelpers","require","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","SECURE_STORE_MODULE","secureStorePromise","loadSecureStore","moduleName","specifier","Promise","then","s","mod","getItemAsync","setItemAsync","deleteItemAsync","bind","catch","createNativeSecureKeyValueStorage","asyncStorage","getAsyncStorage","createPlatformStorage","getItem","key","secure","setItem","value","removeItem"],"sourceRoot":"../../../../src","sources":["ui/session/nativeSecureStorage.ts"],"mappings":";;;;;;AAiBA,IAAAA,eAAA,GAAAC,OAAA;AAAgE,SAAAC,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAH,uBAAA,YAAAA,CAAAC,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CA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AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASa,iCAAiCA,CAAA,EAA0B;EACzE,IAAIC,YAAsE,GAAG,IAAI;EACjF,MAAMC,eAAe,GAAG,MAAAA,CAAA,KAAY;IAClC,IAAI,CAACD,YAAY,EAAE;MACjBA,YAAY,GAAG,MAAM,IAAAE,qCAAqB,EAAC,CAAC;IAC9C;IACA,OAAOF,YAAY;EACrB,CAAC;EACD,OAAO;IACLG,OAAO,EAAE,MAAOC,GAAG,IAAK;MACtB,MAAMC,MAAM,GAAG,MAAMlB,eAAe,CAAC,CAAC;MACtC,IAAIkB,MAAM,EAAE;QACV,OAAOA,MAAM,CAACX,YAAY,CAACU,GAAG,CAAC;MACjC;MACA,OAAO,CAAC,MAAMH,eAAe,CAAC,CAAC,EAAEE,OAAO,CAACC,GAAG,CAAC;IAC/C,CAAC;IACDE,OAAO,EAAE,MAAAA,CAAOF,GAAG,EAAEG,KAAK,KAAK;MAC7B,MAAMF,MAAM,GAAG,MAAMlB,eAAe,CAAC,CAAC;MACtC,IAAIkB,MAAM,EAAE;QACV,MAAMA,MAAM,CAACV,YAAY,CAACS,GAAG,EAAEG,KAAK,CAAC;QACrC;MACF;MACA,MAAM,CAAC,MAAMN,eAAe,CAAC,CAAC,EAAEK,OAAO,CAACF,GAAG,EAAEG,KAAK,CAAC;IACrD,CAAC;IACDC,UAAU,EAAE,MAAOJ,GAAG,IAAK;MACzB,MAAMC,MAAM,GAAG,MAAMlB,eAAe,CAAC,CAAC;MACtC,IAAIkB,MAAM,EAAE;QACV,MAAMA,MAAM,CAACT,eAAe,CAACQ,GAAG,CAAC;QACjC;MACF;MACA,MAAM,CAAC,MAAMH,eAAe,CAAC,CAAC,EAAEO,UAAU,CAACJ,GAAG,CAAC;IACjD;EACF,CAAC;AACH","ignoreList":[]}
@@ -27,10 +27,20 @@ var _core = require("@oxyhq/core");
27
27
  *
28
28
  * A failure is logged and swallowed: this method must never throw out (it runs
29
29
  * inside the socket state handler).
30
+ *
31
+ * `getPinnedAccountId` is the identity-bound escape hatch. Converging the bearer
32
+ * on `state.activeAccountId` is precisely what an identity-bound client must
33
+ * never do — its token is minted for the PINNED account by the cold boot /
34
+ * re-mint lane. `SessionClient` already bypasses the transport entirely while
35
+ * pinned; this guard is the services-side half of that contract, so no future
36
+ * wiring can reintroduce the convergence from this end.
30
37
  */
31
- function createTokenTransport(oxyServices) {
38
+ function createTokenTransport(oxyServices, getPinnedAccountId) {
32
39
  return {
33
40
  async ensureActiveToken(state) {
41
+ if ((getPinnedAccountId?.() ?? null) !== null) {
42
+ return;
43
+ }
34
44
  try {
35
45
  // Skip the mint ONLY when the planted bearer already identifies the
36
46
  // active account. `getCurrentUserId()` decodes the bearer's `userId`/`id`
@@ -1 +1 @@
1
- {"version":3,"names":["_core","require","createTokenTransport","oxyServices","ensureActiveToken","state","activeAccountId","getCurrentUserId","error","logger","warn","component","token","httpService","refreshAccessToken","debug","deviceId"],"sourceRoot":"../../../../src","sources":["ui/session/tokenTransport.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,oBAAoBA,CAACC,WAAwB,EAAkB;EAC7E,OAAO;IACL,MAAMC,iBAAiBA,CAACC,KAAyB,EAAiB;MAChE,IAAI;QACF;QACA;QACA;QACA,MAAMC,eAAe,GAAGD,KAAK,CAACC,eAAe;QAC7C,IAAIA,eAAe,KAAK,IAAI,IAAIH,WAAW,CAACI,gBAAgB,CAAC,CAAC,KAAKD,eAAe,EAAE;UAClF;QACF;MACF,CAAC,CAAC,OAAOE,KAAK,EAAE;QACdC,YAAM,CAACC,IAAI,CAAC,+CAA+C,EAAE;UAAEC,SAAS,EAAE;QAAiB,CAAC,EAAEH,KAAK,CAAC;MACtG;MAEA,IAAI;QACF;QACA;QACA,MAAMI,KAAK,GAAG,MAAMT,WAAW,CAACU,WAAW,CAACC,kBAAkB,CAAC,WAAW,CAAC;QAC3E,IAAI,CAACF,KAAK,EAAE;UACVH,YAAM,CAACM,KAAK,CAAC,gDAAgD,EAAE;YAC7DJ,SAAS,EAAE,gBAAgB;YAC3BK,QAAQ,EAAEX,KAAK,CAACW;UAClB,CAAC,CAAC;QACJ;MACF,CAAC,CAAC,OAAOR,KAAK,EAAE;QACdC,YAAM,CAACC,IAAI,CAAC,mCAAmC,EAAE;UAAEC,SAAS,EAAE;QAAiB,CAAC,EAAEH,KAAK,CAAC;MAC1F;IACF;EACF,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["_core","require","createTokenTransport","oxyServices","getPinnedAccountId","ensureActiveToken","state","activeAccountId","getCurrentUserId","error","logger","warn","component","token","httpService","refreshAccessToken","debug","deviceId"],"sourceRoot":"../../../../src","sources":["ui/session/tokenTransport.ts"],"mappings":";;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,oBAAoBA,CAClCC,WAAwB,EACxBC,kBAAwC,EACxB;EAChB,OAAO;IACL,MAAMC,iBAAiBA,CAACC,KAAyB,EAAiB;MAChE,IAAI,CAACF,kBAAkB,GAAG,CAAC,IAAI,IAAI,MAAM,IAAI,EAAE;QAC7C;MACF;MACA,IAAI;QACF;QACA;QACA;QACA,MAAMG,eAAe,GAAGD,KAAK,CAACC,eAAe;QAC7C,IAAIA,eAAe,KAAK,IAAI,IAAIJ,WAAW,CAACK,gBAAgB,CAAC,CAAC,KAAKD,eAAe,EAAE;UAClF;QACF;MACF,CAAC,CAAC,OAAOE,KAAK,EAAE;QACdC,YAAM,CAACC,IAAI,CAAC,+CAA+C,EAAE;UAAEC,SAAS,EAAE;QAAiB,CAAC,EAAEH,KAAK,CAAC;MACtG;MAEA,IAAI;QACF;QACA;QACA,MAAMI,KAAK,GAAG,MAAMV,WAAW,CAACW,WAAW,CAACC,kBAAkB,CAAC,WAAW,CAAC;QAC3E,IAAI,CAACF,KAAK,EAAE;UACVH,YAAM,CAACM,KAAK,CAAC,gDAAgD,EAAE;YAC7DJ,SAAS,EAAE,gBAAgB;YAC3BK,QAAQ,EAAEX,KAAK,CAACW;UAClB,CAAC,CAAC;QACJ;MACF,CAAC,CAAC,OAAOR,KAAK,EAAE;QACdC,YAAM,CAACC,IAAI,CAAC,mCAAmC,EAAE;UAAEC,SAAS,EAAE;QAAiB,CAAC,EAAEH,KAAK,CAAC;MAC1F;IACF;EACF,CAAC;AACH","ignoreList":[]}
@@ -85,10 +85,10 @@ async function maybeStartSilentOAuthRestore(opts) {
85
85
  codeChallenge
86
86
  } = await (0, _core.generatePkcePair)();
87
87
  const state = await (0, _core.generateOAuthState)();
88
- if (!(0, _core.persistOAuthHandshake)(state, codeVerifier)) {
88
+ const redirectUri = (0, _core.canonicalizeOAuthRedirectUri)(opts.redirectUri ?? location.origin);
89
+ if (!(0, _core.persistOAuthHandshake)(state, codeVerifier, redirectUri)) {
89
90
  return false;
90
91
  }
91
- const redirectUri = (0, _core.normalizeOAuthRedirectUri)(opts.redirectUri ?? location.origin);
92
92
  const authorizeUrl = (0, _core.buildOAuthAuthorizeUrl)({
93
93
  authorizeBaseUrl: opts.authorizeBaseUrl,
94
94
  clientId: opts.clientId,
@@ -134,6 +134,7 @@ function consumeSilentOAuthError() {
134
134
  // redirected to.
135
135
  (0, _oauthReturn.replaceUrlAfterOAuthReturn)(`${url.pathname}${url.search}${url.hash}`);
136
136
  }
137
+ (0, _core.clearOAuthHandshake)();
137
138
  return error;
138
139
  }
139
140
  //# sourceMappingURL=crossOriginRestore.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_core","require","_isWebBrowser","_oauthReturn","_oauthNavigation","sessionStore","globalThis","sessionStorage","isCrossOriginRestoreBlocked","store","Boolean","getItem","OXY_CROSS_ORIGIN_RESTORE_ATTEMPTED_KEY","OXY_SILENT_OAUTH_ATTEMPTED_KEY","markCrossOriginRestoreAttempted","setItem","clearCrossOriginRestoreGuards","key","removeItem","isSilentRestoreEligibleOrigin","origin","isLoopbackOrigin","isIdpHubOrigin","isOfficialWebOrigin","maybeStartSilentOAuthRestore","opts","isWebBrowser","location","params","URLSearchParams","search","has","codeVerifier","codeChallenge","generatePkcePair","state","generateOAuthState","persistOAuthHandshake","redirectUri","normalizeOAuthRedirectUri","authorizeUrl","buildOAuthAuthorizeUrl","authorizeBaseUrl","clientId","scope","prompt","redirectToAuthorize","error","logger","warn","component","consumeSilentOAuthError","history","get","replaceState","url","URL","href","searchParams","delete","replaceUrlAfterOAuthReturn","pathname","hash"],"sourceRoot":"../../../../src","sources":["ui/utils/crossOriginRestore.ts"],"mappings":";;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AAaA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAH,OAAA;AAEA,SAASI,YAAYA,CAAA,EAAwB;EAC3C,OAAQC,UAAU,CAAkCC,cAAc;AACpE;;AAEA;AACO,SAASC,2BAA2BA,CAAA,EAAY;EACrD,MAAMC,KAAK,GAAGJ,YAAY,CAAC,CAAC;EAC5B,IAAI,CAACI,KAAK,EAAE,OAAO,KAAK;EACxB,OAAOC,OAAO,CACZD,KAAK,CAACE,OAAO,CAACC,4CAAsC,CAAC,IACnDH,KAAK,CAACE,OAAO,CAACE,oCAA8B,CAChD,CAAC;AACH;;AAEA;AACO,SAASC,+BAA+BA,CAAA,EAAS;EACtD,MAAML,KAAK,GAAGJ,YAAY,CAAC,CAAC;EAC5B,IAAI,CAACI,KAAK,EAAE;EACZA,KAAK,CAACM,OAAO,CAACH,4CAAsC,EAAE,GAAG,CAAC;EAC1DH,KAAK,CAACM,OAAO,CAACF,oCAA8B,EAAE,G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C,+BAA+B,CAAC,CAAC;EAEjC,IAAIsC,OAAO,EAAEE,YAAY,EAAE;IACzB,MAAMC,GAAG,GAAG,IAAIC,GAAG,CAAC7B,QAAQ,CAAC8B,IAAI,CAAC;IAClCF,GAAG,CAACG,YAAY,CAACC,MAAM,CAAC,OAAO,CAAC;IAChCJ,GAAG,CAACG,YAAY,CAACC,MAAM,CAAC,mBAAmB,CAAC;IAC5CJ,GAAG,CAACG,YAAY,CAACC,MAAM,CAAC,OAAO,CAAC;IAChC;IACA;IACA;IACA,IAAAC,uCAA0B,EAAC,GAAGL,GAAG,CAACM,QAAQ,GAAGN,GAAG,CAACzB,MAAM,GAAGyB,GAAG,CAACO,IAAI,EAAE,CAAC;EACvE;EACA,OAAOf,KAAK;AACd","ignoreList":[]}
1
+ {"version":3,"names":["_core","require","_isWebBrowser","_oauthReturn","_oauthNavigation","sessionStore","globalThis","sessionStorage","isCrossOriginRestoreBlocked","store","Boolean","getItem","OXY_CROSS_ORIGIN_RESTORE_ATTEMPTED_KEY","OXY_SILENT_OAUTH_ATTEMPTED_KEY","markCrossOriginRestoreAttempted","setItem","clearCrossOriginRestoreGuards","key","removeItem","isSilentRestoreEligibleOrigin","origin","isLoopbackOrigin","isIdpHubOrigin","isOfficialWebOrigin","maybeStartSilentOAuthRestore","opts","isWebBrowser","location","params","URLSearchParams","search","has","codeVerifier","codeChallenge","generatePkcePair","state","generateOAuthState","redirectUri","canonicalizeOAuthRedirectUri","persistOAuthHandshake","authorizeUrl","buildOAuthAuthorizeUrl","authorizeBaseUrl","clientId","scope","prompt","redirectToAuthorize","error","logger","warn","component","consumeSilentOAuthError","history","get","replaceState","url","URL","href","searchParams","delete","replaceUrlAfterOAuthReturn","pathname","hash","clearOAuthHandshake"],"sourceRoot":"../../../../src","sources":["ui/utils/crossOriginRestore.ts"],"mappings":";;;;;;;;;;;AACA,IAAAA,KAAA,GAAAC,OAAA;AAcA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GA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AAC,8BAA8B,EAAE;MAAEC,SAAS,EAAE;IAAqB,CAAC,EAAEH,KAAK,CAAC;IACvF,OAAO,KAAK;EACd;AACF;;AAEA;AACA;AACA;AACA;AACO,SAASI,uBAAuBA,CAAA,EAAiD;EACtF,IAAI,CAAC,IAAAzB,0BAAY,EAAC,CAAC,EAAE,OAAO,IAAI;EAChC,MAAMC,QAAQ,GAAIrB,UAAU,CAAgDqB,QAAQ;EACpF,MAAMyB,OAAO,GAAI9C,UAAU,CAA2B8C,OAAO;EAC7D,IAAI,CAACzB,QAAQ,EAAE,OAAO,IAAI;EAE1B,MAAMC,MAAM,GAAG,IAAIC,eAAe,CAACF,QAAQ,CAACG,MAAM,CAAC;EACnD,MAAMiB,KAAK,GAAGnB,MAAM,CAACyB,GAAG,CAAC,OAAO,CAAC;EACjC,IAAIN,KAAK,KAAK,gBAAgB,IAAIA,KAAK,KAAK,kBAAkB,EAAE;IAC9D,OAAO,IAAI;EACb;EAEAjC,+BAA+B,CAAC,CAAC;EAEjC,IAAIsC,OAAO,EAAEE,YAAY,EAAE;IACzB,MAAMC,GAAG,GAAG,IAAIC,GAAG,CAAC7B,QAAQ,CAAC8B,IAAI,CAAC;IAClCF,GAAG,CAACG,YAAY,CAACC,MAAM,CAAC,OAAO,CAAC;IAChCJ,GAAG,CAACG,YAAY,CAACC,MAAM,CAAC,mBAAmB,CAAC;IAC5CJ,GAAG,CAACG,YAAY,CAACC,MAAM,CAAC,OAAO,CAAC;IAChC;IACA;IACA;IACA,IAAAC,uCAA0B,EAAC,GAAGL,GAAG,CAACM,QAAQ,GAAGN,GAAG,CAACzB,MAAM,GAAGyB,GAAG,CAACO,IAAI,EAAE,CAAC;EACvE;EACA,IAAAC,yBAAmB,EAAC,CAAC;EACrB,OAAOhB,KAAK;AACd","ignoreList":[]}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.resolveDeliveryPlatform = resolveDeliveryPlatform;
7
+ var _isWebBrowser = require("./isWebBrowser.js");
8
+ /**
9
+ * Classify the surface a "Sign in with Oxy" request is initiated from, for
10
+ * `AccountDialogController`'s `platform` option (issue #691, Phase 4/5).
11
+ *
12
+ * `@oxyhq/core` deliberately refuses to do this itself — it never touches a
13
+ * platform global — so the consumer that OWNS the environment classifies it and
14
+ * hands the verdict in. The verdict feeds `selectCommonsDelivery`, where it
15
+ * decides one thing only: whether this device may take the `'open-commons'`
16
+ * deep-link route. Getting it wrong in the "mobile" direction is the costly
17
+ * error (a custom-scheme navigation that does not resolve is a dead end with no
18
+ * automatic way back), so every ambiguous signal resolves AWAY from `'mobile'`.
19
+ *
20
+ * No user-agent string is parsed. The two signals used are declarative and
21
+ * standardized:
22
+ * 1. `navigator.userAgentData.mobile` — the User-Agent Client Hints boolean.
23
+ * Authoritative where implemented (Chromium), in both directions.
24
+ * 2. The PRIMARY pointer (`(pointer: coarse)`) plus a touch digitizer.
25
+ * A phone/tablet reports a coarse primary pointer; a touchscreen laptop
26
+ * still reports its mouse as primary, so it is not misclassified.
27
+ */
28
+
29
+ /**
30
+ * The `navigator.userAgentData` slice this module reads. Declared locally
31
+ * because `NavigatorUAData` is not in TypeScript's DOM lib yet; only the one
32
+ * field consumed here is modelled, and it stays optional so an implementation
33
+ * without it is simply "no answer" rather than a type lie.
34
+ */
35
+
36
+ /**
37
+ * Which surface this app is running on, as `selectCommonsDelivery` models it.
38
+ *
39
+ * - Native (Expo/RN) is always `'mobile'`: it is an Oxy app installed on a
40
+ * phone/tablet, exactly the case where a verified Commons link can resolve
41
+ * on this very device.
42
+ * - A web browser is classified from the signals above.
43
+ * - Anything else — a browser-like environment with neither signal — is
44
+ * `'unknown'`, a first-class value that never opts into the deep link.
45
+ */
46
+ function resolveDeliveryPlatform() {
47
+ if (!(0, _isWebBrowser.isWebBrowser)()) return 'mobile';
48
+ const nav = typeof navigator === 'undefined' ? undefined : navigator;
49
+ const uaMobile = nav?.userAgentData?.mobile;
50
+ if (typeof uaMobile === 'boolean') return uaMobile ? 'mobile' : 'desktop';
51
+ if (typeof window !== 'undefined' && typeof window.matchMedia === 'function') {
52
+ const coarsePrimaryPointer = window.matchMedia('(pointer: coarse)').matches;
53
+ const hasTouchDigitizer = (nav?.maxTouchPoints ?? 0) > 0;
54
+ return coarsePrimaryPointer && hasTouchDigitizer ? 'mobile' : 'desktop';
55
+ }
56
+ return 'unknown';
57
+ }
58
+ //# sourceMappingURL=deliveryPlatform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_isWebBrowser","require","resolveDeliveryPlatform","isWebBrowser","nav","navigator","undefined","uaMobile","userAgentData","mobile","window","matchMedia","coarsePrimaryPointer","matches","hasTouchDigitizer","maxTouchPoints"],"sourceRoot":"../../../../src","sources":["ui/utils/deliveryPlatform.ts"],"mappings":";;;;;;AAsBA,IAAAA,aAAA,GAAAC,OAAA;AAtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASC,uBAAuBA,CAAA,EAA4B;EACjE,IAAI,CAAC,IAAAC,0BAAY,EAAC,CAAC,EAAE,OAAO,QAAQ;EAEpC,MAAMC,GAA2C,GAC/C,OAAOC,SAAS,KAAK,WAAW,GAAGC,SAAS,GAAGD,SAAS;EAE1D,MAAME,QAAQ,GAAGH,GAAG,EAAEI,aAAa,EAAEC,MAAM;EAC3C,IAAI,OAAOF,QAAQ,KAAK,SAAS,EAAE,OAAOA,QAAQ,GAAG,QAAQ,GAAG,SAAS;EAEzE,IAAI,OAAOG,MAAM,KAAK,WAAW,IAAI,OAAOA,MAAM,CAACC,UAAU,KAAK,UAAU,EAAE;IAC5E,MAAMC,oBAAoB,GAAGF,MAAM,CAACC,UAAU,CAAC,mBAAmB,CAAC,CAACE,OAAO;IAC3E,MAAMC,iBAAiB,GAAG,CAACV,GAAG,EAAEW,cAAc,IAAI,CAAC,IAAI,CAAC;IACxD,OAAOH,oBAAoB,IAAIE,iBAAiB,GAAG,QAAQ,GAAG,SAAS;EACzE;EAEA,OAAO,SAAS;AAClB","ignoreList":[]}