@oxy.so/services 4.0.7 → 6.1.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 (403) hide show
  1. package/README.md +2 -2
  2. package/lib/commonjs/assets/assets/signIn/slide-1.jpg +0 -0
  3. package/lib/commonjs/assets/assets/signIn/slide-1.jpg.d.ts +3 -0
  4. package/lib/commonjs/assets/assets/signIn/slide-2.jpg +0 -0
  5. package/lib/commonjs/assets/assets/signIn/slide-2.jpg.d.ts +3 -0
  6. package/lib/commonjs/assets/assets/signIn/slide-3.jpg +0 -0
  7. package/lib/commonjs/assets/assets/signIn/slide-3.jpg.d.ts +3 -0
  8. package/lib/commonjs/assets/assets/signIn/slide-4.jpg +0 -0
  9. package/lib/commonjs/assets/assets/signIn/slide-4.jpg.d.ts +3 -0
  10. package/lib/commonjs/assets/signIn/slide-1.jpg +0 -0
  11. package/lib/commonjs/assets/signIn/slide-2.jpg +0 -0
  12. package/lib/commonjs/assets/signIn/slide-3.jpg +0 -0
  13. package/lib/commonjs/assets/signIn/slide-4.jpg +0 -0
  14. package/lib/commonjs/index.js +77 -8
  15. package/lib/commonjs/index.js.map +1 -1
  16. package/lib/commonjs/ui/components/OxyAccountDialogScreen.js +11 -58
  17. package/lib/commonjs/ui/components/OxyAccountDialogScreen.js.map +1 -1
  18. package/lib/commonjs/ui/components/OxyAuthChooser.js +36 -45
  19. package/lib/commonjs/ui/components/OxyAuthChooser.js.map +1 -1
  20. package/lib/commonjs/ui/components/OxyProvider.js +0 -2
  21. package/lib/commonjs/ui/components/OxyProvider.js.map +1 -1
  22. package/lib/commonjs/ui/components/ProfileButton.js.map +1 -1
  23. package/lib/commonjs/ui/components/authChooser/AccountsMenuView.js +30 -16
  24. package/lib/commonjs/ui/components/authChooser/AccountsMenuView.js.map +1 -1
  25. package/lib/commonjs/ui/components/authChooser/primitives.js +7 -52
  26. package/lib/commonjs/ui/components/authChooser/primitives.js.map +1 -1
  27. package/lib/commonjs/ui/components/authChooser/signInFailureMessage.js +1 -7
  28. package/lib/commonjs/ui/components/authChooser/signInFailureMessage.js.map +1 -1
  29. package/lib/commonjs/ui/components/authChooser/styles.js +0 -31
  30. package/lib/commonjs/ui/components/authChooser/styles.js.map +1 -1
  31. package/lib/commonjs/ui/components/authChooser/types.js +2 -2
  32. package/lib/commonjs/ui/components/authChooser/types.js.map +1 -1
  33. package/lib/commonjs/ui/components/oauthNavigation.js +1 -1
  34. package/lib/commonjs/ui/components/signIn/InlineCommonsQr.js +161 -0
  35. package/lib/commonjs/ui/components/signIn/InlineCommonsQr.js.map +1 -0
  36. package/lib/commonjs/ui/components/signIn/OxyAccountPicker.js +111 -0
  37. package/lib/commonjs/ui/components/signIn/OxyAccountPicker.js.map +1 -0
  38. package/lib/commonjs/ui/components/signIn/OxyAuthScreen.js +160 -0
  39. package/lib/commonjs/ui/components/signIn/OxyAuthScreen.js.map +1 -0
  40. package/lib/commonjs/ui/components/signIn/OxyCreateAccountPanel.js +236 -0
  41. package/lib/commonjs/ui/components/signIn/OxyCreateAccountPanel.js.map +1 -0
  42. package/lib/commonjs/ui/components/signIn/OxyDeleteAccountPanel.js +114 -0
  43. package/lib/commonjs/ui/components/signIn/OxyDeleteAccountPanel.js.map +1 -0
  44. package/lib/commonjs/ui/components/signIn/OxyLinkCommonsPanel.js +275 -0
  45. package/lib/commonjs/ui/components/signIn/OxyLinkCommonsPanel.js.map +1 -0
  46. package/lib/commonjs/ui/components/signIn/OxyRecoverAccountPanel.js +170 -0
  47. package/lib/commonjs/ui/components/signIn/OxyRecoverAccountPanel.js.map +1 -0
  48. package/lib/commonjs/ui/components/signIn/OxySignInPanel.js +371 -0
  49. package/lib/commonjs/ui/components/signIn/OxySignInPanel.js.map +1 -0
  50. package/lib/commonjs/ui/components/signIn/OxySignUpPanel.js +78 -0
  51. package/lib/commonjs/ui/components/signIn/OxySignUpPanel.js.map +1 -0
  52. package/lib/commonjs/ui/components/signIn/accountFlowParts.js +244 -0
  53. package/lib/commonjs/ui/components/signIn/accountFlowParts.js.map +1 -0
  54. package/lib/commonjs/ui/components/signIn/artwork.js +21 -0
  55. package/lib/commonjs/ui/components/signIn/artwork.js.map +1 -0
  56. package/lib/commonjs/ui/components/signIn/passkeyError.js +46 -0
  57. package/lib/commonjs/ui/components/signIn/passkeyError.js.map +1 -0
  58. package/lib/commonjs/ui/components/signIn/signInMethods.js +46 -0
  59. package/lib/commonjs/ui/components/signIn/signInMethods.js.map +1 -0
  60. package/lib/commonjs/ui/context/OxyContext.js +16 -16
  61. package/lib/commonjs/ui/context/OxyContext.js.map +1 -1
  62. package/lib/commonjs/ui/context/commitSessionFlow.js +0 -43
  63. package/lib/commonjs/ui/context/commitSessionFlow.js.map +1 -1
  64. package/lib/commonjs/ui/context/passkeyFlow.js +22 -0
  65. package/lib/commonjs/ui/context/passkeyFlow.js.map +1 -1
  66. package/lib/commonjs/ui/hooks/accountDialogSnapshot.js +15 -1
  67. package/lib/commonjs/ui/hooks/accountDialogSnapshot.js.map +1 -1
  68. package/lib/commonjs/ui/hooks/useDeviceSwitcher.js +1 -3
  69. package/lib/commonjs/ui/hooks/useDeviceSwitcher.js.map +1 -1
  70. package/lib/commonjs/ui/oauth/browserAuthTransport.js +11 -4
  71. package/lib/commonjs/ui/oauth/browserAuthTransport.js.map +1 -1
  72. package/lib/commonjs/ui/oauth/oauthHandshake.js +3 -0
  73. package/lib/commonjs/ui/oauth/oauthHandshake.js.map +1 -1
  74. package/lib/commonjs/ui/oauth/oauthPopup.js +2 -3
  75. package/lib/commonjs/ui/oauth/oauthPopup.js.map +1 -1
  76. package/lib/commonjs/ui/screens/EditProfileFieldScreen.js +0 -23
  77. package/lib/commonjs/ui/screens/EditProfileFieldScreen.js.map +1 -1
  78. package/lib/commonjs/ui/screens/EditProfileScreen.js +0 -8
  79. package/lib/commonjs/ui/screens/EditProfileScreen.js.map +1 -1
  80. package/lib/commonjs/ui/screens/ManageAccountScreen.js +3 -4
  81. package/lib/commonjs/ui/screens/ManageAccountScreen.js.map +1 -1
  82. package/lib/commonjs/ui/screens/trust/TrustLeaderboardScreen.js +1 -1
  83. package/lib/commonjs/ui/screens/trust/TrustLeaderboardScreen.js.map +1 -1
  84. package/lib/commonjs/ui/session/authStore.js +0 -21
  85. package/lib/commonjs/ui/session/authStore.js.map +1 -1
  86. package/lib/commonjs/ui/utils/accountDeletionHandoff.js +2 -2
  87. package/lib/commonjs/ui/utils/accountDeletionHandoff.js.map +1 -1
  88. package/lib/module/assets/assets/signIn/slide-1.jpg +0 -0
  89. package/lib/module/assets/assets/signIn/slide-1.jpg.d.ts +3 -0
  90. package/lib/module/assets/assets/signIn/slide-2.jpg +0 -0
  91. package/lib/module/assets/assets/signIn/slide-2.jpg.d.ts +3 -0
  92. package/lib/module/assets/assets/signIn/slide-3.jpg +0 -0
  93. package/lib/module/assets/assets/signIn/slide-3.jpg.d.ts +3 -0
  94. package/lib/module/assets/assets/signIn/slide-4.jpg +0 -0
  95. package/lib/module/assets/assets/signIn/slide-4.jpg.d.ts +3 -0
  96. package/lib/module/assets/signIn/slide-1.jpg +0 -0
  97. package/lib/module/assets/signIn/slide-2.jpg +0 -0
  98. package/lib/module/assets/signIn/slide-3.jpg +0 -0
  99. package/lib/module/assets/signIn/slide-4.jpg +0 -0
  100. package/lib/module/index.js +14 -6
  101. package/lib/module/index.js.map +1 -1
  102. package/lib/module/ui/components/OxyAccountDialogScreen.js +14 -59
  103. package/lib/module/ui/components/OxyAccountDialogScreen.js.map +1 -1
  104. package/lib/module/ui/components/OxyAuthChooser.js +37 -46
  105. package/lib/module/ui/components/OxyAuthChooser.js.map +1 -1
  106. package/lib/module/ui/components/OxyProvider.js +0 -2
  107. package/lib/module/ui/components/OxyProvider.js.map +1 -1
  108. package/lib/module/ui/components/ProfileButton.js.map +1 -1
  109. package/lib/module/ui/components/authChooser/AccountsMenuView.js +22 -10
  110. package/lib/module/ui/components/authChooser/AccountsMenuView.js.map +1 -1
  111. package/lib/module/ui/components/authChooser/primitives.js +1 -44
  112. package/lib/module/ui/components/authChooser/primitives.js.map +1 -1
  113. package/lib/module/ui/components/authChooser/signInFailureMessage.js +1 -7
  114. package/lib/module/ui/components/authChooser/signInFailureMessage.js.map +1 -1
  115. package/lib/module/ui/components/authChooser/styles.js +0 -31
  116. package/lib/module/ui/components/authChooser/styles.js.map +1 -1
  117. package/lib/module/ui/components/authChooser/types.js +2 -2
  118. package/lib/module/ui/components/authChooser/types.js.map +1 -1
  119. package/lib/module/ui/components/oauthNavigation.js +1 -1
  120. package/lib/module/ui/components/signIn/InlineCommonsQr.js +157 -0
  121. package/lib/module/ui/components/signIn/InlineCommonsQr.js.map +1 -0
  122. package/lib/module/ui/components/signIn/OxyAccountPicker.js +106 -0
  123. package/lib/module/ui/components/signIn/OxyAccountPicker.js.map +1 -0
  124. package/lib/module/ui/components/signIn/OxyAuthScreen.js +151 -0
  125. package/lib/module/ui/components/signIn/OxyAuthScreen.js.map +1 -0
  126. package/lib/module/ui/components/signIn/OxyCreateAccountPanel.js +231 -0
  127. package/lib/module/ui/components/signIn/OxyCreateAccountPanel.js.map +1 -0
  128. package/lib/module/ui/components/signIn/OxyDeleteAccountPanel.js +109 -0
  129. package/lib/module/ui/components/signIn/OxyDeleteAccountPanel.js.map +1 -0
  130. package/lib/module/ui/components/signIn/OxyLinkCommonsPanel.js +270 -0
  131. package/lib/module/ui/components/signIn/OxyLinkCommonsPanel.js.map +1 -0
  132. package/lib/module/ui/components/signIn/OxyRecoverAccountPanel.js +165 -0
  133. package/lib/module/ui/components/signIn/OxyRecoverAccountPanel.js.map +1 -0
  134. package/lib/module/ui/components/signIn/OxySignInPanel.js +366 -0
  135. package/lib/module/ui/components/signIn/OxySignInPanel.js.map +1 -0
  136. package/lib/module/ui/components/signIn/OxySignUpPanel.js +75 -0
  137. package/lib/module/ui/components/signIn/OxySignUpPanel.js.map +1 -0
  138. package/lib/module/ui/components/signIn/accountFlowParts.js +235 -0
  139. package/lib/module/ui/components/signIn/accountFlowParts.js.map +1 -0
  140. package/lib/module/ui/components/signIn/artwork.js +16 -0
  141. package/lib/module/ui/components/signIn/artwork.js.map +1 -0
  142. package/lib/module/ui/components/signIn/passkeyError.js +40 -0
  143. package/lib/module/ui/components/signIn/passkeyError.js.map +1 -0
  144. package/lib/module/ui/components/signIn/signInMethods.js +42 -0
  145. package/lib/module/ui/components/signIn/signInMethods.js.map +1 -0
  146. package/lib/module/ui/context/OxyContext.js +17 -17
  147. package/lib/module/ui/context/OxyContext.js.map +1 -1
  148. package/lib/module/ui/context/commitSessionFlow.js +0 -42
  149. package/lib/module/ui/context/commitSessionFlow.js.map +1 -1
  150. package/lib/module/ui/context/passkeyFlow.js +21 -0
  151. package/lib/module/ui/context/passkeyFlow.js.map +1 -1
  152. package/lib/module/ui/hooks/accountDialogSnapshot.js +14 -1
  153. package/lib/module/ui/hooks/accountDialogSnapshot.js.map +1 -1
  154. package/lib/module/ui/hooks/useDeviceSwitcher.js +3 -5
  155. package/lib/module/ui/hooks/useDeviceSwitcher.js.map +1 -1
  156. package/lib/module/ui/oauth/browserAuthTransport.js +11 -4
  157. package/lib/module/ui/oauth/browserAuthTransport.js.map +1 -1
  158. package/lib/module/ui/oauth/oauthHandshake.js +3 -0
  159. package/lib/module/ui/oauth/oauthHandshake.js.map +1 -1
  160. package/lib/module/ui/oauth/oauthPopup.js +2 -3
  161. package/lib/module/ui/oauth/oauthPopup.js.map +1 -1
  162. package/lib/module/ui/screens/EditProfileFieldScreen.js +1 -24
  163. package/lib/module/ui/screens/EditProfileFieldScreen.js.map +1 -1
  164. package/lib/module/ui/screens/EditProfileScreen.js +0 -8
  165. package/lib/module/ui/screens/EditProfileScreen.js.map +1 -1
  166. package/lib/module/ui/screens/ManageAccountScreen.js +4 -5
  167. package/lib/module/ui/screens/ManageAccountScreen.js.map +1 -1
  168. package/lib/module/ui/screens/trust/TrustLeaderboardScreen.js +1 -1
  169. package/lib/module/ui/screens/trust/TrustLeaderboardScreen.js.map +1 -1
  170. package/lib/module/ui/session/authStore.js +1 -22
  171. package/lib/module/ui/session/authStore.js.map +1 -1
  172. package/lib/module/ui/utils/accountDeletionHandoff.js +3 -3
  173. package/lib/module/ui/utils/accountDeletionHandoff.js.map +1 -1
  174. package/lib/typescript/assets/signIn/slide-1.jpg.d.ts +3 -0
  175. package/lib/typescript/assets/signIn/slide-2.jpg.d.ts +3 -0
  176. package/lib/typescript/assets/signIn/slide-3.jpg.d.ts +3 -0
  177. package/lib/typescript/assets/signIn/slide-4.jpg.d.ts +3 -0
  178. package/lib/typescript/commonjs/index.d.ts +16 -2
  179. package/lib/typescript/commonjs/index.d.ts.map +1 -1
  180. package/lib/typescript/commonjs/ui/components/OxyAccountDialogScreen.d.ts.map +1 -1
  181. package/lib/typescript/commonjs/ui/components/OxyAuthChooser.d.ts +5 -12
  182. package/lib/typescript/commonjs/ui/components/OxyAuthChooser.d.ts.map +1 -1
  183. package/lib/typescript/commonjs/ui/components/OxyProvider.d.ts.map +1 -1
  184. package/lib/typescript/commonjs/ui/components/ProfileButton.d.ts +1 -1
  185. package/lib/typescript/commonjs/ui/components/ProfileButton.d.ts.map +1 -1
  186. package/lib/typescript/commonjs/ui/components/authChooser/AccountsMenuView.d.ts.map +1 -1
  187. package/lib/typescript/commonjs/ui/components/authChooser/primitives.d.ts +0 -19
  188. package/lib/typescript/commonjs/ui/components/authChooser/primitives.d.ts.map +1 -1
  189. package/lib/typescript/commonjs/ui/components/authChooser/signInFailureMessage.d.ts +1 -5
  190. package/lib/typescript/commonjs/ui/components/authChooser/signInFailureMessage.d.ts.map +1 -1
  191. package/lib/typescript/commonjs/ui/components/authChooser/styles.d.ts +0 -31
  192. package/lib/typescript/commonjs/ui/components/authChooser/styles.d.ts.map +1 -1
  193. package/lib/typescript/commonjs/ui/components/authChooser/types.d.ts +2 -7
  194. package/lib/typescript/commonjs/ui/components/authChooser/types.d.ts.map +1 -1
  195. package/lib/typescript/commonjs/ui/components/oauthNavigation.d.ts +1 -1
  196. package/lib/typescript/commonjs/ui/components/signIn/InlineCommonsQr.d.ts +20 -0
  197. package/lib/typescript/commonjs/ui/components/signIn/InlineCommonsQr.d.ts.map +1 -0
  198. package/lib/typescript/commonjs/ui/components/signIn/OxyAccountPicker.d.ts +34 -0
  199. package/lib/typescript/commonjs/ui/components/signIn/OxyAccountPicker.d.ts.map +1 -0
  200. package/lib/typescript/commonjs/ui/components/signIn/OxyAuthScreen.d.ts +43 -0
  201. package/lib/typescript/commonjs/ui/components/signIn/OxyAuthScreen.d.ts.map +1 -0
  202. package/lib/typescript/commonjs/ui/components/signIn/OxyCreateAccountPanel.d.ts +24 -0
  203. package/lib/typescript/commonjs/ui/components/signIn/OxyCreateAccountPanel.d.ts.map +1 -0
  204. package/lib/typescript/commonjs/ui/components/signIn/OxyDeleteAccountPanel.d.ts +16 -0
  205. package/lib/typescript/commonjs/ui/components/signIn/OxyDeleteAccountPanel.d.ts.map +1 -0
  206. package/lib/typescript/commonjs/ui/components/signIn/OxyLinkCommonsPanel.d.ts +21 -0
  207. package/lib/typescript/commonjs/ui/components/signIn/OxyLinkCommonsPanel.d.ts.map +1 -0
  208. package/lib/typescript/commonjs/ui/components/signIn/OxyRecoverAccountPanel.d.ts +20 -0
  209. package/lib/typescript/commonjs/ui/components/signIn/OxyRecoverAccountPanel.d.ts.map +1 -0
  210. package/lib/typescript/commonjs/ui/components/signIn/OxySignInPanel.d.ts +43 -0
  211. package/lib/typescript/commonjs/ui/components/signIn/OxySignInPanel.d.ts.map +1 -0
  212. package/lib/typescript/commonjs/ui/components/signIn/OxySignUpPanel.d.ts +17 -0
  213. package/lib/typescript/commonjs/ui/components/signIn/OxySignUpPanel.d.ts.map +1 -0
  214. package/lib/typescript/commonjs/ui/components/signIn/accountFlowParts.d.ts +60 -0
  215. package/lib/typescript/commonjs/ui/components/signIn/accountFlowParts.d.ts.map +1 -0
  216. package/lib/typescript/commonjs/ui/components/signIn/artwork.d.ts +8 -0
  217. package/lib/typescript/commonjs/ui/components/signIn/artwork.d.ts.map +1 -0
  218. package/lib/typescript/commonjs/ui/components/signIn/passkeyError.d.ts +16 -0
  219. package/lib/typescript/commonjs/ui/components/signIn/passkeyError.d.ts.map +1 -0
  220. package/lib/typescript/commonjs/ui/components/signIn/signInMethods.d.ts +39 -0
  221. package/lib/typescript/commonjs/ui/components/signIn/signInMethods.d.ts.map +1 -0
  222. package/lib/typescript/commonjs/ui/context/OxyContext.d.ts.map +1 -1
  223. package/lib/typescript/commonjs/ui/context/commitSessionFlow.d.ts +0 -40
  224. package/lib/typescript/commonjs/ui/context/commitSessionFlow.d.ts.map +1 -1
  225. package/lib/typescript/commonjs/ui/context/oxyContextTypes.d.ts +15 -10
  226. package/lib/typescript/commonjs/ui/context/oxyContextTypes.d.ts.map +1 -1
  227. package/lib/typescript/commonjs/ui/context/passkeyFlow.d.ts +16 -1
  228. package/lib/typescript/commonjs/ui/context/passkeyFlow.d.ts.map +1 -1
  229. package/lib/typescript/commonjs/ui/hooks/accountDialogSnapshot.d.ts +7 -1
  230. package/lib/typescript/commonjs/ui/hooks/accountDialogSnapshot.d.ts.map +1 -1
  231. package/lib/typescript/commonjs/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
  232. package/lib/typescript/commonjs/ui/hooks/useDeviceSwitcher.d.ts.map +1 -1
  233. package/lib/typescript/commonjs/ui/oauth/browserAuthTransport.d.ts +9 -0
  234. package/lib/typescript/commonjs/ui/oauth/browserAuthTransport.d.ts.map +1 -1
  235. package/lib/typescript/commonjs/ui/oauth/oauthHandshake.d.ts +3 -0
  236. package/lib/typescript/commonjs/ui/oauth/oauthHandshake.d.ts.map +1 -1
  237. package/lib/typescript/commonjs/ui/oauth/oauthPopup.d.ts +2 -3
  238. package/lib/typescript/commonjs/ui/oauth/oauthPopup.d.ts.map +1 -1
  239. package/lib/typescript/commonjs/ui/screens/EditProfileFieldScreen.d.ts +1 -1
  240. package/lib/typescript/commonjs/ui/screens/EditProfileFieldScreen.d.ts.map +1 -1
  241. package/lib/typescript/commonjs/ui/screens/EditProfileScreen.d.ts.map +1 -1
  242. package/lib/typescript/commonjs/ui/screens/ManageAccountScreen.d.ts.map +1 -1
  243. package/lib/typescript/commonjs/ui/session/authStore.d.ts +0 -30
  244. package/lib/typescript/commonjs/ui/session/authStore.d.ts.map +1 -1
  245. package/lib/typescript/commonjs/ui/types/navigation.d.ts +0 -26
  246. package/lib/typescript/commonjs/ui/types/navigation.d.ts.map +1 -1
  247. package/lib/typescript/module/index.d.ts +16 -2
  248. package/lib/typescript/module/index.d.ts.map +1 -1
  249. package/lib/typescript/module/ui/components/OxyAccountDialogScreen.d.ts.map +1 -1
  250. package/lib/typescript/module/ui/components/OxyAuthChooser.d.ts +5 -12
  251. package/lib/typescript/module/ui/components/OxyAuthChooser.d.ts.map +1 -1
  252. package/lib/typescript/module/ui/components/OxyProvider.d.ts.map +1 -1
  253. package/lib/typescript/module/ui/components/ProfileButton.d.ts +1 -1
  254. package/lib/typescript/module/ui/components/ProfileButton.d.ts.map +1 -1
  255. package/lib/typescript/module/ui/components/authChooser/AccountsMenuView.d.ts.map +1 -1
  256. package/lib/typescript/module/ui/components/authChooser/primitives.d.ts +0 -19
  257. package/lib/typescript/module/ui/components/authChooser/primitives.d.ts.map +1 -1
  258. package/lib/typescript/module/ui/components/authChooser/signInFailureMessage.d.ts +1 -5
  259. package/lib/typescript/module/ui/components/authChooser/signInFailureMessage.d.ts.map +1 -1
  260. package/lib/typescript/module/ui/components/authChooser/styles.d.ts +0 -31
  261. package/lib/typescript/module/ui/components/authChooser/styles.d.ts.map +1 -1
  262. package/lib/typescript/module/ui/components/authChooser/types.d.ts +2 -7
  263. package/lib/typescript/module/ui/components/authChooser/types.d.ts.map +1 -1
  264. package/lib/typescript/module/ui/components/oauthNavigation.d.ts +1 -1
  265. package/lib/typescript/module/ui/components/signIn/InlineCommonsQr.d.ts +20 -0
  266. package/lib/typescript/module/ui/components/signIn/InlineCommonsQr.d.ts.map +1 -0
  267. package/lib/typescript/module/ui/components/signIn/OxyAccountPicker.d.ts +34 -0
  268. package/lib/typescript/module/ui/components/signIn/OxyAccountPicker.d.ts.map +1 -0
  269. package/lib/typescript/module/ui/components/signIn/OxyAuthScreen.d.ts +43 -0
  270. package/lib/typescript/module/ui/components/signIn/OxyAuthScreen.d.ts.map +1 -0
  271. package/lib/typescript/module/ui/components/signIn/OxyCreateAccountPanel.d.ts +24 -0
  272. package/lib/typescript/module/ui/components/signIn/OxyCreateAccountPanel.d.ts.map +1 -0
  273. package/lib/typescript/module/ui/components/signIn/OxyDeleteAccountPanel.d.ts +16 -0
  274. package/lib/typescript/module/ui/components/signIn/OxyDeleteAccountPanel.d.ts.map +1 -0
  275. package/lib/typescript/module/ui/components/signIn/OxyLinkCommonsPanel.d.ts +21 -0
  276. package/lib/typescript/module/ui/components/signIn/OxyLinkCommonsPanel.d.ts.map +1 -0
  277. package/lib/typescript/module/ui/components/signIn/OxyRecoverAccountPanel.d.ts +20 -0
  278. package/lib/typescript/module/ui/components/signIn/OxyRecoverAccountPanel.d.ts.map +1 -0
  279. package/lib/typescript/module/ui/components/signIn/OxySignInPanel.d.ts +43 -0
  280. package/lib/typescript/module/ui/components/signIn/OxySignInPanel.d.ts.map +1 -0
  281. package/lib/typescript/module/ui/components/signIn/OxySignUpPanel.d.ts +17 -0
  282. package/lib/typescript/module/ui/components/signIn/OxySignUpPanel.d.ts.map +1 -0
  283. package/lib/typescript/module/ui/components/signIn/accountFlowParts.d.ts +60 -0
  284. package/lib/typescript/module/ui/components/signIn/accountFlowParts.d.ts.map +1 -0
  285. package/lib/typescript/module/ui/components/signIn/artwork.d.ts +8 -0
  286. package/lib/typescript/module/ui/components/signIn/artwork.d.ts.map +1 -0
  287. package/lib/typescript/module/ui/components/signIn/passkeyError.d.ts +16 -0
  288. package/lib/typescript/module/ui/components/signIn/passkeyError.d.ts.map +1 -0
  289. package/lib/typescript/module/ui/components/signIn/signInMethods.d.ts +39 -0
  290. package/lib/typescript/module/ui/components/signIn/signInMethods.d.ts.map +1 -0
  291. package/lib/typescript/module/ui/context/OxyContext.d.ts.map +1 -1
  292. package/lib/typescript/module/ui/context/commitSessionFlow.d.ts +0 -40
  293. package/lib/typescript/module/ui/context/commitSessionFlow.d.ts.map +1 -1
  294. package/lib/typescript/module/ui/context/oxyContextTypes.d.ts +15 -10
  295. package/lib/typescript/module/ui/context/oxyContextTypes.d.ts.map +1 -1
  296. package/lib/typescript/module/ui/context/passkeyFlow.d.ts +16 -1
  297. package/lib/typescript/module/ui/context/passkeyFlow.d.ts.map +1 -1
  298. package/lib/typescript/module/ui/hooks/accountDialogSnapshot.d.ts +7 -1
  299. package/lib/typescript/module/ui/hooks/accountDialogSnapshot.d.ts.map +1 -1
  300. package/lib/typescript/module/ui/hooks/mutations/useAccountMutations.d.ts.map +1 -1
  301. package/lib/typescript/module/ui/hooks/useDeviceSwitcher.d.ts.map +1 -1
  302. package/lib/typescript/module/ui/oauth/browserAuthTransport.d.ts +9 -0
  303. package/lib/typescript/module/ui/oauth/browserAuthTransport.d.ts.map +1 -1
  304. package/lib/typescript/module/ui/oauth/oauthHandshake.d.ts +3 -0
  305. package/lib/typescript/module/ui/oauth/oauthHandshake.d.ts.map +1 -1
  306. package/lib/typescript/module/ui/oauth/oauthPopup.d.ts +2 -3
  307. package/lib/typescript/module/ui/oauth/oauthPopup.d.ts.map +1 -1
  308. package/lib/typescript/module/ui/screens/EditProfileFieldScreen.d.ts +1 -1
  309. package/lib/typescript/module/ui/screens/EditProfileFieldScreen.d.ts.map +1 -1
  310. package/lib/typescript/module/ui/screens/EditProfileScreen.d.ts.map +1 -1
  311. package/lib/typescript/module/ui/screens/ManageAccountScreen.d.ts.map +1 -1
  312. package/lib/typescript/module/ui/session/authStore.d.ts +0 -30
  313. package/lib/typescript/module/ui/session/authStore.d.ts.map +1 -1
  314. package/lib/typescript/module/ui/types/navigation.d.ts +0 -26
  315. package/lib/typescript/module/ui/types/navigation.d.ts.map +1 -1
  316. package/package.json +4 -7
  317. package/src/assets/signIn/slide-1.jpg +0 -0
  318. package/src/assets/signIn/slide-1.jpg.d.ts +3 -0
  319. package/src/assets/signIn/slide-2.jpg +0 -0
  320. package/src/assets/signIn/slide-2.jpg.d.ts +3 -0
  321. package/src/assets/signIn/slide-3.jpg +0 -0
  322. package/src/assets/signIn/slide-3.jpg.d.ts +3 -0
  323. package/src/assets/signIn/slide-4.jpg +0 -0
  324. package/src/assets/signIn/slide-4.jpg.d.ts +3 -0
  325. package/src/index.ts +27 -7
  326. package/src/ui/components/OxyAccountDialogScreen.tsx +11 -72
  327. package/src/ui/components/OxyAuthChooser.tsx +37 -54
  328. package/src/ui/components/OxyProvider.tsx +0 -2
  329. package/src/ui/components/ProfileButton.tsx +1 -4
  330. package/src/ui/components/authChooser/AccountsMenuView.tsx +28 -8
  331. package/src/ui/components/authChooser/primitives.tsx +1 -39
  332. package/src/ui/components/authChooser/signInFailureMessage.ts +1 -7
  333. package/src/ui/components/authChooser/styles.ts +0 -31
  334. package/src/ui/components/authChooser/types.ts +2 -7
  335. package/src/ui/components/oauthNavigation.ts +1 -1
  336. package/src/ui/components/signIn/InlineCommonsQr.tsx +135 -0
  337. package/src/ui/components/signIn/OxyAccountPicker.tsx +129 -0
  338. package/src/ui/components/signIn/OxyAuthScreen.tsx +123 -0
  339. package/src/ui/components/signIn/OxyCreateAccountPanel.tsx +207 -0
  340. package/src/ui/components/signIn/OxyDeleteAccountPanel.tsx +106 -0
  341. package/src/ui/components/signIn/OxyLinkCommonsPanel.tsx +222 -0
  342. package/src/ui/components/signIn/OxyRecoverAccountPanel.tsx +154 -0
  343. package/src/ui/components/signIn/OxySignInPanel.tsx +392 -0
  344. package/src/ui/components/signIn/OxySignUpPanel.tsx +86 -0
  345. package/src/ui/components/signIn/accountFlowParts.tsx +204 -0
  346. package/src/ui/components/signIn/artwork.ts +13 -0
  347. package/src/ui/components/signIn/passkeyError.ts +44 -0
  348. package/src/ui/components/signIn/signInMethods.ts +51 -0
  349. package/src/ui/context/OxyContext.tsx +23 -19
  350. package/src/ui/context/__tests__/commitSessionFlow.test.ts +0 -89
  351. package/src/ui/context/__tests__/passkeyFlow.test.ts +59 -1
  352. package/src/ui/context/commitSessionFlow.ts +0 -61
  353. package/src/ui/context/oxyContextTypes.ts +16 -10
  354. package/src/ui/context/passkeyFlow.ts +28 -0
  355. package/src/ui/hooks/accountDialogSnapshot.ts +20 -1
  356. package/src/ui/hooks/useDeviceSwitcher.ts +3 -11
  357. package/src/ui/oauth/__tests__/browserAuthTransport.test.ts +21 -0
  358. package/src/ui/oauth/browserAuthTransport.ts +14 -4
  359. package/src/ui/oauth/oauthHandshake.ts +4 -1
  360. package/src/ui/oauth/oauthPopup.ts +2 -3
  361. package/src/ui/screens/EditProfileFieldScreen.tsx +1 -27
  362. package/src/ui/screens/EditProfileScreen.tsx +0 -6
  363. package/src/ui/screens/ManageAccountScreen.tsx +4 -5
  364. package/src/ui/screens/trust/TrustLeaderboardScreen.tsx +1 -1
  365. package/src/ui/session/authStore.ts +0 -37
  366. package/src/ui/types/navigation.ts +0 -26
  367. package/src/ui/utils/accountDeletionHandoff.ts +3 -3
  368. package/lib/commonjs/ui/components/authChooser/SignInEntryView.js +0 -132
  369. package/lib/commonjs/ui/components/authChooser/SignInEntryView.js.map +0 -1
  370. package/lib/commonjs/ui/components/authChooser/SignUpView.js +0 -77
  371. package/lib/commonjs/ui/components/authChooser/SignUpView.js.map +0 -1
  372. package/lib/commonjs/ui/components/passkeyHubPopup.js +0 -33
  373. package/lib/commonjs/ui/components/passkeyHubPopup.js.map +0 -1
  374. package/lib/commonjs/ui/oauth/legacyRedirectLanes.js +0 -48
  375. package/lib/commonjs/ui/oauth/legacyRedirectLanes.js.map +0 -1
  376. package/lib/module/ui/components/authChooser/SignInEntryView.js +0 -127
  377. package/lib/module/ui/components/authChooser/SignInEntryView.js.map +0 -1
  378. package/lib/module/ui/components/authChooser/SignUpView.js +0 -73
  379. package/lib/module/ui/components/authChooser/SignUpView.js.map +0 -1
  380. package/lib/module/ui/components/passkeyHubPopup.js +0 -29
  381. package/lib/module/ui/components/passkeyHubPopup.js.map +0 -1
  382. package/lib/module/ui/oauth/legacyRedirectLanes.js +0 -44
  383. package/lib/module/ui/oauth/legacyRedirectLanes.js.map +0 -1
  384. package/lib/typescript/commonjs/ui/components/authChooser/SignInEntryView.d.ts +0 -39
  385. package/lib/typescript/commonjs/ui/components/authChooser/SignInEntryView.d.ts.map +0 -1
  386. package/lib/typescript/commonjs/ui/components/authChooser/SignUpView.d.ts +0 -31
  387. package/lib/typescript/commonjs/ui/components/authChooser/SignUpView.d.ts.map +0 -1
  388. package/lib/typescript/commonjs/ui/components/passkeyHubPopup.d.ts +0 -23
  389. package/lib/typescript/commonjs/ui/components/passkeyHubPopup.d.ts.map +0 -1
  390. package/lib/typescript/commonjs/ui/oauth/legacyRedirectLanes.d.ts +0 -40
  391. package/lib/typescript/commonjs/ui/oauth/legacyRedirectLanes.d.ts.map +0 -1
  392. package/lib/typescript/module/ui/components/authChooser/SignInEntryView.d.ts +0 -39
  393. package/lib/typescript/module/ui/components/authChooser/SignInEntryView.d.ts.map +0 -1
  394. package/lib/typescript/module/ui/components/authChooser/SignUpView.d.ts +0 -31
  395. package/lib/typescript/module/ui/components/authChooser/SignUpView.d.ts.map +0 -1
  396. package/lib/typescript/module/ui/components/passkeyHubPopup.d.ts +0 -23
  397. package/lib/typescript/module/ui/components/passkeyHubPopup.d.ts.map +0 -1
  398. package/lib/typescript/module/ui/oauth/legacyRedirectLanes.d.ts +0 -40
  399. package/lib/typescript/module/ui/oauth/legacyRedirectLanes.d.ts.map +0 -1
  400. package/src/ui/components/authChooser/SignInEntryView.tsx +0 -157
  401. package/src/ui/components/authChooser/SignUpView.tsx +0 -76
  402. package/src/ui/components/passkeyHubPopup.ts +0 -28
  403. package/src/ui/oauth/legacyRedirectLanes.ts +0 -43
@@ -0,0 +1,236 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.OxyCreateAccountPanel = void 0;
7
+ var _react = require("react");
8
+ var _reactNative = require("react-native");
9
+ var _theme = require("@oxy.so/bloom/theme");
10
+ var _toast = require("@oxy.so/bloom/toast");
11
+ var _core = require("@oxy.so/core");
12
+ var _contracts = require("@oxy.so/contracts");
13
+ var _OxyContext = require("../../context/OxyContext.js");
14
+ var _passkeyFlow = require("../../context/passkeyFlow.js");
15
+ var _useI18n = require("../../hooks/useI18n.js");
16
+ var _commonsStoreLinks = require("../../utils/commonsStoreLinks.js");
17
+ var _passkeyClient = require("../../../webauthn/passkeyClient");
18
+ var _primitives = require("../authChooser/primitives.js");
19
+ var _OxyAuthScreen = require("./OxyAuthScreen.js");
20
+ var _accountFlowParts = require("./accountFlowParts.js");
21
+ var _jsxRuntime = require("react/jsx-runtime");
22
+ /**
23
+ * Creating an Oxy account on the web (ADR 0029 D3), auth.oxy.so's `/signup`:
24
+ *
25
+ * username → recovery email → the code sent to it → passkey → signed in
26
+ *
27
+ * A web account is a username, a passkey and a recovery email — no password, no
28
+ * phrase, no key. The email is confirmed before the account exists, and is
29
+ * used only to get back in (`OxyRecoverAccountPanel`). Commons stays the way to
30
+ * hold your own key: the first step says so, and linking Commons later makes
31
+ * the account self-custodied and deletes the email.
32
+ *
33
+ * Only on auth.oxy.so: the passkey belongs to that origin (RP ID `oxy.so`,
34
+ * asserted only there), and an app's dialog opens this page in a window
35
+ * (`OxySignUpPanel`'s `onCreateOnWeb`).
36
+ */
37
+
38
+ const OxyCreateAccountPanel = ({
39
+ onSignedIn,
40
+ onSignIn
41
+ }) => {
42
+ const theme = (0, _theme.useTheme)();
43
+ const {
44
+ t
45
+ } = (0, _useI18n.useI18n)();
46
+ const {
47
+ oxyServices,
48
+ handleWebSession
49
+ } = (0, _OxyContext.useOxy)();
50
+ const [step, setStep] = (0, _react.useState)({
51
+ name: 'username'
52
+ });
53
+ const [username, setUsername] = (0, _react.useState)('');
54
+ const [email, setEmail] = (0, _react.useState)('');
55
+ const [pending, setPending] = (0, _react.useState)(false);
56
+ const [error, setError] = (0, _react.useState)(null);
57
+ const run = work => {
58
+ if (pending) return;
59
+ setError(null);
60
+ setPending(true);
61
+ work().catch(reason => {
62
+ if ((0, _accountFlowParts.isTicketExpired)(reason)) setStep({
63
+ name: 'email'
64
+ });
65
+ setError((0, _accountFlowParts.describeAccountFlowError)(reason, t));
66
+ }).finally(() => setPending(false));
67
+ };
68
+ const submitUsername = () => {
69
+ const handle = username.trim();
70
+ if (!handle) {
71
+ setError(t('signup.username.required'));
72
+ return;
73
+ }
74
+ run(async () => {
75
+ const {
76
+ available
77
+ } = await oxyServices.checkUsernameAvailability(handle);
78
+ if (!available) throw new Error(t('signup.username.taken'));
79
+ setStep({
80
+ name: 'email'
81
+ });
82
+ });
83
+ };
84
+ const sendCode = async address => {
85
+ const {
86
+ verificationId
87
+ } = await oxyServices.startEmailVerification({
88
+ purpose: 'signup',
89
+ email: address
90
+ });
91
+ setStep({
92
+ name: 'code',
93
+ verificationId
94
+ });
95
+ };
96
+ const submitEmail = () => {
97
+ const parsed = _contracts.emailAddressSchema.safeParse(email);
98
+ if (!parsed.success) {
99
+ setError(t('signup.email.invalid'));
100
+ return;
101
+ }
102
+ setEmail(parsed.data);
103
+ run(() => sendCode(parsed.data));
104
+ };
105
+
106
+ // The ceremony opens the browser's passkey prompt, so it starts from the press.
107
+ const createPasskey = emailTicket => run(() => (0, _passkeyFlow.runPasskeyRegisterSignIn)({
108
+ isSupported: _passkeyClient.isPasskeySupported,
109
+ getRegisterOptions: () => oxyServices.webauthnRegisterOptions({
110
+ username: username.trim()
111
+ }),
112
+ runCeremony: _passkeyClient.runRegistrationCeremony,
113
+ registerVerify: response => oxyServices.webauthnRegisterVerify(response, {
114
+ username: username.trim(),
115
+ email,
116
+ emailTicket,
117
+ deviceFingerprint: JSON.stringify(_core.DeviceManager.getDeviceFingerprint())
118
+ }),
119
+ commit: async session => {
120
+ await handleWebSession(session);
121
+ onSignedIn();
122
+ }
123
+ }));
124
+ const getCommons = () => {
125
+ Promise.resolve().then(() => _reactNative.Linking.openURL((0, _commonsStoreLinks.getCommonsAcquisitionUrl)(_reactNative.Platform.OS))).catch(() => _toast.toast.error(t('accountSwitcher.linkOpenFailed')));
126
+ };
127
+ switch (step.name) {
128
+ case 'code':
129
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.EmailCodeStep, {
130
+ description: t('emailCode.sentTo', {
131
+ email
132
+ }),
133
+ verificationId: step.verificationId,
134
+ onConfirmed: ({
135
+ ticket
136
+ }) => {
137
+ setError(null);
138
+ setStep({
139
+ name: 'passkey',
140
+ emailTicket: ticket
141
+ });
142
+ },
143
+ onResend: () => sendCode(email),
144
+ back: {
145
+ label: t('emailCode.changeEmail'),
146
+ onPress: () => setStep({
147
+ name: 'email'
148
+ })
149
+ }
150
+ });
151
+ case 'passkey':
152
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_OxyAuthScreen.OxyAuthScreen, {
153
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthScreenHeader, {
154
+ title: t('signup.passkey.title'),
155
+ description: t('signup.passkey.subtitle')
156
+ }), error ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.AccountFlowErrorLine, {
157
+ message: error
158
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.AccountFlowAction, {
159
+ label: t('signup.passkey.action'),
160
+ onPress: () => createPasskey(step.emailTicket),
161
+ pending: pending,
162
+ testID: "signup-create-passkey"
163
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthTerms, {})]
164
+ });
165
+ case 'email':
166
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_OxyAuthScreen.OxyAuthScreen, {
167
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthScreenHeader, {
168
+ title: t('signup.email.title'),
169
+ description: t('signup.email.subtitle')
170
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.AccountFlowField, {
171
+ label: t('signup.email.label'),
172
+ value: email,
173
+ onChange: value => {
174
+ setEmail(value);
175
+ if (error) setError(null);
176
+ },
177
+ onSubmit: submitEmail,
178
+ error: error,
179
+ disabled: pending,
180
+ placeholder: t('signup.email.placeholder'),
181
+ autoComplete: "email",
182
+ keyboardType: "email-address",
183
+ testID: "signup-email"
184
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.AccountFlowAction, {
185
+ label: t('signin.actions.continue'),
186
+ onPress: submitEmail,
187
+ pending: pending,
188
+ testID: "signup-email-continue"
189
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.SubtleLink, {
190
+ label: t('signin.actions.back'),
191
+ theme: theme,
192
+ onPress: () => setStep({
193
+ name: 'username'
194
+ }),
195
+ testID: "signup-back"
196
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthTerms, {})]
197
+ });
198
+ default:
199
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_OxyAuthScreen.OxyAuthScreen, {
200
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthScreenHeader, {
201
+ title: t('signup.title'),
202
+ description: t('signup.webSubtitle')
203
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.AccountFlowField, {
204
+ label: t('signup.username.label'),
205
+ value: username,
206
+ onChange: value => {
207
+ setUsername(value);
208
+ if (error) setError(null);
209
+ },
210
+ onSubmit: submitUsername,
211
+ error: error,
212
+ disabled: pending,
213
+ placeholder: t('signup.username.placeholder'),
214
+ autoComplete: "username",
215
+ testID: "signup-username"
216
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.AccountFlowAction, {
217
+ label: t('signin.actions.continue'),
218
+ onPress: submitUsername,
219
+ pending: pending,
220
+ testID: "signup-username-continue"
221
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.SubtleLink, {
222
+ label: t('signup.commonsInstead'),
223
+ theme: theme,
224
+ onPress: getCommons,
225
+ testID: "signup-commons-instead"
226
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_primitives.SubtleLink, {
227
+ label: t('signup.backToSignInLink'),
228
+ theme: theme,
229
+ onPress: onSignIn,
230
+ testID: "back-to-sign-in"
231
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthTerms, {})]
232
+ });
233
+ }
234
+ };
235
+ exports.OxyCreateAccountPanel = OxyCreateAccountPanel;
236
+ //# sourceMappingURL=OxyCreateAccountPanel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_reactNative","_theme","_toast","_core","_contracts","_OxyContext","_passkeyFlow","_useI18n","_commonsStoreLinks","_passkeyClient","_primitives","_OxyAuthScreen","_accountFlowParts","_jsxRuntime","OxyCreateAccountPanel","onSignedIn","onSignIn","theme","useTheme","t","useI18n","oxyServices","handleWebSession","useOxy","step","setStep","useState","name","username","setUsername","email","setEmail","pending","setPending","error","setError","run","work","catch","reason","isTicketExpired","describeAccountFlowError","finally","submitUsername","handle","trim","available","checkUsernameAvailability","Error","sendCode","address","verificationId","startEmailVerification","purpose","submitEmail","parsed","emailAddressSchema","safeParse","success","data","createPasskey","emailTicket","runPasskeyRegisterSignIn","isSupported","isPasskeySupported","getRegisterOptions","webauthnRegisterOptions","runCeremony","runRegistrationCeremony","registerVerify","response","webauthnRegisterVerify","deviceFingerprint","JSON","stringify","DeviceManager","getDeviceFingerprint","commit","session","getCommons","Promise","resolve","then","Linking","openURL","getCommonsAcquisitionUrl","Platform","OS","toast","jsx","EmailCodeStep","description","onConfirmed","ticket","onResend","back","label","onPress","jsxs","OxyAuthScreen","children","OxyAuthScreenHeader","title","AccountFlowErrorLine","message","AccountFlowAction","testID","OxyAuthTerms","AccountFlowField","value","onChange","onSubmit","disabled","placeholder","autoComplete","keyboardType","SubtleLink","exports"],"sourceRoot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AAiB;UAACT,KAAK,EAAE7E,CAAC,CAAC,yBAAyB,CAAE;UAAC8E,OAAO,EAAEtD,cAAe;UAACX,OAAO,EAAEA,OAAQ;UAAC0E,MAAM,EAAC;QAA0B,CAAE,CAAC,eACvI,IAAA7F,WAAA,CAAA4E,GAAA,EAAC/E,WAAA,CAAA0G,UAAU;UAACpB,KAAK,EAAE7E,CAAC,CAAC,uBAAuB,CAAE;UAACF,KAAK,EAAEA,KAAM;UAACgF,OAAO,EAAElB,UAAW;UAAC2B,MAAM,EAAC;QAAwB,CAAE,CAAC,eACpH,IAAA7F,WAAA,CAAA4E,GAAA,EAAC/E,WAAA,CAAA0G,UAAU;UAACpB,KAAK,EAAE7E,CAAC,CAAC,yBAAyB,CAAE;UAACF,KAAK,EAAEA,KAAM;UAACgF,OAAO,EAAEjF,QAAS;UAAC0F,MAAM,EAAC;QAAiB,CAAE,CAAC,eAC7G,IAAA7F,WAAA,CAAA4E,GAAA,EAAC9E,cAAA,CAAAgG,YAAY,IAAE,CAAC;MAAA,CACH,CAAC;EAEtB;AACF,CAAC;AAACU,OAAA,CAAAvG,qBAAA,GAAAA,qBAAA","ignoreList":[]}
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.OxyDeleteAccountPanel = void 0;
7
+ var _react = require("react");
8
+ var _OxyContext = require("../../context/OxyContext.js");
9
+ var _useI18n = require("../../hooks/useI18n.js");
10
+ var _passkeyClient = require("../../../webauthn/passkeyClient");
11
+ var _passkeyFlow = require("../../context/passkeyFlow.js");
12
+ var _OxyAuthScreen = require("./OxyAuthScreen.js");
13
+ var _accountFlowParts = require("./accountFlowParts.js");
14
+ var _jsxRuntime = require("react/jsx-runtime");
15
+ /**
16
+ * Deleting a passkey account (ADR 0029 D3), auth.oxy.so's `/delete-account`.
17
+ *
18
+ * A passkey account has no key to sign its deletion with, so the person types
19
+ * the username and asserts one of the account's passkeys — on auth.oxy.so, the
20
+ * one origin that asserts them — over a challenge the API minted for the
21
+ * account. An account with a Commons key is deleted in Commons, with its key.
22
+ * The page must be signed in as the account; the host renders sign-in first.
23
+ */
24
+
25
+ const OxyDeleteAccountPanel = ({
26
+ onDeleted
27
+ }) => {
28
+ const {
29
+ t
30
+ } = (0, _useI18n.useI18n)();
31
+ const {
32
+ user,
33
+ oxyServices,
34
+ logout
35
+ } = (0, _OxyContext.useOxy)();
36
+ const [confirmText, setConfirmText] = (0, _react.useState)('');
37
+ const [pending, setPending] = (0, _react.useState)(false);
38
+ const [error, setError] = (0, _react.useState)(null);
39
+ const [deleted, setDeleted] = (0, _react.useState)(false);
40
+ if (deleted) {
41
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthScreen, {
42
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthScreenHeader, {
43
+ title: t('deleteAccount.passkey.done'),
44
+ description: t('deleteAccount.passkey.closeWindow')
45
+ })
46
+ });
47
+ }
48
+ const username = user?.username ?? '';
49
+ if (user?.publicKey) {
50
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthScreen, {
51
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthScreenHeader, {
52
+ title: t('deleteAccount.handoff.commonsTitle'),
53
+ description: t('deleteAccount.passkey.commons')
54
+ })
55
+ });
56
+ }
57
+
58
+ // The ceremony opens the browser's passkey prompt, so it starts from the press.
59
+ const remove = () => {
60
+ if (pending) return;
61
+ if (confirmText.trim() !== username) {
62
+ setError(t('deleteAccount.confirmLabel', {
63
+ username
64
+ }));
65
+ return;
66
+ }
67
+ setError(null);
68
+ setPending(true);
69
+ (async () => {
70
+ if (!(0, _passkeyClient.isPasskeySupported)()) throw new Error(_passkeyFlow.PASSKEY_UNSUPPORTED_MESSAGE);
71
+ const options = await oxyServices.getAccountDeletionOptions();
72
+ const assertion = await (0, _passkeyClient.runAuthenticationCeremony)(options);
73
+ await oxyServices.deleteAccountWithPasskey(confirmText.trim(), assertion);
74
+ await logout().catch(() => undefined);
75
+ setDeleted(true);
76
+ onDeleted?.();
77
+ })().catch(reason => setError((0, _accountFlowParts.describeAccountFlowError)(reason, t))).finally(() => setPending(false));
78
+ };
79
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_OxyAuthScreen.OxyAuthScreen, {
80
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthScreenHeader, {
81
+ title: t('deleteAccount.title'),
82
+ description: t('deleteAccount.passkey.subtitle', {
83
+ username
84
+ })
85
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.AccountFlowNote, {
86
+ children: t('deleteAccount.warning')
87
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.AccountFlowField, {
88
+ label: t('deleteAccount.confirmLabel', {
89
+ username
90
+ }),
91
+ value: confirmText,
92
+ onChange: value => {
93
+ setConfirmText(value);
94
+ if (error) setError(null);
95
+ },
96
+ onSubmit: remove,
97
+ error: null,
98
+ disabled: pending,
99
+ placeholder: username,
100
+ autoComplete: "off",
101
+ testID: "delete-account-confirm"
102
+ }), error ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.AccountFlowErrorLine, {
103
+ message: error
104
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.AccountFlowAction, {
105
+ label: t('deleteAccount.passkey.action'),
106
+ onPress: remove,
107
+ pending: pending,
108
+ disabled: confirmText.trim() !== username,
109
+ testID: "delete-account-passkey"
110
+ })]
111
+ });
112
+ };
113
+ exports.OxyDeleteAccountPanel = OxyDeleteAccountPanel;
114
+ //# sourceMappingURL=OxyDeleteAccountPanel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_OxyContext","_useI18n","_passkeyClient","_passkeyFlow","_OxyAuthScreen","_accountFlowParts","_jsxRuntime","OxyDeleteAccountPanel","onDeleted","t","useI18n","user","oxyServices","logout","useOxy","confirmText","setConfirmText","useState","pending","setPending","error","setError","deleted","setDeleted","jsx","OxyAuthScreen","children","OxyAuthScreenHeader","title","description","username","publicKey","remove","trim","isPasskeySupported","Error","PASSKEY_UNSUPPORTED_MESSAGE","options","getAccountDeletionOptions","assertion","runAuthenticationCeremony","deleteAccountWithPasskey","catch","undefined","reason","describeAccountFlowError","finally","jsxs","AccountFlowNote","AccountFlowField","label","value","onChange","onSubmit","disabled","placeholder","autoComplete","testID","AccountFlowErrorLine","message","AccountFlowAction","onPress","exports"],"sourceRoot":"../../../../../src","sources":["ui/components/signIn/OxyDeleteAccountPanel.tsx"],"mappings":";;;;;;AAWA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,cAAA,GAAAH,OAAA;AACA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,cAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAN,OAAA;AAM4B,IAAAO,WAAA,GAAAP,OAAA;AAvB5B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAsBO,MAAMQ,qBAA2D,GAAGA,CAAC;EAAEC;AAAU,CAAC,KAAK;EAC5F,MAAM;IAAEC;EAAE,CAAC,GAAG,IAAAC,gBAAO,EAAC,CAAC;EACvB,MAAM;IAAEC,IAAI;IAAEC,WAAW;IAAEC;EAAO,CAAC,GAAG,IAAAC,kBAAM,EAAC,CAAC;EAC9C,MAAM,CAACC,WAAW,EAAEC,cAAc,CAAC,GAAG,IAAAC,eAAQ,EAAC,EAAE,CAAC;EAClD,MAAM,CAACC,OAAO,EAAEC,UAAU,CAAC,GAAG,IAAAF,eAAQ,EAAC,KAAK,CAAC;EAC7C,MAAM,CAACG,KAAK,EAAEC,QAAQ,CAAC,GAAG,IAAAJ,eAAQ,EAAgB,IAAI,CAAC;EACvD,MAAM,CAAC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ACZkC,QAAQ,EAAEpC,OAAQ;MAClBqC,WAAW,EAAEzB,QAAS;MACtB0B,YAAY,EAAC,KAAK;MAClBC,MAAM,EAAC;IAAwB,CAChC,CAAC,EACDrC,KAAK,gBAAG,IAAAd,WAAA,CAAAkB,GAAA,EAACnB,iBAAA,CAAAqD,oBAAoB;MAACC,OAAO,EAAEvC;IAAM,CAAE,CAAC,GAAG,IAAI,eACxD,IAAAd,WAAA,CAAAkB,GAAA,EAACnB,iBAAA,CAAAuD,iBAAiB;MAChBV,KAAK,EAAEzC,CAAC,CAAC,8BAA8B,CAAE;MACzCoD,OAAO,EAAE7B,MAAO;MAChBd,OAAO,EAAEA,OAAQ;MACjBoC,QAAQ,EAAEvC,WAAW,CAACkB,IAAI,CAAC,CAAC,KAAKH,QAAS;MAC1C2B,MAAM,EAAC;IAAwB,CAChC,CAAC;EAAA,CACW,CAAC;AAEpB,CAAC;AAACK,OAAA,CAAAvD,qBAAA,GAAAA,qBAAA","ignoreList":[]}
@@ -0,0 +1,275 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.OxyLinkCommonsPanel = exports.IDENTITY_LINK_POLL_MS = void 0;
7
+ var _react = require("react");
8
+ var _reactNative = require("react-native");
9
+ var _reactNativeQrcodeSvg = _interopRequireDefault(require("react-native-qrcode-svg"));
10
+ var _button = require("@oxy.so/bloom/button");
11
+ var _theme = require("@oxy.so/bloom/theme");
12
+ var _typography = require("@oxy.so/bloom/typography");
13
+ var _core = require("@oxy.so/core");
14
+ var _OxyContext = require("../../context/OxyContext.js");
15
+ var _passkeyFlow = require("../../context/passkeyFlow.js");
16
+ var _useI18n = require("../../hooks/useI18n.js");
17
+ var _passkeyClient = require("../../../webauthn/passkeyClient");
18
+ var _OxyAuthScreen = require("./OxyAuthScreen.js");
19
+ var _accountFlowParts = require("./accountFlowParts.js");
20
+ var _jsxRuntime = require("react/jsx-runtime");
21
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
22
+ /**
23
+ * Linking Commons to a passkey account (ADR 0029 D3), auth.oxy.so's
24
+ * `/link-commons`:
25
+ *
26
+ * QR → Commons scans and signs with its key → both screens show the same
27
+ * code → the person confirms here with the passkey → linked
28
+ *
29
+ * Afterwards the account is self-custodied: its root is the key Commons holds,
30
+ * its recovery email is deleted, and its phrase in Commons is how it gets back
31
+ * in. The passkey keeps signing in on the web. The page must be signed in as
32
+ * the account; the host renders sign-in first.
33
+ */
34
+
35
+ /** How often the page asks whether Commons has signed. */
36
+ const IDENTITY_LINK_POLL_MS = exports.IDENTITY_LINK_POLL_MS = 2000;
37
+
38
+ /** High-contrast, un-themed on purpose: scan reliability. */
39
+ const QR_PLATE_BG = '#FFFFFF';
40
+ const QR_FOREGROUND = '#000000';
41
+ const QR_SIZE = 200;
42
+ const OxyLinkCommonsPanel = ({
43
+ onLinked
44
+ }) => {
45
+ const theme = (0, _theme.useTheme)();
46
+ const {
47
+ t
48
+ } = (0, _useI18n.useI18n)();
49
+ const {
50
+ user,
51
+ oxyServices
52
+ } = (0, _OxyContext.useOxy)();
53
+ const [step, setStep] = (0, _react.useState)({
54
+ name: 'opening'
55
+ });
56
+ const [pending, setPending] = (0, _react.useState)(false);
57
+ const [error, setError] = (0, _react.useState)(null);
58
+ const alreadyLinked = Boolean(user?.publicKey);
59
+ const open = (0, _react.useCallback)(() => {
60
+ setError(null);
61
+ setStep({
62
+ name: 'opening'
63
+ });
64
+ oxyServices.createIdentityLink().then(link => setStep({
65
+ name: 'qr',
66
+ link
67
+ })).catch(reason => {
68
+ setError((0, _accountFlowParts.describeAccountFlowError)(reason, t));
69
+ setStep({
70
+ name: 'expired'
71
+ });
72
+ });
73
+ }, [oxyServices, t]);
74
+
75
+ // One request per visit, opened once the page knows the account has no root.
76
+ const opened = (0, _react.useRef)(false);
77
+ (0, _react.useEffect)(() => {
78
+ if (alreadyLinked || opened.current) return;
79
+ opened.current = true;
80
+ open();
81
+ }, [alreadyLinked, open]);
82
+
83
+ // While the QR shows, ask whether Commons has signed; a request only lives a
84
+ // few minutes, and an expired one says so instead of waiting forever.
85
+ const link = step.name === 'qr' ? step.link : null;
86
+ (0, _react.useEffect)(() => {
87
+ if (!link) return;
88
+ let stopped = false;
89
+ const poll = async () => {
90
+ if (stopped) return;
91
+ if (Date.now() >= link.expiresAt) {
92
+ setStep({
93
+ name: 'expired'
94
+ });
95
+ return;
96
+ }
97
+ try {
98
+ const state = await oxyServices.getIdentityLink(link.linkId);
99
+ if (stopped) return;
100
+ if (state.status === 'signed' && state.publicKey) {
101
+ setStep({
102
+ name: 'matching',
103
+ link,
104
+ code: (0, _core.deriveIdentityLinkCode)(link.linkId, state.publicKey)
105
+ });
106
+ return;
107
+ }
108
+ if (state.status === 'cancelled') {
109
+ setStep({
110
+ name: 'expired'
111
+ });
112
+ return;
113
+ }
114
+ } catch {
115
+ // A missed poll is retried on the next tick.
116
+ }
117
+ if (!stopped) timer = setTimeout(() => void poll(), IDENTITY_LINK_POLL_MS);
118
+ };
119
+ let timer = setTimeout(() => void poll(), IDENTITY_LINK_POLL_MS);
120
+ return () => {
121
+ stopped = true;
122
+ clearTimeout(timer);
123
+ };
124
+ }, [link, oxyServices]);
125
+
126
+ // The ceremony opens the browser's passkey prompt, so it starts from the press.
127
+ const confirm = confirmed => {
128
+ if (pending) return;
129
+ setError(null);
130
+ setPending(true);
131
+ (async () => {
132
+ if (!(0, _passkeyClient.isPasskeySupported)()) throw new Error(_passkeyFlow.PASSKEY_UNSUPPORTED_MESSAGE);
133
+ const options = await oxyServices.getIdentityLinkAssertionOptions(confirmed.linkId, confirmed.challenge);
134
+ const assertion = await (0, _passkeyClient.runAuthenticationCeremony)(options);
135
+ await oxyServices.completeIdentityLink(confirmed.linkId, assertion);
136
+ setStep({
137
+ name: 'done'
138
+ });
139
+ onLinked?.();
140
+ })().catch(reason => setError((0, _accountFlowParts.describeAccountFlowError)(reason, t))).finally(() => setPending(false));
141
+ };
142
+ const cancel = cancelled => {
143
+ void oxyServices.cancelIdentityLink(cancelled.linkId).catch(() => undefined);
144
+ setStep({
145
+ name: 'expired'
146
+ });
147
+ };
148
+ if (alreadyLinked) {
149
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthScreen, {
150
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthScreenHeader, {
151
+ title: t('linkCommons.title'),
152
+ description: t('linkCommons.already')
153
+ })
154
+ });
155
+ }
156
+ switch (step.name) {
157
+ case 'done':
158
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthScreen, {
159
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthScreenHeader, {
160
+ title: t('linkCommons.doneTitle'),
161
+ description: t('linkCommons.done')
162
+ })
163
+ });
164
+ case 'expired':
165
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_OxyAuthScreen.OxyAuthScreen, {
166
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthScreenHeader, {
167
+ title: t('linkCommons.title'),
168
+ description: t('linkCommons.expired')
169
+ }), error ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.AccountFlowErrorLine, {
170
+ message: error
171
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.AccountFlowAction, {
172
+ label: t('linkCommons.renew'),
173
+ onPress: open,
174
+ pending: false,
175
+ testID: "link-commons-renew"
176
+ })]
177
+ });
178
+ case 'matching':
179
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_OxyAuthScreen.OxyAuthScreen, {
180
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthScreenHeader, {
181
+ title: t('linkCommons.compareTitle'),
182
+ description: t('linkCommons.compare')
183
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_typography.Text, {
184
+ accessibilityLabel: step.code.split('').join(' '),
185
+ style: [styles.code, {
186
+ color: theme.colors.text
187
+ }],
188
+ testID: "link-commons-code",
189
+ children: `${step.code.slice(0, 3)} ${step.code.slice(3)}`
190
+ }), error ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.AccountFlowErrorLine, {
191
+ message: error
192
+ }) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.AccountFlowAction, {
193
+ label: t('linkCommons.confirm'),
194
+ onPress: () => confirm(step.link),
195
+ pending: pending,
196
+ testID: "link-commons-confirm"
197
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.Button, {
198
+ appearance: "plain",
199
+ tone: "neutral",
200
+ size: "lg",
201
+ fullWidth: true,
202
+ disabled: pending,
203
+ onPress: () => cancel(step.link),
204
+ testID: "link-commons-cancel",
205
+ children: t('linkCommons.cancel')
206
+ })]
207
+ });
208
+ case 'qr':
209
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_OxyAuthScreen.OxyAuthScreen, {
210
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthScreenHeader, {
211
+ title: t('linkCommons.title'),
212
+ description: t('linkCommons.subtitle')
213
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
214
+ style: styles.plateRow,
215
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
216
+ style: [styles.plate, {
217
+ borderColor: theme.colors.border
218
+ }],
219
+ testID: "link-commons-qr",
220
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeQrcodeSvg.default, {
221
+ value: step.link.qrPayload,
222
+ size: QR_SIZE,
223
+ backgroundColor: QR_PLATE_BG,
224
+ color: QR_FOREGROUND
225
+ })
226
+ })
227
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.AccountFlowNote, {
228
+ children: t('linkCommons.scan')
229
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_accountFlowParts.AccountFlowNote, {
230
+ children: t('linkCommons.waiting')
231
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_button.Button, {
232
+ appearance: "plain",
233
+ tone: "neutral",
234
+ size: "lg",
235
+ fullWidth: true,
236
+ onPress: () => cancel(step.link),
237
+ testID: "link-commons-cancel",
238
+ children: t('linkCommons.cancel')
239
+ })]
240
+ });
241
+ default:
242
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_OxyAuthScreen.OxyAuthScreen, {
243
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_OxyAuthScreen.OxyAuthScreenHeader, {
244
+ title: t('linkCommons.title'),
245
+ description: t('linkCommons.subtitle')
246
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.View, {
247
+ style: styles.plateRow,
248
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNative.ActivityIndicator, {
249
+ size: "large",
250
+ color: theme.colors.primary
251
+ })
252
+ })]
253
+ });
254
+ }
255
+ };
256
+ exports.OxyLinkCommonsPanel = OxyLinkCommonsPanel;
257
+ const styles = _reactNative.StyleSheet.create({
258
+ plateRow: {
259
+ alignItems: 'center'
260
+ },
261
+ plate: {
262
+ padding: 12,
263
+ borderRadius: 16,
264
+ borderWidth: _reactNative.StyleSheet.hairlineWidth,
265
+ backgroundColor: QR_PLATE_BG
266
+ },
267
+ code: {
268
+ fontSize: 40,
269
+ lineHeight: 48,
270
+ fontWeight: '700',
271
+ letterSpacing: 4,
272
+ textAlign: 'center'
273
+ }
274
+ });
275
+ //# sourceMappingURL=OxyLinkCommonsPanel.js.map