@atproto/pds 0.5.37 → 0.5.39

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 (335) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/account-manager/account-manager.d.ts +2 -1
  3. package/dist/account-manager/account-manager.d.ts.map +1 -1
  4. package/dist/account-manager/account-manager.js +2 -1
  5. package/dist/account-manager/account-manager.js.map +1 -1
  6. package/dist/account-manager/oauth-store.d.ts +1 -1
  7. package/dist/account-manager/oauth-store.d.ts.map +1 -1
  8. package/dist/account-manager/oauth-store.js +16 -4
  9. package/dist/account-manager/oauth-store.js.map +1 -1
  10. package/dist/lexicons/app/bsky/actor/defs.defs.d.ts +25 -0
  11. package/dist/lexicons/app/bsky/actor/defs.defs.d.ts.map +1 -1
  12. package/dist/lexicons/app/bsky/actor/defs.defs.js +16 -0
  13. package/dist/lexicons/app/bsky/actor/defs.defs.js.map +1 -1
  14. package/dist/lexicons/app/bsky/actor/link.d.ts +3 -0
  15. package/dist/lexicons/app/bsky/actor/link.d.ts.map +1 -0
  16. package/dist/lexicons/app/bsky/actor/link.defs.d.ts +120 -0
  17. package/dist/lexicons/app/bsky/actor/link.defs.d.ts.map +1 -0
  18. package/dist/lexicons/app/bsky/actor/link.defs.js +39 -0
  19. package/dist/lexicons/app/bsky/actor/link.defs.js.map +1 -0
  20. package/dist/lexicons/app/bsky/actor/link.js +6 -0
  21. package/dist/lexicons/app/bsky/actor/link.js.map +1 -0
  22. package/dist/lexicons/app/bsky/actor/profile.defs.d.ts +14 -0
  23. package/dist/lexicons/app/bsky/actor/profile.defs.d.ts.map +1 -1
  24. package/dist/lexicons/app/bsky/actor/profile.defs.js +3 -0
  25. package/dist/lexicons/app/bsky/actor/profile.defs.js.map +1 -1
  26. package/dist/lexicons/app/bsky/actor.d.ts +1 -0
  27. package/dist/lexicons/app/bsky/actor.d.ts.map +1 -1
  28. package/dist/lexicons/app/bsky/actor.js +1 -0
  29. package/dist/lexicons/app/bsky/actor.js.map +1 -1
  30. package/dist/lexicons/app/bsky/authFullApp.defs.d.ts.map +1 -1
  31. package/dist/lexicons/app/bsky/authFullApp.defs.js +1 -0
  32. package/dist/lexicons/app/bsky/authFullApp.defs.js.map +1 -1
  33. package/dist/lexicons/app/bsky/authManageProfile.defs.d.ts.map +1 -1
  34. package/dist/lexicons/app/bsky/authManageProfile.defs.js +1 -0
  35. package/dist/lexicons/app/bsky/authManageProfile.defs.js.map +1 -1
  36. package/dist/lexicons/app/bsky/embed/external.defs.d.ts +130 -0
  37. package/dist/lexicons/app/bsky/embed/external.defs.d.ts.map +1 -1
  38. package/dist/lexicons/app/bsky/embed/external.defs.js +135 -0
  39. package/dist/lexicons/app/bsky/embed/external.defs.js.map +1 -1
  40. package/dist/lexicons/app/bsky/embed/getEmbedExternalView.defs.d.ts +15 -3
  41. package/dist/lexicons/app/bsky/embed/getEmbedExternalView.defs.d.ts.map +1 -1
  42. package/dist/lexicons/app/bsky/embed/getEmbedExternalView.defs.js +18 -3
  43. package/dist/lexicons/app/bsky/embed/getEmbedExternalView.defs.js.map +1 -1
  44. package/dist/lexicons/app/bsky/embed/record.defs.d.ts +8 -0
  45. package/dist/lexicons/app/bsky/embed/record.defs.d.ts.map +1 -1
  46. package/dist/lexicons/app/bsky/embed/record.defs.js +2 -0
  47. package/dist/lexicons/app/bsky/embed/record.defs.js.map +1 -1
  48. package/dist/lexicons/app/bsky/notification/getGroupedNotifications.defs.d.ts +62 -3
  49. package/dist/lexicons/app/bsky/notification/getGroupedNotifications.defs.d.ts.map +1 -1
  50. package/dist/lexicons/app/bsky/notification/getGroupedNotifications.defs.js +53 -2
  51. package/dist/lexicons/app/bsky/notification/getGroupedNotifications.defs.js.map +1 -1
  52. package/dist/lexicons/app/bsky/unspecced/getAtmosphereExploreTab.d.ts +3 -0
  53. package/dist/lexicons/app/bsky/unspecced/getAtmosphereExploreTab.d.ts.map +1 -0
  54. package/dist/lexicons/app/bsky/unspecced/getAtmosphereExploreTab.defs.d.ts +103 -0
  55. package/dist/lexicons/app/bsky/unspecced/getAtmosphereExploreTab.defs.d.ts.map +1 -0
  56. package/dist/lexicons/app/bsky/unspecced/getAtmosphereExploreTab.defs.js +95 -0
  57. package/dist/lexicons/app/bsky/unspecced/getAtmosphereExploreTab.defs.js.map +1 -0
  58. package/dist/lexicons/app/bsky/unspecced/getAtmosphereExploreTab.js +6 -0
  59. package/dist/lexicons/app/bsky/unspecced/getAtmosphereExploreTab.js.map +1 -0
  60. package/dist/lexicons/app/bsky/unspecced/getOnboardingSuggestedStarterPacks.defs.d.ts +2 -0
  61. package/dist/lexicons/app/bsky/unspecced/getOnboardingSuggestedStarterPacks.defs.d.ts.map +1 -1
  62. package/dist/lexicons/app/bsky/unspecced/getOnboardingSuggestedStarterPacks.defs.js +1 -0
  63. package/dist/lexicons/app/bsky/unspecced/getOnboardingSuggestedStarterPacks.defs.js.map +1 -1
  64. package/dist/lexicons/app/bsky/unspecced/getOnboardingSuggestedStarterPacksSkeleton.defs.d.ts +2 -0
  65. package/dist/lexicons/app/bsky/unspecced/getOnboardingSuggestedStarterPacksSkeleton.defs.d.ts.map +1 -1
  66. package/dist/lexicons/app/bsky/unspecced/getOnboardingSuggestedStarterPacksSkeleton.defs.js +1 -0
  67. package/dist/lexicons/app/bsky/unspecced/getOnboardingSuggestedStarterPacksSkeleton.defs.js.map +1 -1
  68. package/dist/lexicons/app/bsky/unspecced/getSuggestedFeeds.defs.d.ts +2 -0
  69. package/dist/lexicons/app/bsky/unspecced/getSuggestedFeeds.defs.d.ts.map +1 -1
  70. package/dist/lexicons/app/bsky/unspecced/getSuggestedFeeds.defs.js +1 -0
  71. package/dist/lexicons/app/bsky/unspecced/getSuggestedFeeds.defs.js.map +1 -1
  72. package/dist/lexicons/app/bsky/unspecced/getSuggestedFeedsSkeleton.defs.d.ts +2 -0
  73. package/dist/lexicons/app/bsky/unspecced/getSuggestedFeedsSkeleton.defs.d.ts.map +1 -1
  74. package/dist/lexicons/app/bsky/unspecced/getSuggestedFeedsSkeleton.defs.js +1 -0
  75. package/dist/lexicons/app/bsky/unspecced/getSuggestedFeedsSkeleton.defs.js.map +1 -1
  76. package/dist/lexicons/app/bsky/unspecced/getSuggestedStarterPacks.defs.d.ts +2 -0
  77. package/dist/lexicons/app/bsky/unspecced/getSuggestedStarterPacks.defs.d.ts.map +1 -1
  78. package/dist/lexicons/app/bsky/unspecced/getSuggestedStarterPacks.defs.js +1 -0
  79. package/dist/lexicons/app/bsky/unspecced/getSuggestedStarterPacks.defs.js.map +1 -1
  80. package/dist/lexicons/app/bsky/unspecced/getSuggestedStarterPacksSkeleton.defs.d.ts +2 -0
  81. package/dist/lexicons/app/bsky/unspecced/getSuggestedStarterPacksSkeleton.defs.d.ts.map +1 -1
  82. package/dist/lexicons/app/bsky/unspecced/getSuggestedStarterPacksSkeleton.defs.js +1 -0
  83. package/dist/lexicons/app/bsky/unspecced/getSuggestedStarterPacksSkeleton.defs.js.map +1 -1
  84. package/dist/lexicons/app/bsky/unspecced.d.ts +1 -0
  85. package/dist/lexicons/app/bsky/unspecced.d.ts.map +1 -1
  86. package/dist/lexicons/app/bsky/unspecced.js +1 -0
  87. package/dist/lexicons/app/bsky/unspecced.js.map +1 -1
  88. package/dist/lexicons/index.d.ts +2 -0
  89. package/dist/lexicons/index.d.ts.map +1 -1
  90. package/dist/lexicons/index.js +2 -0
  91. package/dist/lexicons/index.js.map +1 -1
  92. package/dist/lexicons/place/stream/badge/defs.d.ts +2 -0
  93. package/dist/lexicons/place/stream/badge/defs.d.ts.map +1 -0
  94. package/dist/lexicons/place/stream/badge/defs.defs.d.ts +131 -0
  95. package/dist/lexicons/place/stream/badge/defs.defs.d.ts.map +1 -0
  96. package/dist/lexicons/place/stream/badge/defs.defs.js +73 -0
  97. package/dist/lexicons/place/stream/badge/defs.defs.js.map +1 -0
  98. package/dist/lexicons/place/stream/badge/defs.js +5 -0
  99. package/dist/lexicons/place/stream/badge/defs.js.map +1 -0
  100. package/dist/lexicons/place/stream/badge.d.ts +2 -0
  101. package/dist/lexicons/place/stream/badge.d.ts.map +1 -0
  102. package/dist/lexicons/place/stream/badge.js +5 -0
  103. package/dist/lexicons/place/stream/badge.js.map +1 -0
  104. package/dist/lexicons/place/stream/chat/defs.d.ts +2 -0
  105. package/dist/lexicons/place/stream/chat/defs.d.ts.map +1 -0
  106. package/dist/lexicons/place/stream/chat/defs.defs.d.ts +44 -0
  107. package/dist/lexicons/place/stream/chat/defs.defs.d.ts.map +1 -0
  108. package/dist/lexicons/place/stream/chat/defs.defs.js +41 -0
  109. package/dist/lexicons/place/stream/chat/defs.defs.js.map +1 -0
  110. package/dist/lexicons/place/stream/chat/defs.js +5 -0
  111. package/dist/lexicons/place/stream/chat/defs.js.map +1 -0
  112. package/dist/lexicons/place/stream/chat/pinnedRecord.d.ts +3 -0
  113. package/dist/lexicons/place/stream/chat/pinnedRecord.d.ts.map +1 -0
  114. package/dist/lexicons/place/stream/chat/pinnedRecord.defs.d.ts +108 -0
  115. package/dist/lexicons/place/stream/chat/pinnedRecord.defs.d.ts.map +1 -0
  116. package/dist/lexicons/place/stream/chat/pinnedRecord.defs.js +31 -0
  117. package/dist/lexicons/place/stream/chat/pinnedRecord.defs.js.map +1 -0
  118. package/dist/lexicons/place/stream/chat/pinnedRecord.js +6 -0
  119. package/dist/lexicons/place/stream/chat/pinnedRecord.js.map +1 -0
  120. package/dist/lexicons/place/stream/chat/profile.d.ts +3 -0
  121. package/dist/lexicons/place/stream/chat/profile.d.ts.map +1 -0
  122. package/dist/lexicons/place/stream/chat/profile.defs.d.ts +143 -0
  123. package/dist/lexicons/place/stream/chat/profile.defs.d.ts.map +1 -0
  124. package/dist/lexicons/place/stream/chat/profile.defs.js +62 -0
  125. package/dist/lexicons/place/stream/chat/profile.defs.js.map +1 -0
  126. package/dist/lexicons/place/stream/chat/profile.js +6 -0
  127. package/dist/lexicons/place/stream/chat/profile.js.map +1 -0
  128. package/dist/lexicons/place/stream/chat.d.ts +4 -0
  129. package/dist/lexicons/place/stream/chat.d.ts.map +1 -0
  130. package/dist/lexicons/place/stream/chat.js +7 -0
  131. package/dist/lexicons/place/stream/chat.js.map +1 -0
  132. package/dist/lexicons/place/stream/defs.d.ts +2 -0
  133. package/dist/lexicons/place/stream/defs.d.ts.map +1 -0
  134. package/dist/lexicons/place/stream/defs.defs.d.ts +54 -0
  135. package/dist/lexicons/place/stream/defs.defs.d.ts.map +1 -0
  136. package/dist/lexicons/place/stream/defs.defs.js +40 -0
  137. package/dist/lexicons/place/stream/defs.defs.js.map +1 -0
  138. package/dist/lexicons/place/stream/defs.js +5 -0
  139. package/dist/lexicons/place/stream/defs.js.map +1 -0
  140. package/dist/lexicons/place/stream/livestream.d.ts +3 -0
  141. package/dist/lexicons/place/stream/livestream.d.ts.map +1 -0
  142. package/dist/lexicons/place/stream/livestream.defs.d.ts +312 -0
  143. package/dist/lexicons/place/stream/livestream.defs.d.ts.map +1 -0
  144. package/dist/lexicons/place/stream/livestream.defs.js +105 -0
  145. package/dist/lexicons/place/stream/livestream.defs.js.map +1 -0
  146. package/dist/lexicons/place/stream/livestream.js +6 -0
  147. package/dist/lexicons/place/stream/livestream.js.map +1 -0
  148. package/dist/lexicons/place/stream.d.ts +5 -0
  149. package/dist/lexicons/place/stream.d.ts.map +1 -0
  150. package/dist/lexicons/place/stream.js +8 -0
  151. package/dist/lexicons/place/stream.js.map +1 -0
  152. package/dist/lexicons/place.d.ts +2 -0
  153. package/dist/lexicons/place.d.ts.map +1 -0
  154. package/dist/lexicons/place.js +5 -0
  155. package/dist/lexicons/place.js.map +1 -0
  156. package/dist/lexicons/site/standard/document.defs.d.ts +127 -127
  157. package/dist/lexicons/site/standard/document.defs.d.ts.map +1 -1
  158. package/dist/lexicons/site/standard/document.defs.js +28 -28
  159. package/dist/lexicons/site/standard/document.defs.js.map +1 -1
  160. package/dist/lexicons/site/standard/graph/recommend.defs.d.ts +11 -11
  161. package/dist/lexicons/site/standard/graph/recommend.defs.d.ts.map +1 -1
  162. package/dist/lexicons/site/standard/graph/recommend.defs.js +1 -1
  163. package/dist/lexicons/site/standard/graph/recommend.defs.js.map +1 -1
  164. package/dist/lexicons/site/standard/publication.defs.d.ts +52 -52
  165. package/dist/lexicons/site/standard/publication.defs.d.ts.map +1 -1
  166. package/dist/lexicons/site/standard/publication.defs.js +6 -6
  167. package/dist/lexicons/site/standard/publication.defs.js.map +1 -1
  168. package/dist/lexicons/site/standard/theme/basic.defs.d.ts +14 -14
  169. package/dist/lexicons/site/standard/theme/basic.defs.d.ts.map +1 -1
  170. package/dist/lexicons/site/standard/theme/basic.defs.js +1 -1
  171. package/dist/lexicons/site/standard/theme/basic.defs.js.map +1 -1
  172. package/dist/lexicons/social/grain/defs.d.ts +2 -0
  173. package/dist/lexicons/social/grain/defs.d.ts.map +1 -0
  174. package/dist/lexicons/social/grain/defs.defs.d.ts +15 -0
  175. package/dist/lexicons/social/grain/defs.defs.d.ts.map +1 -0
  176. package/dist/lexicons/social/grain/defs.defs.js +14 -0
  177. package/dist/lexicons/social/grain/defs.defs.js.map +1 -0
  178. package/dist/lexicons/social/grain/defs.js +5 -0
  179. package/dist/lexicons/social/grain/defs.js.map +1 -0
  180. package/dist/lexicons/social/grain/favorite.d.ts +3 -0
  181. package/dist/lexicons/social/grain/favorite.d.ts.map +1 -0
  182. package/dist/lexicons/social/grain/favorite.defs.d.ts +72 -0
  183. package/dist/lexicons/social/grain/favorite.defs.d.ts.map +1 -0
  184. package/dist/lexicons/social/grain/favorite.defs.js +26 -0
  185. package/dist/lexicons/social/grain/favorite.defs.js.map +1 -0
  186. package/dist/lexicons/social/grain/favorite.js +6 -0
  187. package/dist/lexicons/social/grain/favorite.js.map +1 -0
  188. package/dist/lexicons/social/grain/gallery/item.d.ts +3 -0
  189. package/dist/lexicons/social/grain/gallery/item.d.ts.map +1 -0
  190. package/dist/lexicons/social/grain/gallery/item.defs.d.ts +94 -0
  191. package/dist/lexicons/social/grain/gallery/item.defs.d.ts.map +1 -0
  192. package/dist/lexicons/social/grain/gallery/item.defs.js +29 -0
  193. package/dist/lexicons/social/grain/gallery/item.defs.js.map +1 -0
  194. package/dist/lexicons/social/grain/gallery/item.js +6 -0
  195. package/dist/lexicons/social/grain/gallery/item.js.map +1 -0
  196. package/dist/lexicons/social/grain/gallery.d.ts +4 -0
  197. package/dist/lexicons/social/grain/gallery.d.ts.map +1 -0
  198. package/dist/lexicons/social/grain/gallery.defs.d.ts +98 -0
  199. package/dist/lexicons/social/grain/gallery.defs.d.ts.map +1 -0
  200. package/dist/lexicons/social/grain/gallery.defs.js +33 -0
  201. package/dist/lexicons/social/grain/gallery.defs.js.map +1 -0
  202. package/dist/lexicons/social/grain/gallery.js +7 -0
  203. package/dist/lexicons/social/grain/gallery.js.map +1 -0
  204. package/dist/lexicons/social/grain/photo.d.ts +3 -0
  205. package/dist/lexicons/social/grain/photo.d.ts.map +1 -0
  206. package/dist/lexicons/social/grain/photo.defs.d.ts +98 -0
  207. package/dist/lexicons/social/grain/photo.defs.d.ts.map +1 -0
  208. package/dist/lexicons/social/grain/photo.defs.js +31 -0
  209. package/dist/lexicons/social/grain/photo.defs.js.map +1 -0
  210. package/dist/lexicons/social/grain/photo.js +6 -0
  211. package/dist/lexicons/social/grain/photo.js.map +1 -0
  212. package/dist/lexicons/social/grain.d.ts +5 -0
  213. package/dist/lexicons/social/grain.d.ts.map +1 -0
  214. package/dist/lexicons/social/grain.js +8 -0
  215. package/dist/lexicons/social/grain.js.map +1 -0
  216. package/dist/lexicons/social.d.ts +2 -0
  217. package/dist/lexicons/social.d.ts.map +1 -0
  218. package/dist/lexicons/social.js +5 -0
  219. package/dist/lexicons/social.js.map +1 -0
  220. package/dist/lexicons/tools/ozone/inbox/defs.defs.d.ts +129 -4
  221. package/dist/lexicons/tools/ozone/inbox/defs.defs.d.ts.map +1 -1
  222. package/dist/lexicons/tools/ozone/inbox/defs.defs.js +99 -2
  223. package/dist/lexicons/tools/ozone/inbox/defs.defs.js.map +1 -1
  224. package/dist/lexicons/tools/ozone/inbox/getAccountStatus.d.ts +3 -0
  225. package/dist/lexicons/tools/ozone/inbox/getAccountStatus.d.ts.map +1 -0
  226. package/dist/lexicons/tools/ozone/inbox/getAccountStatus.defs.d.ts +50 -0
  227. package/dist/lexicons/tools/ozone/inbox/getAccountStatus.defs.d.ts.map +1 -0
  228. package/dist/lexicons/tools/ozone/inbox/getAccountStatus.defs.js +22 -0
  229. package/dist/lexicons/tools/ozone/inbox/getAccountStatus.defs.js.map +1 -0
  230. package/dist/lexicons/tools/ozone/inbox/getAccountStatus.js +6 -0
  231. package/dist/lexicons/tools/ozone/inbox/getAccountStatus.js.map +1 -0
  232. package/dist/lexicons/tools/ozone/inbox/getActionedSubject.d.ts +3 -0
  233. package/dist/lexicons/tools/ozone/inbox/getActionedSubject.d.ts.map +1 -0
  234. package/dist/lexicons/tools/ozone/inbox/getActionedSubject.defs.d.ts +35 -0
  235. package/dist/lexicons/tools/ozone/inbox/getActionedSubject.defs.d.ts.map +1 -0
  236. package/dist/lexicons/tools/ozone/inbox/getActionedSubject.defs.js +23 -0
  237. package/dist/lexicons/tools/ozone/inbox/getActionedSubject.defs.js.map +1 -0
  238. package/dist/lexicons/tools/ozone/inbox/getActionedSubject.js +6 -0
  239. package/dist/lexicons/tools/ozone/inbox/getActionedSubject.js.map +1 -0
  240. package/dist/lexicons/tools/ozone/inbox/getNotificationPreferences.d.ts +3 -0
  241. package/dist/lexicons/tools/ozone/inbox/getNotificationPreferences.d.ts.map +1 -0
  242. package/dist/lexicons/tools/ozone/inbox/getNotificationPreferences.defs.d.ts +29 -0
  243. package/dist/lexicons/tools/ozone/inbox/getNotificationPreferences.defs.d.ts.map +1 -0
  244. package/dist/lexicons/tools/ozone/inbox/getNotificationPreferences.defs.js +19 -0
  245. package/dist/lexicons/tools/ozone/inbox/getNotificationPreferences.defs.js.map +1 -0
  246. package/dist/lexicons/tools/ozone/inbox/getNotificationPreferences.js +6 -0
  247. package/dist/lexicons/tools/ozone/inbox/getNotificationPreferences.js.map +1 -0
  248. package/dist/lexicons/tools/ozone/inbox/getReport.d.ts +3 -0
  249. package/dist/lexicons/tools/ozone/inbox/getReport.d.ts.map +1 -0
  250. package/dist/lexicons/tools/ozone/inbox/getReport.defs.d.ts +75 -0
  251. package/dist/lexicons/tools/ozone/inbox/getReport.defs.d.ts.map +1 -0
  252. package/dist/lexicons/tools/ozone/inbox/getReport.defs.js +52 -0
  253. package/dist/lexicons/tools/ozone/inbox/getReport.defs.js.map +1 -0
  254. package/dist/lexicons/tools/ozone/inbox/getReport.js +6 -0
  255. package/dist/lexicons/tools/ozone/inbox/getReport.js.map +1 -0
  256. package/dist/lexicons/tools/ozone/inbox/getUnreadCount.d.ts +3 -0
  257. package/dist/lexicons/tools/ozone/inbox/getUnreadCount.d.ts.map +1 -0
  258. package/dist/lexicons/tools/ozone/inbox/getUnreadCount.defs.d.ts +43 -0
  259. package/dist/lexicons/tools/ozone/inbox/getUnreadCount.defs.d.ts.map +1 -0
  260. package/dist/lexicons/tools/ozone/inbox/getUnreadCount.defs.js +28 -0
  261. package/dist/lexicons/tools/ozone/inbox/getUnreadCount.defs.js.map +1 -0
  262. package/dist/lexicons/tools/ozone/inbox/getUnreadCount.js +6 -0
  263. package/dist/lexicons/tools/ozone/inbox/getUnreadCount.js.map +1 -0
  264. package/dist/lexicons/tools/ozone/inbox/listActionedSubjects.d.ts +3 -0
  265. package/dist/lexicons/tools/ozone/inbox/listActionedSubjects.d.ts.map +1 -0
  266. package/dist/lexicons/tools/ozone/inbox/listActionedSubjects.defs.d.ts +41 -0
  267. package/dist/lexicons/tools/ozone/inbox/listActionedSubjects.defs.d.ts.map +1 -0
  268. package/dist/lexicons/tools/ozone/inbox/listActionedSubjects.defs.js +33 -0
  269. package/dist/lexicons/tools/ozone/inbox/listActionedSubjects.defs.js.map +1 -0
  270. package/dist/lexicons/tools/ozone/inbox/listActionedSubjects.js +6 -0
  271. package/dist/lexicons/tools/ozone/inbox/listActionedSubjects.js.map +1 -0
  272. package/dist/lexicons/tools/ozone/inbox/listNotifications.d.ts +3 -0
  273. package/dist/lexicons/tools/ozone/inbox/listNotifications.d.ts.map +1 -0
  274. package/dist/lexicons/tools/ozone/inbox/listNotifications.defs.d.ts +48 -0
  275. package/dist/lexicons/tools/ozone/inbox/listNotifications.defs.d.ts.map +1 -0
  276. package/dist/lexicons/tools/ozone/inbox/listNotifications.defs.js +31 -0
  277. package/dist/lexicons/tools/ozone/inbox/listNotifications.defs.js.map +1 -0
  278. package/dist/lexicons/tools/ozone/inbox/listNotifications.js +6 -0
  279. package/dist/lexicons/tools/ozone/inbox/listNotifications.js.map +1 -0
  280. package/dist/lexicons/tools/ozone/inbox/listReports.d.ts +3 -0
  281. package/dist/lexicons/tools/ozone/inbox/listReports.d.ts.map +1 -0
  282. package/dist/lexicons/tools/ozone/inbox/listReports.defs.d.ts +72 -0
  283. package/dist/lexicons/tools/ozone/inbox/listReports.defs.d.ts.map +1 -0
  284. package/dist/lexicons/tools/ozone/inbox/listReports.defs.js +57 -0
  285. package/dist/lexicons/tools/ozone/inbox/listReports.defs.js.map +1 -0
  286. package/dist/lexicons/tools/ozone/inbox/listReports.js +6 -0
  287. package/dist/lexicons/tools/ozone/inbox/listReports.js.map +1 -0
  288. package/dist/lexicons/tools/ozone/inbox/putNotificationPreferences.d.ts +3 -0
  289. package/dist/lexicons/tools/ozone/inbox/putNotificationPreferences.d.ts.map +1 -0
  290. package/dist/lexicons/tools/ozone/inbox/putNotificationPreferences.defs.d.ts +32 -0
  291. package/dist/lexicons/tools/ozone/inbox/putNotificationPreferences.defs.d.ts.map +1 -0
  292. package/dist/lexicons/tools/ozone/inbox/putNotificationPreferences.defs.js +22 -0
  293. package/dist/lexicons/tools/ozone/inbox/putNotificationPreferences.defs.js.map +1 -0
  294. package/dist/lexicons/tools/ozone/inbox/putNotificationPreferences.js +6 -0
  295. package/dist/lexicons/tools/ozone/inbox/putNotificationPreferences.js.map +1 -0
  296. package/dist/lexicons/tools/ozone/inbox/updateSeen.d.ts +3 -0
  297. package/dist/lexicons/tools/ozone/inbox/updateSeen.d.ts.map +1 -0
  298. package/dist/lexicons/tools/ozone/inbox/updateSeen.defs.d.ts +40 -0
  299. package/dist/lexicons/tools/ozone/inbox/updateSeen.defs.d.ts.map +1 -0
  300. package/dist/lexicons/tools/ozone/inbox/updateSeen.defs.js +21 -0
  301. package/dist/lexicons/tools/ozone/inbox/updateSeen.defs.js.map +1 -0
  302. package/dist/lexicons/tools/ozone/inbox/updateSeen.js +6 -0
  303. package/dist/lexicons/tools/ozone/inbox/updateSeen.js.map +1 -0
  304. package/dist/lexicons/tools/ozone/inbox.d.ts +10 -0
  305. package/dist/lexicons/tools/ozone/inbox.d.ts.map +1 -1
  306. package/dist/lexicons/tools/ozone/inbox.js +10 -0
  307. package/dist/lexicons/tools/ozone/inbox.js.map +1 -1
  308. package/dist/lexicons/tools/ozone/moderation/defs.defs.d.ts +10 -0
  309. package/dist/lexicons/tools/ozone/moderation/defs.defs.d.ts.map +1 -1
  310. package/dist/lexicons/tools/ozone/moderation/defs.defs.js +5 -0
  311. package/dist/lexicons/tools/ozone/moderation/defs.defs.js.map +1 -1
  312. package/dist/lexicons/tools/ozone/queue/defs.defs.d.ts +17 -1
  313. package/dist/lexicons/tools/ozone/queue/defs.defs.d.ts.map +1 -1
  314. package/dist/lexicons/tools/ozone/queue/defs.defs.js +8 -0
  315. package/dist/lexicons/tools/ozone/queue/defs.defs.js.map +1 -1
  316. package/dist/lexicons/tools/ozone/report/defs.defs.d.ts +71 -3
  317. package/dist/lexicons/tools/ozone/report/defs.defs.d.ts.map +1 -1
  318. package/dist/lexicons/tools/ozone/report/defs.defs.js +34 -0
  319. package/dist/lexicons/tools/ozone/report/defs.defs.js.map +1 -1
  320. package/dist/lexicons/tools/ozone/server/getCapabilities.d.ts +3 -0
  321. package/dist/lexicons/tools/ozone/server/getCapabilities.d.ts.map +1 -0
  322. package/dist/lexicons/tools/ozone/server/getCapabilities.defs.d.ts +26 -0
  323. package/dist/lexicons/tools/ozone/server/getCapabilities.defs.d.ts.map +1 -0
  324. package/dist/lexicons/tools/ozone/server/getCapabilities.defs.js +22 -0
  325. package/dist/lexicons/tools/ozone/server/getCapabilities.defs.js.map +1 -0
  326. package/dist/lexicons/tools/ozone/server/getCapabilities.js +6 -0
  327. package/dist/lexicons/tools/ozone/server/getCapabilities.js.map +1 -0
  328. package/dist/lexicons/tools/ozone/server.d.ts +1 -0
  329. package/dist/lexicons/tools/ozone/server.d.ts.map +1 -1
  330. package/dist/lexicons/tools/ozone/server.js +1 -0
  331. package/dist/lexicons/tools/ozone/server.js.map +1 -1
  332. package/dist/pipethrough.d.ts.map +1 -1
  333. package/dist/pipethrough.js +2 -4
  334. package/dist/pipethrough.js.map +1 -1
  335. package/package.json +12 -12
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @atproto/pds
2
2
 
3
+ ## 0.5.39
4
+
5
+ ### Patch Changes
6
+
7
+ - [#5629](https://github.com/bluesky-social/atproto/pull/5629) [`32f8e45`](https://github.com/bluesky-social/atproto/commit/32f8e454f199f4355574e452f660098a55365706) Thanks [@matthieusieben](https://github.com/matthieusieben)! - Allow users that last signed in on a device within 30 days to skip OTP.
8
+ - Updated dependencies [[`32f8e45`](https://github.com/bluesky-social/atproto/commit/32f8e454f199f4355574e452f660098a55365706), [`32f8e45`](https://github.com/bluesky-social/atproto/commit/32f8e454f199f4355574e452f660098a55365706), [`32f8e45`](https://github.com/bluesky-social/atproto/commit/32f8e454f199f4355574e452f660098a55365706), [`32f8e45`](https://github.com/bluesky-social/atproto/commit/32f8e454f199f4355574e452f660098a55365706), [`32f8e45`](https://github.com/bluesky-social/atproto/commit/32f8e454f199f4355574e452f660098a55365706)]:
9
+ - @atproto/oauth-provider@0.24.0
10
+
11
+ ## 0.5.38
12
+
13
+ ### Patch Changes
14
+
15
+ - [#5550](https://github.com/bluesky-social/atproto/pull/5550) [`3013430`](https://github.com/bluesky-social/atproto/commit/3013430ed7433edd4c70d2970428d0ab803f6e85) Thanks [@foysalit](https://github.com/foysalit)! - Add viewer-facing moderation inbox reads for configurable account standing, report details, and cursor-paginated action history, with PDS proxy access and read-only moderator previews. Include appeal attribution in moderator event views, structured policy details in takedown actions, and pending, resolved, and unread actioned-subject filters based on appeal report state. Keep moderator notes private.
16
+
17
+ Page reports through reporter/time indexes with bounded hydration and source ownership validation. Batch subject hydration, reuse indexes for report summaries, and limit latest appeal lookups to one row in SQL. Add non-appeal reporter/time indexes, with the inbox migration ordered after the reporter DID column migration.
18
+
19
+ Add OZONE_INBOX_START_AT to limit report, action, and appeal history by creation time, with a public subject/action creation-time index. Cover structured policy names, links, and fallback URLs in mapper regression tests.
20
+ - Updated dependencies [[`a044af7`](https://github.com/bluesky-social/atproto/commit/a044af7bd7b522ca51229d7686f5b6413be6eee7)]:
21
+ - @atproto-labs/opentelemetry-node@0.3.1
22
+
3
23
  ## 0.5.37
4
24
 
5
25
  ### Patch Changes
@@ -183,11 +183,12 @@ export declare class AccountManager {
183
183
  }>;
184
184
  rotateRefreshToken(id: string): any;
185
185
  revokeRefreshToken(id: string): Promise<boolean>;
186
- login({ identifier, password, authFactorToken, locale, }: {
186
+ login({ identifier, password, authFactorToken, locale, allowOtpBypassFor, }: {
187
187
  identifier: string;
188
188
  password: string;
189
189
  authFactorToken?: string | undefined;
190
190
  locale?: string | undefined;
191
+ allowOtpBypassFor?: readonly DidString[];
191
192
  }): Promise<{
192
193
  user: ActorAccount;
193
194
  appPassword: password.AppPassDescript | null;
@@ -1 +1 @@
1
- {"version":3,"file":"account-manager.d.ts","sourceRoot":"","sources":["../../src/account-manager/account-manager.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAC5C,OAAO,KAAK,EAAE,MAAM,IAAI,SAAS,EAAE,MAAM,cAAc,CAAA;AAIvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAA;AAC9C,OAA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AE,MAAM,CAAA;QACd,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,GAAG,OAAO,CAAC,YAAY,CAAC,CAyDxB;IAEK,aAAa,CAAC,IAAI,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,sCAS5D;IAEK,qBAAqB,CAAC,IAAI,EAAE;QAAE,GAAG,EAAE,SAAS,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,iBAUrE;CACF"}
@@ -376,7 +376,7 @@ export class AccountManager {
376
376
  }
377
377
  // Login
378
378
  // ----------
379
- async login({ identifier, password, authFactorToken, locale, }) {
379
+ async login({ identifier, password, authFactorToken, locale, allowOtpBypassFor = [], }) {
380
380
  const start = Date.now();
381
381
  try {
382
382
  const identifierNormalized = identifier.toLowerCase();
@@ -413,6 +413,7 @@ export class AccountManager {
413
413
  }
414
414
  else if (user.email !== null &&
415
415
  user.emailAuthFactorAt !== null &&
416
+ !allowOtpBypassFor.includes(user.did) &&
416
417
  appPassword === null) {
417
418
  const token = await this.createEmailToken(user.did, 'auth_factor');
418
419
  await this.mailer.sendSignInAuthFactor({ token, handle: user.handle, locale }, { to: user.email });
@@ -1 +1 @@
1
- {"version":3,"file":"account-manager.js","sourceRoot":"","sources":["../../src/account-manager/account-manager.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAGhC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAC/D,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAG5D,OAAO,EAIL,oBAAoB,GACrB,MAAM,cAAc,CAAA;AAErB,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,UAAU,GACX,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,sBA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H,CAAC;CACF","sourcesContent":["import assert from 'node:assert'\nimport type { KeyObject } from 'node:crypto'\nimport type { Client as PlcClient } from '@did-plc/lib'\nimport { isEmailValid } from '@hapi/address'\nimport { isDisposableEmail } from 'disposable-email-domains-js'\nimport { HOUR, obfuscateEmail, wait } from '@atproto/common'\nimport type { Keypair } from '@atproto/crypto'\nimport type { IdResolver } from '@atproto/identity'\nimport {\n type AtIdentifierString,\n type DidString,\n type HandleString,\n isAtIdentifierString,\n} from '@atproto/lex'\nimport type { Cid } from '@atproto/lex-data'\nimport {\n INVALID_HANDLE,\n currentDatetimeString,\n isValidTld,\n} from '@atproto/syntax'\nimport { AuthRequiredError, InvalidRequestError } from '@atproto/xrpc-server'\nimport type { ActorStore } from '../actor-store/actor-store.js'\nimport { assertValidDidDocumentForService } from '../api/com/atproto/server/util.js'\nimport { AuthScope } from '../auth-scope.js'\nimport type { ServerConfig } from '../config/config.js'\nimport { softDeleted } from '../db/index.js'\nimport { hasExplicitSlur } from '../handle/explicit-slurs.js'\nimport {\n baseNormalizeAndValidate,\n ensureHandleServiceConstraints,\n isServiceDomain,\n} from '../handle/index.js'\nimport type { com } from '../lexicons/index.js'\nimport { httpLogger } from '../logger.js'\nimport type { ServerMailer } from '../mailer/index.js'\nimport type { Sequencer } from '../sequencer/index.js'\nimport {\n type AccountDb,\n type EmailTokenPurpose,\n getDb,\n getMigrator,\n} from './db/index.js'\nimport * as accountHelpers from './helpers/account.js'\nimport { AccountStatus, type ActorAccount } from './helpers/account.js'\nimport * as auth from './helpers/auth.js'\nimport * as authorizedClientHelper from './helpers/authorized-client.js'\nimport * as emailAuthFactor from './helpers/email-auth-factor.js'\nimport * as emailToken from './helpers/email-token.js'\nimport * as invite from './helpers/invite.js'\nimport * as password from './helpers/password.js'\nimport * as repo from './helpers/repo.js'\nimport * as scrypt from './helpers/scrypt.js'\nimport * as token from './helpers/token.js'\n\nexport { AccountStatus, formatAccountStatus } from './helpers/account.js'\n\nexport type UpdateAccountEmailOptions = {\n sendConfirmationEmail?: boolean\n locale?: string\n}\n\n/**\n * Thrown by {@link AccountManager.login} when the identifier resolved to a\n * known account but the supplied credentials (account password / app\n * password) did not match. The matched `did` is attached so downstream\n * callers can distinguish \"identifier known, credentials wrong\" from\n * \"identifier unknown\" (which continues to throw a plain\n * {@link AuthRequiredError}).\n *\n * Callers should take care that remote clients *cannot* distinguish the above,\n * to prevent enumeration attacks. (Tested for in\n * packages/pds/tests/auth.test.ts)\n */\nexport class InvalidPasswordError extends AuthRequiredError {\n constructor(\n public readonly did: DidString,\n errorMessage = 'Invalid identifier or password',\n ) {\n super(errorMessage)\n }\n}\n\n/**\n * Thrown by {@link AccountManager.login} when the credentials were valid but\n * the account requires a second authentication factor. A one-time code has\n * already been dispatched by the time this is thrown.\n *\n * XRPC-native like every other error this class raises: `AuthFactorTokenRequired`\n * is the error name `com.atproto.server.createSession` declares, so that path\n * needs no translation. The OAuth boundary ({@link OAuthStore.authenticateAccount})\n * converts it to `SecondAuthenticationFactorRequiredError` — which is why\n * `factor` and `hint` are carried as fields rather than baked into the message.\n *\n * @NOTE Subclasses {@link AuthRequiredError}, so any `instanceof` check against\n * the base class must come *after* this one — see the ordering note in\n * `OAuthStore.authenticateAccount`.\n */\nexport class AuthFactorRequiredError extends AuthRequiredError {\n constructor(\n public readonly factor: 'emailOtp',\n public readonly hint: string,\n errorMessage = 'A sign in code has been sent to your email address',\n ) {\n super(errorMessage, 'AuthFactorTokenRequired')\n }\n}\n\nexport type AccountManagerDbConfig = {\n accountDbLoc: string\n disableWalAutoCheckpoint: boolean\n}\n\nexport class AccountManager {\n readonly db: AccountDb\n\n constructor(\n readonly cfg: ServerConfig,\n readonly actorStore: ActorStore,\n readonly idResolver: IdResolver,\n readonly jwtKey: KeyObject,\n readonly mailer: ServerMailer,\n readonly sequencer: Sequencer,\n readonly plcClient: PlcClient,\n readonly plcRotationKey: Keypair,\n ) {\n this.db = getDb(cfg.db.accountDbLoc, cfg.db.disableWalAutoCheckpoint)\n }\n\n get serviceDid(): DidString {\n return this.cfg.service.did\n }\n\n get serviceHandleDomains(): string[] {\n return this.cfg.identity.serviceHandleDomains\n }\n\n async migrateOrThrow() {\n await this.db.ensureWal()\n await getMigrator(this.db).migrateToLatestOrThrow()\n }\n\n async close() {\n await this.db.close()\n }\n\n // Account\n // ----------\n\n async getAccount(\n handleOrDid: AtIdentifierString,\n flags?: accountHelpers.AvailabilityFlags,\n ): Promise<ActorAccount | null> {\n return accountHelpers.getAccount(this.db, handleOrDid, flags)\n }\n\n async getAccounts(\n dids: DidString[],\n flags?: accountHelpers.AvailabilityFlags,\n ): Promise<Map<string, ActorAccount>> {\n return accountHelpers.getAccounts(this.db, dids, flags)\n }\n\n async getAccountByEmail(\n email: string,\n flags?: accountHelpers.AvailabilityFlags,\n ): Promise<ActorAccount | null> {\n return accountHelpers.getAccountByEmail(this.db, email, flags)\n }\n\n async isAccountActivated(did: DidString): Promise<boolean> {\n const account = await this.getAccount(did, { includeDeactivated: true })\n if (!account) return false\n return !account.deactivatedAt\n }\n\n async getDidForActor(\n handleOrDid: AtIdentifierString,\n flags?: accountHelpers.AvailabilityFlags,\n ): Promise<DidString | null> {\n const got = await this.getAccount(handleOrDid, flags)\n return got?.did ?? null\n }\n\n async getAccountStatus(handleOrDid: AtIdentifierString) {\n const got = await this.getAccount(handleOrDid, {\n includeDeactivated: true,\n includeTakenDown: true,\n })\n\n const { active, status = active ? AccountStatus.Active : undefined } =\n accountHelpers.formatAccountStatus(got)\n assert(status != null)\n return { status, account: got } as\n | { status: AccountStatus.Deleted; account: null }\n | { status: AccountStatus.Takendown; account: ActorAccount }\n | { status: AccountStatus.Deactivated; account: ActorAccount }\n | { status: AccountStatus.Active; account: ActorAccount }\n }\n\n async normalizeAndValidateHandle(\n handle: string,\n {\n did,\n allowAnyValid = false,\n }: {\n did?: string\n allowAnyValid?: boolean\n } = {},\n ): Promise<HandleString> {\n const normalized = baseNormalizeAndValidate(handle)\n\n // tld validation\n if (!isValidTld(normalized)) {\n throw new InvalidRequestError(\n 'Handle TLD is invalid or disallowed',\n 'InvalidHandle',\n )\n }\n // slur check\n if (!allowAnyValid && hasExplicitSlur(normalized)) {\n throw new InvalidRequestError(\n 'Inappropriate language in handle',\n 'InvalidHandle',\n )\n }\n if (isServiceDomain(normalized, this.serviceHandleDomains)) {\n // verify constraints on a service domain\n ensureHandleServiceConstraints(\n normalized,\n this.serviceHandleDomains,\n allowAnyValid,\n )\n } else {\n // When creating an account (no did yet), we require the handle to be a\n // local service domain. Updating to a custom handle will be possible once\n // the account was created.\n if (did == null) {\n throw new InvalidRequestError(\n 'Not a supported handle domain',\n 'UnsupportedDomain',\n )\n }\n\n // verify resolution of a non-service domain\n const resolvedDid = await this.idResolver.handle.resolve(normalized)\n if (resolvedDid !== did) {\n // @TODO This should use a distinct error code\n throw new InvalidRequestError('External handle did not resolve to DID')\n }\n }\n\n return normalized\n }\n\n async createAccount({\n did,\n handle,\n email,\n password,\n repoCid,\n repoRev,\n inviteCode,\n deactivated,\n refreshJwt,\n }: {\n did: DidString\n handle: HandleString\n email?: string\n password?: string\n repoCid: Cid\n repoRev: string\n inviteCode?: string\n deactivated?: boolean\n refreshJwt?: string\n }) {\n if (password && password.length > scrypt.NEW_PASSWORD_MAX_LENGTH) {\n throw new InvalidRequestError('Password too long')\n }\n\n const passwordScrypt =\n email && password ? await scrypt.genSaltAndHash(password) : undefined\n\n const now = currentDatetimeString()\n return this.db.transaction(async (dbTxn) => {\n if (inviteCode) {\n await invite.ensureInviteIsAvailable(dbTxn, inviteCode)\n }\n\n await accountHelpers.registerActor(dbTxn, { did, handle, deactivated })\n\n if (email && passwordScrypt) {\n await accountHelpers.registerAccount(dbTxn, {\n did,\n email,\n passwordScrypt,\n })\n }\n\n await invite.recordInviteUse(dbTxn, {\n did,\n inviteCode,\n now,\n })\n\n if (refreshJwt) {\n await auth.storeRefreshToken(\n dbTxn,\n auth.decodeRefreshToken(refreshJwt),\n null,\n )\n }\n\n await repo.updateRoot(dbTxn, did, repoCid, repoRev)\n })\n }\n\n async createAccountAndSession(opts: {\n did: DidString\n handle: HandleString\n email?: string\n password?: string\n repoCid: Cid\n repoRev: string\n inviteCode?: string\n deactivated?: boolean\n }) {\n const { accessJwt, refreshJwt } = await auth.createTokens({\n did: opts.did,\n jwtKey: this.jwtKey,\n serviceDid: this.serviceDid,\n scope: AuthScope.Access,\n })\n\n await this.createAccount({ ...opts, refreshJwt })\n\n return { accessJwt, refreshJwt }\n }\n\n /**\n * Validates the requested handle, updates the PLC document if needed, persists\n * the new handle locally, and emits an identity event.\n *\n * @throws {InvalidRequestError} when the handle is invalid, taken by another\n * account, or cannot be resolved for non-service domains.\n *\n * @see {@link AccountManager.updateAccountHandle} for behavior when the PLC update fails.\n */\n async updateHandle(\n did: DidString,\n newHandle: string,\n options?: { allowAnyValid?: boolean },\n ): Promise<ActorAccount & { handle: HandleString }> {\n const { account, handle } = await this.validateHandleUpdate(\n did,\n newHandle,\n options,\n )\n\n if (did.startsWith('did:plc:')) {\n // @TODO We should verify the status before issuing a PLC update.\n await this.plcClient.updateHandle(did, this.plcRotationKey, handle)\n } else {\n const resolved = await this.idResolver.did.resolveAtprotoData(did, true)\n if (resolved.handle !== handle) {\n throw new InvalidRequestError(\n 'DID is not properly configured for handle',\n )\n }\n }\n\n // @NOTE If the next line fails (for any reason), we don't \"rollback\" the\n // PLC update above. The caller can just call this method again.\n await this.updateAccountHandle(did, handle)\n\n return { ...account, handle }\n }\n\n async validateHandleUpdate(\n did: DidString,\n newHandle: string,\n options?: { allowAnyValid?: boolean },\n ): Promise<{\n did: DidString\n handle: HandleString\n // Returned for convenience\n account: ActorAccount\n }> {\n const account = await this.getAccount(did, { includeDeactivated: true })\n if (!account) {\n throw new InvalidRequestError('Account not found')\n }\n\n const handle = await this.normalizeAndValidateHandle(newHandle, {\n allowAnyValid: options?.allowAnyValid,\n did,\n })\n\n // Pessimistic check to handle spam: also enforced by updateAccountHandle() and the db.\n const existing = await this.getAccount(handle, {\n includeDeactivated: true,\n includeTakenDown: true,\n })\n\n if (existing && existing.did !== did) {\n throw new InvalidRequestError(\n `Handle already taken: ${handle}`,\n 'HandleNotAvailable',\n )\n }\n\n return { did, handle, account }\n }\n\n /**\n * @note Failure to emit the identity event will silently be ignored. Users\n * can emit the event again by updating their handle to the same value.\n */\n async updateAccountHandle(\n did: DidString,\n handle: HandleString,\n ): Promise<void> {\n await accountHelpers.updateHandle(this.db, did, handle)\n\n try {\n await this.sequencer.sequenceIdentity(did, handle)\n } catch (err) {\n httpLogger.error({ err, did, handle }, 'failed to sequence handle update')\n }\n }\n\n async deleteAccount(did: DidString) {\n return accountHelpers.deleteAccount(this.db, did)\n }\n\n async takedownAccount(\n did: DidString,\n takedown: com.atproto.admin.defs.StatusAttr,\n ) {\n await this.db.transaction(async (dbTxn) => {\n await accountHelpers.updateAccountTakedownStatus(dbTxn, did, takedown)\n await auth.revokeRefreshTokensByDid(dbTxn, did)\n await token.removeByDid(dbTxn, did)\n })\n\n await this.sequenceAccountStatus(did)\n }\n\n async getAccountAdminStatus(did: DidString) {\n return accountHelpers.getAccountAdminStatus(this.db, did)\n }\n\n async updateRepoRoot(did: DidString, cid: Cid, rev: string) {\n return repo.updateRoot(this.db, did, cid, rev)\n }\n\n async deactivateAccount(\n did: DidString,\n options?: {\n deleteCredentials?: boolean\n deleteAfter?: string | null\n },\n ) {\n const wasUpdated = await this.db.transaction(async (dbTxn) => {\n if (options?.deleteCredentials) {\n await token.removeByDid(dbTxn, did)\n await authorizedClientHelper.deleteAllAuthorizedClients(dbTxn, did)\n await password.deleteAllAppPasswords(dbTxn, did)\n }\n\n return accountHelpers.deactivateAccount(\n dbTxn,\n did,\n options?.deleteAfter ?? null,\n )\n })\n\n if (!wasUpdated) {\n throw new InvalidRequestError('Account not found')\n }\n\n const accountStatus = await this.getAccountStatus(did)\n\n // Account is likely soft-deleted (takendown)\n if (accountStatus.status === AccountStatus.Deleted) {\n throw new InvalidRequestError('Account not found')\n }\n\n await this.sequencer.sequenceAccount(did, accountStatus.status)\n\n return accountStatus\n }\n\n async activateAccount(did: DidString) {\n await assertValidDidDocumentForService(this, did)\n\n const found = await accountHelpers.activateAccount(this.db, did, {\n // We cannot activate a takendown account\n includeTakenDown: false,\n includeDeactivated: true,\n })\n if (!found) {\n throw new InvalidRequestError('user not found', 'AccountNotFound')\n }\n\n const accountStatus = await this.getAccountStatus(did)\n\n const { account, status } = accountStatus\n\n if (status === AccountStatus.Deleted) {\n // A concurrent operation deleted the account\n throw new InvalidRequestError('user not found', 'AccountNotFound')\n }\n\n const syncData = await this.actorStore.read(did, (store) => {\n return store.repo.getSyncEventData()\n })\n\n await this.sequencer.sequenceAccountActivation(\n did,\n account.handle ?? INVALID_HANDLE,\n status,\n syncData,\n )\n\n return accountStatus\n }\n\n async sequenceAccountStatus(did: DidString) {\n const { status } = await this.getAccountStatus(did)\n await this.sequencer.sequenceAccount(did, status)\n }\n\n // Auth\n // ----------\n\n async createSession(\n did: DidString,\n appPassword: password.AppPassDescript | null,\n isSoftDeleted = false,\n ) {\n const { accessJwt, refreshJwt } = await auth.createTokens({\n did,\n jwtKey: this.jwtKey,\n serviceDid: this.serviceDid,\n scope: auth.formatScope(appPassword, isSoftDeleted),\n })\n // For soft deleted accounts don't store refresh token so that it can't be rotated.\n if (!isSoftDeleted) {\n const refreshPayload = auth.decodeRefreshToken(refreshJwt)\n await auth.storeRefreshToken(this.db, refreshPayload, appPassword)\n }\n return { accessJwt, refreshJwt }\n }\n\n async rotateRefreshToken(id: string) {\n const token = await auth.getRefreshToken(this.db, id)\n if (!token) return null\n\n const now = new Date()\n\n // take the chance to tidy all of a user's expired tokens\n // does not need to be transactional since this is just best-effort\n await auth.deleteExpiredRefreshTokens(this.db, token.did, now.toISOString())\n\n // Shorten the refresh token lifespan down from its\n // original expiration time to its revocation grace period.\n const prevExpiresAt = new Date(token.expiresAt)\n const REFRESH_GRACE_MS = 2 * HOUR\n const graceExpiresAt = new Date(now.getTime() + REFRESH_GRACE_MS)\n\n const expiresAt =\n graceExpiresAt < prevExpiresAt ? graceExpiresAt : prevExpiresAt\n\n if (expiresAt <= now) {\n return null\n }\n\n // Determine the next refresh token id: upon refresh token\n // reuse you always receive a refresh token with the same id.\n const nextId = token.nextId ?? auth.getRefreshTokenId()\n\n const { accessJwt, refreshJwt } = await auth.createTokens({\n did: token.did,\n jwtKey: this.jwtKey,\n serviceDid: this.serviceDid,\n scope: auth.formatScope(token.appPassword),\n jti: nextId,\n })\n\n const refreshPayload = auth.decodeRefreshToken(refreshJwt)\n try {\n await this.db.transaction((dbTxn) =>\n Promise.all([\n auth.addRefreshGracePeriod(dbTxn, {\n id,\n expiresAt: expiresAt.toISOString(),\n nextId,\n }),\n auth.storeRefreshToken(dbTxn, refreshPayload, token.appPassword),\n ]),\n )\n } catch (err) {\n if (err instanceof auth.ConcurrentRefreshError) {\n return this.rotateRefreshToken(id)\n }\n throw err\n }\n return { accessJwt, refreshJwt }\n }\n\n async revokeRefreshToken(id: string) {\n return auth.revokeRefreshToken(this.db, id)\n }\n\n // Login\n // ----------\n\n async login({\n identifier,\n password,\n authFactorToken,\n locale,\n }: {\n identifier: string\n password: string\n authFactorToken?: string | undefined\n // Only the OAuth sign-in path carries one; `com.atproto.server.createSession`\n // declares no locale input, so the challenge email falls back to the\n // default template there.\n locale?: string | undefined\n }): Promise<{\n // @TODO we should rename this \"account\" for consistency\n user: ActorAccount\n appPassword: password.AppPassDescript | null\n isSoftDeleted: boolean\n }> {\n const start = Date.now()\n try {\n const identifierNormalized = identifier.toLowerCase()\n\n const user = identifierNormalized.includes('@')\n ? await this.getAccountByEmail(identifierNormalized, {\n includeDeactivated: true,\n includeTakenDown: true,\n })\n : isAtIdentifierString(identifierNormalized)\n ? await this.getAccount(identifierNormalized, {\n includeDeactivated: true,\n includeTakenDown: true,\n })\n : null\n\n if (!user) {\n throw new AuthRequiredError('Invalid identifier or password')\n }\n const isSoftDeleted = softDeleted(user)\n\n let appPassword: password.AppPassDescript | null = null\n const validAccountPass = await this.verifyAccountPassword(\n user.did,\n password,\n )\n if (!validAccountPass) {\n // takendown/suspended accounts cannot login with app password\n if (isSoftDeleted) {\n throw new InvalidPasswordError(user.did)\n }\n appPassword = await this.verifyAppPassword(user.did, password)\n if (appPassword === null) {\n throw new InvalidPasswordError(user.did)\n }\n }\n\n if (authFactorToken) {\n await this.assertValidEmailTokenAndCleanup(\n user.did,\n 'auth_factor',\n authFactorToken,\n )\n // require email factor when not using an app password\n } else if (\n user.email !== null &&\n user.emailAuthFactorAt !== null &&\n appPassword === null\n ) {\n const token = await this.createEmailToken(user.did, 'auth_factor')\n\n await this.mailer.sendSignInAuthFactor(\n { token, handle: user.handle, locale },\n { to: user.email },\n )\n\n throw new AuthFactorRequiredError(\n 'emailOtp',\n obfuscateEmail(user.email),\n )\n }\n\n return { user, appPassword, isSoftDeleted }\n } finally {\n // Mitigate timing attacks\n await wait(350 - (Date.now() - start))\n }\n }\n\n // Passwords\n // ----------\n\n async createAppPassword(did: DidString, name: string, privileged: boolean) {\n return password.createAppPassword(this.db, did, name, privileged)\n }\n\n async listAppPasswords(did: DidString) {\n return password.listAppPasswords(this.db, did)\n }\n\n async verifyAccountPassword(\n did: DidString,\n passwordStr: string,\n ): Promise<boolean> {\n if (passwordStr.length > scrypt.OLD_PASSWORD_MAX_LENGTH) {\n // @NOTE Avoid throwing from here to avoid leaking account email validity\n // through error messages.\n return false\n }\n\n return password.verifyAccountPassword(this.db, did, passwordStr)\n }\n\n async verifyAppPassword(\n did: DidString,\n passwordStr: string,\n ): Promise<password.AppPassDescript | null> {\n return password.verifyAppPassword(this.db, did, passwordStr)\n }\n\n async revokeAppPassword(did: DidString, name: string) {\n await this.db.transaction(async (dbTxn) =>\n Promise.all([\n password.deleteAppPassword(dbTxn, did, name),\n auth.revokeAppPasswordRefreshToken(dbTxn, did, name),\n ]),\n )\n }\n\n // Invites\n // ----------\n\n async ensureInviteIsAvailable(code: string) {\n return invite.ensureInviteIsAvailable(this.db, code)\n }\n\n async createInviteCodes(\n toCreate: { account: string; codes: string[] }[],\n useCount: number,\n ) {\n return invite.createInviteCodes(this.db, toCreate, useCount)\n }\n\n async createAccountInviteCodes(\n forAccount: string,\n codes: string[],\n expectedTotal: number,\n disabled: 0 | 1,\n ) {\n return invite.createAccountInviteCodes(\n this.db,\n forAccount,\n codes,\n expectedTotal,\n disabled,\n )\n }\n\n async getAccountInvitesCodes(did: DidString) {\n const inviteCodes = await invite.getAccountsInviteCodes(this.db, [did])\n return inviteCodes.get(did) ?? []\n }\n\n async getAccountsInvitesCodes(dids: DidString[]) {\n return invite.getAccountsInviteCodes(this.db, dids)\n }\n\n async getInvitedByForAccounts(dids: DidString[]) {\n return invite.getInvitedByForAccounts(this.db, dids)\n }\n\n async getInviteCodesUses(codes: string[]) {\n return invite.getInviteCodesUses(this.db, codes)\n }\n\n async setAccountInvitesDisabled(did: DidString, disabled: boolean) {\n return invite.setAccountInvitesDisabled(this.db, did, disabled)\n }\n\n async disableInviteCodes(opts: { codes: string[]; accounts: string[] }) {\n return invite.disableInviteCodes(this.db, opts)\n }\n\n // Email Tokens\n // ----------\n\n async createEmailToken(did: DidString, purpose: EmailTokenPurpose) {\n return emailToken.createEmailToken(this.db, did, purpose)\n }\n\n async assertValidEmailToken(\n did: DidString,\n purpose: EmailTokenPurpose,\n token: string,\n ) {\n return emailToken.assertValidToken(this.db, did, purpose, token)\n }\n\n async assertValidEmailTokenAndCleanup(\n did: DidString,\n purpose: EmailTokenPurpose,\n token: string,\n ) {\n await emailToken.assertValidToken(this.db, did, purpose, token)\n await emailToken.deleteEmailToken(this.db, did, purpose)\n }\n\n async requestEmailConfirmation(did: DidString, opts?: { locale?: string }) {\n const account = await this.getAccount(did, {\n includeDeactivated: true,\n includeTakenDown: true,\n })\n\n if (!account) {\n throw new InvalidRequestError('account not found')\n }\n\n if (!account.email) {\n throw new InvalidRequestError('account does not have an email address')\n }\n\n const locale = opts?.locale\n const token = await this.createEmailToken(did, 'confirm_email')\n\n await this.mailer.sendConfirmEmail({ token, locale }, { to: account.email })\n }\n\n async confirmEmail(did: DidString, email: string, token: string) {\n const user = await this.getAccount(did, {\n includeDeactivated: true,\n includeTakenDown: true,\n })\n\n if (!user) {\n throw new InvalidRequestError('user not found', 'AccountNotFound')\n }\n\n if (user.email !== email.toLowerCase()) {\n throw new InvalidRequestError('invalid email', 'InvalidEmail')\n }\n\n await emailToken.assertValidToken(this.db, did, 'confirm_email', token)\n const now = currentDatetimeString()\n await this.db.transaction(async (dbTxn) => {\n await emailToken.deleteEmailToken(dbTxn, did, 'confirm_email')\n await accountHelpers.setEmailConfirmedAt(dbTxn, did, now)\n })\n\n user.emailConfirmedAt = now\n\n return user\n }\n\n async requestEmailUpdate(\n did: DidString,\n opts?: { locale?: string },\n ): Promise<{ tokenRequired: boolean }> {\n const account = await this.getAccount(did, {\n includeDeactivated: true,\n includeTakenDown: true,\n })\n\n if (!account) {\n throw new InvalidRequestError('account not found')\n }\n\n if (!account.email) {\n throw new InvalidRequestError('account does not have an email address')\n }\n\n const token = account.emailConfirmedAt\n ? await this.createEmailToken(did, 'update_email')\n : null\n\n if (token) {\n await this.mailer.sendUpdateEmail(\n { token, locale: opts?.locale },\n { to: account.email },\n )\n }\n\n return { tokenRequired: !!token }\n }\n\n async checkUpdateEmail(\n did: DidString,\n email: string,\n token?: string,\n ): Promise<ActorAccount> {\n if (!isEmailValid(email) || isDisposableEmail(email)) {\n throw new InvalidRequestError(\n 'This email address is not supported, please use a different email.',\n )\n }\n\n const account = await this.getAccount(did, {\n includeDeactivated: true,\n includeTakenDown: true,\n })\n\n if (!account) {\n throw new InvalidRequestError(\n `Could not find user info for account: ${did}`,\n )\n }\n\n const tokenRequired = !!account.emailConfirmedAt\n\n if (token) {\n await this.assertValidEmailToken(did, 'update_email', token)\n } else if (tokenRequired) {\n // require a token if account email is confirmed\n throw new InvalidRequestError(\n 'confirmation token required',\n 'TokenRequired',\n )\n }\n\n return account\n }\n\n /**\n * @throws UserAlreadyExistsError if the new email is already in use by another account\n */\n async updateEmail(\n did: DidString,\n email: string,\n token?: string,\n opts?: UpdateAccountEmailOptions,\n ): Promise<ActorAccount> {\n const account = await this.checkUpdateEmail(did, email, token)\n\n await this.updateAccountEmail(did, email, opts)\n\n account.email = email\n account.emailConfirmedAt = null\n\n return account\n }\n\n async updateAccountEmail(\n did: DidString,\n email: string,\n opts?: UpdateAccountEmailOptions,\n ) {\n await this.db.transaction(async (dbTxn) => {\n await accountHelpers.updateEmail(dbTxn, did, email)\n // @NOTE In the same transaction as the email write, deliberately: the\n // new address is unconfirmed, and 2FA against an unconfirmed address can\n // lock the user out. The account-manager UI warns about this, see\n // `show2FaWarningOnEmailUpdate` in context.ts.\n await emailAuthFactor.deleteForDid(dbTxn, did)\n await emailToken.deleteAllEmailTokens(dbTxn, did)\n })\n\n // Proactively send a confirmation email so that the user can confirm the\n // new email immediately.\n if (opts?.sendConfirmationEmail) {\n const token = await this.createEmailToken(did, 'confirm_email')\n const { locale } = opts\n await this.mailer.sendConfirmEmail({ token, locale }, { to: email })\n }\n }\n\n /**\n * Enable email-based two-factor authentication. Enabling is immediate: the\n * account must already have a confirmed email matching `email`, since the\n * factor delivers one-time codes to that address. Returns\n * `{ account, tokenRequired }` for symmetry with future factors that require\n * a confirmation step; email-based 2FA never does, so `tokenRequired` is\n * always `false`.\n *\n * @throws InvalidRequestError if the account has no confirmed, matching email\n */\n async enableEmailAuthFactor(opts: { did: DidString }): Promise<ActorAccount> {\n const { did } = opts\n\n const account = await this.getAccount(did, {\n includeDeactivated: true,\n includeTakenDown: true,\n })\n\n if (!account) {\n throw new InvalidRequestError('account not found')\n }\n\n // Already enabled → nothing to change (idempotent).\n if (account.emailAuthFactorAt) {\n return account\n }\n\n // Email confirmed → attempt to enable email-based 2FA.\n if (account.email && account.emailConfirmedAt) {\n const emailAuthFactorAt = await emailAuthFactor.enable(\n this.db,\n did,\n account.email,\n )\n\n // @NOTE The confirmed-email requirement is enforced in the insert's own\n // SELECT, so a miss here means the address stopped being confirmed (or\n // changed) between that read and this write. Nothing was persisted, so\n // don't hand back an account claiming otherwise.\n if (emailAuthFactorAt) {\n account.emailAuthFactorAt = emailAuthFactorAt\n\n return account\n }\n }\n\n throw new InvalidRequestError(\n 'A confirmed email address is required to enable email-based two-factor authentication',\n )\n }\n\n /**\n * Disable email-based two-factor authentication. This supports a two-phase\n * flow, if a token isn't initially supplied for proving control of the inbox\n * which prevents a hijacked session from silently turning off the factor. The\n * second call (with a valid `token`) actually disables it. Disabling an\n * already-disabled factor is an idempotent no-op.\n *\n * @throws InvalidRequestError if the account has no matching email, or the\n * token is invalid\n * @throws InvalidRequestError with `TokenRequired` error code if a\n * confirmation token is required but not provided\n */\n async disableEmailAuthFactor(opts: {\n did: DidString\n token?: string\n locale?: string\n }): Promise<ActorAccount> {\n const { did, token, locale } = opts\n\n const account = await this.getAccount(did, {\n includeDeactivated: true,\n includeTakenDown: true,\n })\n\n if (!account) {\n throw new InvalidRequestError('account not found')\n }\n\n // Already disabled → idempotent no-op; nothing to confirm, no OTP sent.\n if (!account.emailAuthFactorAt) {\n return account\n }\n\n // Fool-proof: account in invalid state\n if (!account.email) {\n throw new Error('account has no email address')\n }\n\n // Phase one: no token yet, send a one-time code and signal \"pending\". MUST\n // use `update_email` due to social-app using requestEmailUpdate, not\n // two-step updateEmail:\n if (!token) {\n const otp = await this.createEmailToken(did, 'update_email')\n await this.mailer.sendUpdateEmail(\n { token: otp, locale: locale },\n { to: account.email },\n )\n\n throw new InvalidRequestError(\n 'confirmation token required',\n 'TokenRequired',\n )\n }\n\n // Phase two: verify the one-time code, then disable the factor.\n await this.assertValidEmailTokenAndCleanup(did, 'update_email', token)\n\n // The returned flag is deliberately ignored here, unlike in\n // `enableEmailAuthFactor`. Disabling only conditions the write on `did` and\n // `email` matching, so a miss means no row matched either, leaving nothing\n // worth reporting. A deleted account has no factor left to disable, and a\n // changed email drops the factor row in the same transaction (see\n // `updateAccountEmail`). That second case stops arising once unconfirmed\n // emails get a column of their own, since `account.email` will no longer\n // move mid-flow; the conclusion holds either way.\n //\n // Enabling is the opposite: a miss there leaves the account in the very\n // state the caller asked to change, hence the throw.\n await emailAuthFactor.disable(this.db, did, account.email)\n\n account.emailAuthFactorAt = null\n\n return account\n }\n\n async resetPassword(opts: { password: string; token: string }) {\n const did = await emailToken.assertValidTokenAndFindDid(\n this.db,\n 'reset_password',\n opts.token,\n )\n await this.updateAccountPassword({ did, password: opts.password })\n\n return did\n }\n\n async updateAccountPassword(opts: { did: DidString; password: string }) {\n const { did } = opts\n const passwordScrypt = await scrypt.genSaltAndHash(opts.password)\n await this.db.transaction(async (dbTxn) =>\n Promise.all([\n password.updateUserPassword(dbTxn, { did, passwordScrypt }),\n emailToken.deleteEmailToken(dbTxn, did, 'reset_password'),\n auth.revokeRefreshTokensByDid(dbTxn, did),\n ]),\n )\n }\n}\n"]}
1
+ {"version":3,"file":"account-manager.js","sourceRoot":"","sources":["../../src/account-manager/account-manager.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAA;AAGhC,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAC/D,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAA;AAG5D,OAAO,EAIL,oBAAoB,GACrB,MAAM,cAAc,CAAA;AAErB,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,UAAU,GACX,MAAM,iBAAiB,CAAA;AACxB,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAE7E,OAAO,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAA;AACpF,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC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QAC1E,kEAAkE;QAClE,yEAAyE;QACzE,yEAAyE;QACzE,kDAAkD;QAClD,EAAE;QACF,wEAAwE;QACxE,qDAAqD;QACrD,MAAM,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,KAAK,CAAC,CAAA;QAE1D,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAA;QAEhC,OAAO,OAAO,CAAA;IAChB,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,IAAyC;QAC3D,MAAM,GAAG,GAAG,MAAM,UAAU,CAAC,0BAA0B,CACrD,IAAI,CAAC,EAAE,EACP,gBAAgB,EAChB,IAAI,CAAC,KAAK,CACX,CAAA;QACD,MAAM,IAAI,CAAC,qBAAqB,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAA;QAElE,OAAO,GAAG,CAAA;IACZ,CAAC;IAED,KAAK,CAAC,qBAAqB,CAAC,IAA0C;QACpE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;QACpB,MAAM,cAAc,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;QACjE,MAAM,IAAI,CAAC,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CACxC,OAAO,CAAC,GAAG,CAAC;YACV,QAAQ,CAAC,kBAAkB,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,cAAc,EAAE,CAAC;YAC3D,UAAU,CAAC,gBAAgB,CAAC,KAAK,EAAE,GAAG,EAAE,gBAAgB,CAAC;YACzD,IAAI,CAAC,wBAAwB,CAAC,KAAK,EAAE,GAAG,CAAC;SAC1C,CAAC,CACH,CAAA;IACH,CAAC;CACF","sourcesContent":["import assert from 'node:assert'\nimport type { KeyObject } from 'node:crypto'\nimport type { Client as PlcClient } from '@did-plc/lib'\nimport { isEmailValid } from '@hapi/address'\nimport { isDisposableEmail } from 'disposable-email-domains-js'\nimport { HOUR, obfuscateEmail, wait } from '@atproto/common'\nimport type { Keypair } from '@atproto/crypto'\nimport type { IdResolver } from '@atproto/identity'\nimport {\n type AtIdentifierString,\n type DidString,\n type HandleString,\n isAtIdentifierString,\n} from '@atproto/lex'\nimport type { Cid } from '@atproto/lex-data'\nimport {\n INVALID_HANDLE,\n currentDatetimeString,\n isValidTld,\n} from '@atproto/syntax'\nimport { AuthRequiredError, InvalidRequestError } from '@atproto/xrpc-server'\nimport type { ActorStore } from '../actor-store/actor-store.js'\nimport { assertValidDidDocumentForService } from '../api/com/atproto/server/util.js'\nimport { AuthScope } from '../auth-scope.js'\nimport type { ServerConfig } from '../config/config.js'\nimport { softDeleted } from '../db/index.js'\nimport { hasExplicitSlur } from '../handle/explicit-slurs.js'\nimport {\n baseNormalizeAndValidate,\n ensureHandleServiceConstraints,\n isServiceDomain,\n} from '../handle/index.js'\nimport type { com } from '../lexicons/index.js'\nimport { httpLogger } from '../logger.js'\nimport type { ServerMailer } from '../mailer/index.js'\nimport type { Sequencer } from '../sequencer/index.js'\nimport {\n type AccountDb,\n type EmailTokenPurpose,\n getDb,\n getMigrator,\n} from './db/index.js'\nimport * as accountHelpers from './helpers/account.js'\nimport { AccountStatus, type ActorAccount } from './helpers/account.js'\nimport * as auth from './helpers/auth.js'\nimport * as authorizedClientHelper from './helpers/authorized-client.js'\nimport * as emailAuthFactor from './helpers/email-auth-factor.js'\nimport * as emailToken from './helpers/email-token.js'\nimport * as invite from './helpers/invite.js'\nimport * as password from './helpers/password.js'\nimport * as repo from './helpers/repo.js'\nimport * as scrypt from './helpers/scrypt.js'\nimport * as token from './helpers/token.js'\n\nexport { AccountStatus, formatAccountStatus } from './helpers/account.js'\n\nexport type UpdateAccountEmailOptions = {\n sendConfirmationEmail?: boolean\n locale?: string\n}\n\n/**\n * Thrown by {@link AccountManager.login} when the identifier resolved to a\n * known account but the supplied credentials (account password / app\n * password) did not match. The matched `did` is attached so downstream\n * callers can distinguish \"identifier known, credentials wrong\" from\n * \"identifier unknown\" (which continues to throw a plain\n * {@link AuthRequiredError}).\n *\n * Callers should take care that remote clients *cannot* distinguish the above,\n * to prevent enumeration attacks. (Tested for in\n * packages/pds/tests/auth.test.ts)\n */\nexport class InvalidPasswordError extends AuthRequiredError {\n constructor(\n public readonly did: DidString,\n errorMessage = 'Invalid identifier or password',\n ) {\n super(errorMessage)\n }\n}\n\n/**\n * Thrown by {@link AccountManager.login} when the credentials were valid but\n * the account requires a second authentication factor. A one-time code has\n * already been dispatched by the time this is thrown.\n *\n * XRPC-native like every other error this class raises: `AuthFactorTokenRequired`\n * is the error name `com.atproto.server.createSession` declares, so that path\n * needs no translation. The OAuth boundary ({@link OAuthStore.authenticateAccount})\n * converts it to `SecondAuthenticationFactorRequiredError` — which is why\n * `factor` and `hint` are carried as fields rather than baked into the message.\n *\n * @NOTE Subclasses {@link AuthRequiredError}, so any `instanceof` check against\n * the base class must come *after* this one — see the ordering note in\n * `OAuthStore.authenticateAccount`.\n */\nexport class AuthFactorRequiredError extends AuthRequiredError {\n constructor(\n public readonly factor: 'emailOtp',\n public readonly hint: string,\n errorMessage = 'A sign in code has been sent to your email address',\n ) {\n super(errorMessage, 'AuthFactorTokenRequired')\n }\n}\n\nexport type AccountManagerDbConfig = {\n accountDbLoc: string\n disableWalAutoCheckpoint: boolean\n}\n\nexport class AccountManager {\n readonly db: AccountDb\n\n constructor(\n readonly cfg: ServerConfig,\n readonly actorStore: ActorStore,\n readonly idResolver: IdResolver,\n readonly jwtKey: KeyObject,\n readonly mailer: ServerMailer,\n readonly sequencer: Sequencer,\n readonly plcClient: PlcClient,\n readonly plcRotationKey: Keypair,\n ) {\n this.db = getDb(cfg.db.accountDbLoc, cfg.db.disableWalAutoCheckpoint)\n }\n\n get serviceDid(): DidString {\n return this.cfg.service.did\n }\n\n get serviceHandleDomains(): string[] {\n return this.cfg.identity.serviceHandleDomains\n }\n\n async migrateOrThrow() {\n await this.db.ensureWal()\n await getMigrator(this.db).migrateToLatestOrThrow()\n }\n\n async close() {\n await this.db.close()\n }\n\n // Account\n // ----------\n\n async getAccount(\n handleOrDid: AtIdentifierString,\n flags?: accountHelpers.AvailabilityFlags,\n ): Promise<ActorAccount | null> {\n return accountHelpers.getAccount(this.db, handleOrDid, flags)\n }\n\n async getAccounts(\n dids: DidString[],\n flags?: accountHelpers.AvailabilityFlags,\n ): Promise<Map<string, ActorAccount>> {\n return accountHelpers.getAccounts(this.db, dids, flags)\n }\n\n async getAccountByEmail(\n email: string,\n flags?: accountHelpers.AvailabilityFlags,\n ): Promise<ActorAccount | null> {\n return accountHelpers.getAccountByEmail(this.db, email, flags)\n }\n\n async isAccountActivated(did: DidString): Promise<boolean> {\n const account = await this.getAccount(did, { includeDeactivated: true })\n if (!account) return false\n return !account.deactivatedAt\n }\n\n async getDidForActor(\n handleOrDid: AtIdentifierString,\n flags?: accountHelpers.AvailabilityFlags,\n ): Promise<DidString | null> {\n const got = await this.getAccount(handleOrDid, flags)\n return got?.did ?? null\n }\n\n async getAccountStatus(handleOrDid: AtIdentifierString) {\n const got = await this.getAccount(handleOrDid, {\n includeDeactivated: true,\n includeTakenDown: true,\n })\n\n const { active, status = active ? AccountStatus.Active : undefined } =\n accountHelpers.formatAccountStatus(got)\n assert(status != null)\n return { status, account: got } as\n | { status: AccountStatus.Deleted; account: null }\n | { status: AccountStatus.Takendown; account: ActorAccount }\n | { status: AccountStatus.Deactivated; account: ActorAccount }\n | { status: AccountStatus.Active; account: ActorAccount }\n }\n\n async normalizeAndValidateHandle(\n handle: string,\n {\n did,\n allowAnyValid = false,\n }: {\n did?: string\n allowAnyValid?: boolean\n } = {},\n ): Promise<HandleString> {\n const normalized = baseNormalizeAndValidate(handle)\n\n // tld validation\n if (!isValidTld(normalized)) {\n throw new InvalidRequestError(\n 'Handle TLD is invalid or disallowed',\n 'InvalidHandle',\n )\n }\n // slur check\n if (!allowAnyValid && hasExplicitSlur(normalized)) {\n throw new InvalidRequestError(\n 'Inappropriate language in handle',\n 'InvalidHandle',\n )\n }\n if (isServiceDomain(normalized, this.serviceHandleDomains)) {\n // verify constraints on a service domain\n ensureHandleServiceConstraints(\n normalized,\n this.serviceHandleDomains,\n allowAnyValid,\n )\n } else {\n // When creating an account (no did yet), we require the handle to be a\n // local service domain. Updating to a custom handle will be possible once\n // the account was created.\n if (did == null) {\n throw new InvalidRequestError(\n 'Not a supported handle domain',\n 'UnsupportedDomain',\n )\n }\n\n // verify resolution of a non-service domain\n const resolvedDid = await this.idResolver.handle.resolve(normalized)\n if (resolvedDid !== did) {\n // @TODO This should use a distinct error code\n throw new InvalidRequestError('External handle did not resolve to DID')\n }\n }\n\n return normalized\n }\n\n async createAccount({\n did,\n handle,\n email,\n password,\n repoCid,\n repoRev,\n inviteCode,\n deactivated,\n refreshJwt,\n }: {\n did: DidString\n handle: HandleString\n email?: string\n password?: string\n repoCid: Cid\n repoRev: string\n inviteCode?: string\n deactivated?: boolean\n refreshJwt?: string\n }) {\n if (password && password.length > scrypt.NEW_PASSWORD_MAX_LENGTH) {\n throw new InvalidRequestError('Password too long')\n }\n\n const passwordScrypt =\n email && password ? await scrypt.genSaltAndHash(password) : undefined\n\n const now = currentDatetimeString()\n return this.db.transaction(async (dbTxn) => {\n if (inviteCode) {\n await invite.ensureInviteIsAvailable(dbTxn, inviteCode)\n }\n\n await accountHelpers.registerActor(dbTxn, { did, handle, deactivated })\n\n if (email && passwordScrypt) {\n await accountHelpers.registerAccount(dbTxn, {\n did,\n email,\n passwordScrypt,\n })\n }\n\n await invite.recordInviteUse(dbTxn, {\n did,\n inviteCode,\n now,\n })\n\n if (refreshJwt) {\n await auth.storeRefreshToken(\n dbTxn,\n auth.decodeRefreshToken(refreshJwt),\n null,\n )\n }\n\n await repo.updateRoot(dbTxn, did, repoCid, repoRev)\n })\n }\n\n async createAccountAndSession(opts: {\n did: DidString\n handle: HandleString\n email?: string\n password?: string\n repoCid: Cid\n repoRev: string\n inviteCode?: string\n deactivated?: boolean\n }) {\n const { accessJwt, refreshJwt } = await auth.createTokens({\n did: opts.did,\n jwtKey: this.jwtKey,\n serviceDid: this.serviceDid,\n scope: AuthScope.Access,\n })\n\n await this.createAccount({ ...opts, refreshJwt })\n\n return { accessJwt, refreshJwt }\n }\n\n /**\n * Validates the requested handle, updates the PLC document if needed, persists\n * the new handle locally, and emits an identity event.\n *\n * @throws {InvalidRequestError} when the handle is invalid, taken by another\n * account, or cannot be resolved for non-service domains.\n *\n * @see {@link AccountManager.updateAccountHandle} for behavior when the PLC update fails.\n */\n async updateHandle(\n did: DidString,\n newHandle: string,\n options?: { allowAnyValid?: boolean },\n ): Promise<ActorAccount & { handle: HandleString }> {\n const { account, handle } = await this.validateHandleUpdate(\n did,\n newHandle,\n options,\n )\n\n if (did.startsWith('did:plc:')) {\n // @TODO We should verify the status before issuing a PLC update.\n await this.plcClient.updateHandle(did, this.plcRotationKey, handle)\n } else {\n const resolved = await this.idResolver.did.resolveAtprotoData(did, true)\n if (resolved.handle !== handle) {\n throw new InvalidRequestError(\n 'DID is not properly configured for handle',\n )\n }\n }\n\n // @NOTE If the next line fails (for any reason), we don't \"rollback\" the\n // PLC update above. The caller can just call this method again.\n await this.updateAccountHandle(did, handle)\n\n return { ...account, handle }\n }\n\n async validateHandleUpdate(\n did: DidString,\n newHandle: string,\n options?: { allowAnyValid?: boolean },\n ): Promise<{\n did: DidString\n handle: HandleString\n // Returned for convenience\n account: ActorAccount\n }> {\n const account = await this.getAccount(did, { includeDeactivated: true })\n if (!account) {\n throw new InvalidRequestError('Account not found')\n }\n\n const handle = await this.normalizeAndValidateHandle(newHandle, {\n allowAnyValid: options?.allowAnyValid,\n did,\n })\n\n // Pessimistic check to handle spam: also enforced by updateAccountHandle() and the db.\n const existing = await this.getAccount(handle, {\n includeDeactivated: true,\n includeTakenDown: true,\n })\n\n if (existing && existing.did !== did) {\n throw new InvalidRequestError(\n `Handle already taken: ${handle}`,\n 'HandleNotAvailable',\n )\n }\n\n return { did, handle, account }\n }\n\n /**\n * @note Failure to emit the identity event will silently be ignored. Users\n * can emit the event again by updating their handle to the same value.\n */\n async updateAccountHandle(\n did: DidString,\n handle: HandleString,\n ): Promise<void> {\n await accountHelpers.updateHandle(this.db, did, handle)\n\n try {\n await this.sequencer.sequenceIdentity(did, handle)\n } catch (err) {\n httpLogger.error({ err, did, handle }, 'failed to sequence handle update')\n }\n }\n\n async deleteAccount(did: DidString) {\n return accountHelpers.deleteAccount(this.db, did)\n }\n\n async takedownAccount(\n did: DidString,\n takedown: com.atproto.admin.defs.StatusAttr,\n ) {\n await this.db.transaction(async (dbTxn) => {\n await accountHelpers.updateAccountTakedownStatus(dbTxn, did, takedown)\n await auth.revokeRefreshTokensByDid(dbTxn, did)\n await token.removeByDid(dbTxn, did)\n })\n\n await this.sequenceAccountStatus(did)\n }\n\n async getAccountAdminStatus(did: DidString) {\n return accountHelpers.getAccountAdminStatus(this.db, did)\n }\n\n async updateRepoRoot(did: DidString, cid: Cid, rev: string) {\n return repo.updateRoot(this.db, did, cid, rev)\n }\n\n async deactivateAccount(\n did: DidString,\n options?: {\n deleteCredentials?: boolean\n deleteAfter?: string | null\n },\n ) {\n const wasUpdated = await this.db.transaction(async (dbTxn) => {\n if (options?.deleteCredentials) {\n await token.removeByDid(dbTxn, did)\n await authorizedClientHelper.deleteAllAuthorizedClients(dbTxn, did)\n await password.deleteAllAppPasswords(dbTxn, did)\n }\n\n return accountHelpers.deactivateAccount(\n dbTxn,\n did,\n options?.deleteAfter ?? null,\n )\n })\n\n if (!wasUpdated) {\n throw new InvalidRequestError('Account not found')\n }\n\n const accountStatus = await this.getAccountStatus(did)\n\n // Account is likely soft-deleted (takendown)\n if (accountStatus.status === AccountStatus.Deleted) {\n throw new InvalidRequestError('Account not found')\n }\n\n await this.sequencer.sequenceAccount(did, accountStatus.status)\n\n return accountStatus\n }\n\n async activateAccount(did: DidString) {\n await assertValidDidDocumentForService(this, did)\n\n const found = await accountHelpers.activateAccount(this.db, did, {\n // We cannot activate a takendown account\n includeTakenDown: false,\n includeDeactivated: true,\n })\n if (!found) {\n throw new InvalidRequestError('user not found', 'AccountNotFound')\n }\n\n const accountStatus = await this.getAccountStatus(did)\n\n const { account, status } = accountStatus\n\n if (status === AccountStatus.Deleted) {\n // A concurrent operation deleted the account\n throw new InvalidRequestError('user not found', 'AccountNotFound')\n }\n\n const syncData = await this.actorStore.read(did, (store) => {\n return store.repo.getSyncEventData()\n })\n\n await this.sequencer.sequenceAccountActivation(\n did,\n account.handle ?? INVALID_HANDLE,\n status,\n syncData,\n )\n\n return accountStatus\n }\n\n async sequenceAccountStatus(did: DidString) {\n const { status } = await this.getAccountStatus(did)\n await this.sequencer.sequenceAccount(did, status)\n }\n\n // Auth\n // ----------\n\n async createSession(\n did: DidString,\n appPassword: password.AppPassDescript | null,\n isSoftDeleted = false,\n ) {\n const { accessJwt, refreshJwt } = await auth.createTokens({\n did,\n jwtKey: this.jwtKey,\n serviceDid: this.serviceDid,\n scope: auth.formatScope(appPassword, isSoftDeleted),\n })\n // For soft deleted accounts don't store refresh token so that it can't be rotated.\n if (!isSoftDeleted) {\n const refreshPayload = auth.decodeRefreshToken(refreshJwt)\n await auth.storeRefreshToken(this.db, refreshPayload, appPassword)\n }\n return { accessJwt, refreshJwt }\n }\n\n async rotateRefreshToken(id: string) {\n const token = await auth.getRefreshToken(this.db, id)\n if (!token) return null\n\n const now = new Date()\n\n // take the chance to tidy all of a user's expired tokens\n // does not need to be transactional since this is just best-effort\n await auth.deleteExpiredRefreshTokens(this.db, token.did, now.toISOString())\n\n // Shorten the refresh token lifespan down from its\n // original expiration time to its revocation grace period.\n const prevExpiresAt = new Date(token.expiresAt)\n const REFRESH_GRACE_MS = 2 * HOUR\n const graceExpiresAt = new Date(now.getTime() + REFRESH_GRACE_MS)\n\n const expiresAt =\n graceExpiresAt < prevExpiresAt ? graceExpiresAt : prevExpiresAt\n\n if (expiresAt <= now) {\n return null\n }\n\n // Determine the next refresh token id: upon refresh token\n // reuse you always receive a refresh token with the same id.\n const nextId = token.nextId ?? auth.getRefreshTokenId()\n\n const { accessJwt, refreshJwt } = await auth.createTokens({\n did: token.did,\n jwtKey: this.jwtKey,\n serviceDid: this.serviceDid,\n scope: auth.formatScope(token.appPassword),\n jti: nextId,\n })\n\n const refreshPayload = auth.decodeRefreshToken(refreshJwt)\n try {\n await this.db.transaction((dbTxn) =>\n Promise.all([\n auth.addRefreshGracePeriod(dbTxn, {\n id,\n expiresAt: expiresAt.toISOString(),\n nextId,\n }),\n auth.storeRefreshToken(dbTxn, refreshPayload, token.appPassword),\n ]),\n )\n } catch (err) {\n if (err instanceof auth.ConcurrentRefreshError) {\n return this.rotateRefreshToken(id)\n }\n throw err\n }\n return { accessJwt, refreshJwt }\n }\n\n async revokeRefreshToken(id: string) {\n return auth.revokeRefreshToken(this.db, id)\n }\n\n // Login\n // ----------\n\n async login({\n identifier,\n password,\n authFactorToken,\n locale,\n allowOtpBypassFor = [],\n }: {\n identifier: string\n password: string\n authFactorToken?: string | undefined\n // Only the OAuth sign-in path carries one; `com.atproto.server.createSession`\n // declares no locale input, so the challenge email falls back to the\n // default template there.\n locale?: string | undefined\n allowOtpBypassFor?: readonly DidString[]\n }): Promise<{\n // @TODO we should rename this \"account\" for consistency\n user: ActorAccount\n appPassword: password.AppPassDescript | null\n isSoftDeleted: boolean\n }> {\n const start = Date.now()\n try {\n const identifierNormalized = identifier.toLowerCase()\n\n const user = identifierNormalized.includes('@')\n ? await this.getAccountByEmail(identifierNormalized, {\n includeDeactivated: true,\n includeTakenDown: true,\n })\n : isAtIdentifierString(identifierNormalized)\n ? await this.getAccount(identifierNormalized, {\n includeDeactivated: true,\n includeTakenDown: true,\n })\n : null\n\n if (!user) {\n throw new AuthRequiredError('Invalid identifier or password')\n }\n const isSoftDeleted = softDeleted(user)\n\n let appPassword: password.AppPassDescript | null = null\n const validAccountPass = await this.verifyAccountPassword(\n user.did,\n password,\n )\n if (!validAccountPass) {\n // takendown/suspended accounts cannot login with app password\n if (isSoftDeleted) {\n throw new InvalidPasswordError(user.did)\n }\n appPassword = await this.verifyAppPassword(user.did, password)\n if (appPassword === null) {\n throw new InvalidPasswordError(user.did)\n }\n }\n\n if (authFactorToken) {\n await this.assertValidEmailTokenAndCleanup(\n user.did,\n 'auth_factor',\n authFactorToken,\n )\n // require email factor when not using an app password\n } else if (\n user.email !== null &&\n user.emailAuthFactorAt !== null &&\n !allowOtpBypassFor.includes(user.did) &&\n appPassword === null\n ) {\n const token = await this.createEmailToken(user.did, 'auth_factor')\n\n await this.mailer.sendSignInAuthFactor(\n { token, handle: user.handle, locale },\n { to: user.email },\n )\n\n throw new AuthFactorRequiredError(\n 'emailOtp',\n obfuscateEmail(user.email),\n )\n }\n\n return { user, appPassword, isSoftDeleted }\n } finally {\n // Mitigate timing attacks\n await wait(350 - (Date.now() - start))\n }\n }\n\n // Passwords\n // ----------\n\n async createAppPassword(did: DidString, name: string, privileged: boolean) {\n return password.createAppPassword(this.db, did, name, privileged)\n }\n\n async listAppPasswords(did: DidString) {\n return password.listAppPasswords(this.db, did)\n }\n\n async verifyAccountPassword(\n did: DidString,\n passwordStr: string,\n ): Promise<boolean> {\n if (passwordStr.length > scrypt.OLD_PASSWORD_MAX_LENGTH) {\n // @NOTE Avoid throwing from here to avoid leaking account email validity\n // through error messages.\n return false\n }\n\n return password.verifyAccountPassword(this.db, did, passwordStr)\n }\n\n async verifyAppPassword(\n did: DidString,\n passwordStr: string,\n ): Promise<password.AppPassDescript | null> {\n return password.verifyAppPassword(this.db, did, passwordStr)\n }\n\n async revokeAppPassword(did: DidString, name: string) {\n await this.db.transaction(async (dbTxn) =>\n Promise.all([\n password.deleteAppPassword(dbTxn, did, name),\n auth.revokeAppPasswordRefreshToken(dbTxn, did, name),\n ]),\n )\n }\n\n // Invites\n // ----------\n\n async ensureInviteIsAvailable(code: string) {\n return invite.ensureInviteIsAvailable(this.db, code)\n }\n\n async createInviteCodes(\n toCreate: { account: string; codes: string[] }[],\n useCount: number,\n ) {\n return invite.createInviteCodes(this.db, toCreate, useCount)\n }\n\n async createAccountInviteCodes(\n forAccount: string,\n codes: string[],\n expectedTotal: number,\n disabled: 0 | 1,\n ) {\n return invite.createAccountInviteCodes(\n this.db,\n forAccount,\n codes,\n expectedTotal,\n disabled,\n )\n }\n\n async getAccountInvitesCodes(did: DidString) {\n const inviteCodes = await invite.getAccountsInviteCodes(this.db, [did])\n return inviteCodes.get(did) ?? []\n }\n\n async getAccountsInvitesCodes(dids: DidString[]) {\n return invite.getAccountsInviteCodes(this.db, dids)\n }\n\n async getInvitedByForAccounts(dids: DidString[]) {\n return invite.getInvitedByForAccounts(this.db, dids)\n }\n\n async getInviteCodesUses(codes: string[]) {\n return invite.getInviteCodesUses(this.db, codes)\n }\n\n async setAccountInvitesDisabled(did: DidString, disabled: boolean) {\n return invite.setAccountInvitesDisabled(this.db, did, disabled)\n }\n\n async disableInviteCodes(opts: { codes: string[]; accounts: string[] }) {\n return invite.disableInviteCodes(this.db, opts)\n }\n\n // Email Tokens\n // ----------\n\n async createEmailToken(did: DidString, purpose: EmailTokenPurpose) {\n return emailToken.createEmailToken(this.db, did, purpose)\n }\n\n async assertValidEmailToken(\n did: DidString,\n purpose: EmailTokenPurpose,\n token: string,\n ) {\n return emailToken.assertValidToken(this.db, did, purpose, token)\n }\n\n async assertValidEmailTokenAndCleanup(\n did: DidString,\n purpose: EmailTokenPurpose,\n token: string,\n ) {\n await emailToken.assertValidToken(this.db, did, purpose, token)\n await emailToken.deleteEmailToken(this.db, did, purpose)\n }\n\n async requestEmailConfirmation(did: DidString, opts?: { locale?: string }) {\n const account = await this.getAccount(did, {\n includeDeactivated: true,\n includeTakenDown: true,\n })\n\n if (!account) {\n throw new InvalidRequestError('account not found')\n }\n\n if (!account.email) {\n throw new InvalidRequestError('account does not have an email address')\n }\n\n const locale = opts?.locale\n const token = await this.createEmailToken(did, 'confirm_email')\n\n await this.mailer.sendConfirmEmail({ token, locale }, { to: account.email })\n }\n\n async confirmEmail(did: DidString, email: string, token: string) {\n const user = await this.getAccount(did, {\n includeDeactivated: true,\n includeTakenDown: true,\n })\n\n if (!user) {\n throw new InvalidRequestError('user not found', 'AccountNotFound')\n }\n\n if (user.email !== email.toLowerCase()) {\n throw new InvalidRequestError('invalid email', 'InvalidEmail')\n }\n\n await emailToken.assertValidToken(this.db, did, 'confirm_email', token)\n const now = currentDatetimeString()\n await this.db.transaction(async (dbTxn) => {\n await emailToken.deleteEmailToken(dbTxn, did, 'confirm_email')\n await accountHelpers.setEmailConfirmedAt(dbTxn, did, now)\n })\n\n user.emailConfirmedAt = now\n\n return user\n }\n\n async requestEmailUpdate(\n did: DidString,\n opts?: { locale?: string },\n ): Promise<{ tokenRequired: boolean }> {\n const account = await this.getAccount(did, {\n includeDeactivated: true,\n includeTakenDown: true,\n })\n\n if (!account) {\n throw new InvalidRequestError('account not found')\n }\n\n if (!account.email) {\n throw new InvalidRequestError('account does not have an email address')\n }\n\n const token = account.emailConfirmedAt\n ? await this.createEmailToken(did, 'update_email')\n : null\n\n if (token) {\n await this.mailer.sendUpdateEmail(\n { token, locale: opts?.locale },\n { to: account.email },\n )\n }\n\n return { tokenRequired: !!token }\n }\n\n async checkUpdateEmail(\n did: DidString,\n email: string,\n token?: string,\n ): Promise<ActorAccount> {\n if (!isEmailValid(email) || isDisposableEmail(email)) {\n throw new InvalidRequestError(\n 'This email address is not supported, please use a different email.',\n )\n }\n\n const account = await this.getAccount(did, {\n includeDeactivated: true,\n includeTakenDown: true,\n })\n\n if (!account) {\n throw new InvalidRequestError(\n `Could not find user info for account: ${did}`,\n )\n }\n\n const tokenRequired = !!account.emailConfirmedAt\n\n if (token) {\n await this.assertValidEmailToken(did, 'update_email', token)\n } else if (tokenRequired) {\n // require a token if account email is confirmed\n throw new InvalidRequestError(\n 'confirmation token required',\n 'TokenRequired',\n )\n }\n\n return account\n }\n\n /**\n * @throws UserAlreadyExistsError if the new email is already in use by another account\n */\n async updateEmail(\n did: DidString,\n email: string,\n token?: string,\n opts?: UpdateAccountEmailOptions,\n ): Promise<ActorAccount> {\n const account = await this.checkUpdateEmail(did, email, token)\n\n await this.updateAccountEmail(did, email, opts)\n\n account.email = email\n account.emailConfirmedAt = null\n\n return account\n }\n\n async updateAccountEmail(\n did: DidString,\n email: string,\n opts?: UpdateAccountEmailOptions,\n ) {\n await this.db.transaction(async (dbTxn) => {\n await accountHelpers.updateEmail(dbTxn, did, email)\n // @NOTE In the same transaction as the email write, deliberately: the\n // new address is unconfirmed, and 2FA against an unconfirmed address can\n // lock the user out. The account-manager UI warns about this, see\n // `show2FaWarningOnEmailUpdate` in context.ts.\n await emailAuthFactor.deleteForDid(dbTxn, did)\n await emailToken.deleteAllEmailTokens(dbTxn, did)\n })\n\n // Proactively send a confirmation email so that the user can confirm the\n // new email immediately.\n if (opts?.sendConfirmationEmail) {\n const token = await this.createEmailToken(did, 'confirm_email')\n const { locale } = opts\n await this.mailer.sendConfirmEmail({ token, locale }, { to: email })\n }\n }\n\n /**\n * Enable email-based two-factor authentication. Enabling is immediate: the\n * account must already have a confirmed email matching `email`, since the\n * factor delivers one-time codes to that address. Returns\n * `{ account, tokenRequired }` for symmetry with future factors that require\n * a confirmation step; email-based 2FA never does, so `tokenRequired` is\n * always `false`.\n *\n * @throws InvalidRequestError if the account has no confirmed, matching email\n */\n async enableEmailAuthFactor(opts: { did: DidString }): Promise<ActorAccount> {\n const { did } = opts\n\n const account = await this.getAccount(did, {\n includeDeactivated: true,\n includeTakenDown: true,\n })\n\n if (!account) {\n throw new InvalidRequestError('account not found')\n }\n\n // Already enabled → nothing to change (idempotent).\n if (account.emailAuthFactorAt) {\n return account\n }\n\n // Email confirmed → attempt to enable email-based 2FA.\n if (account.email && account.emailConfirmedAt) {\n const emailAuthFactorAt = await emailAuthFactor.enable(\n this.db,\n did,\n account.email,\n )\n\n // @NOTE The confirmed-email requirement is enforced in the insert's own\n // SELECT, so a miss here means the address stopped being confirmed (or\n // changed) between that read and this write. Nothing was persisted, so\n // don't hand back an account claiming otherwise.\n if (emailAuthFactorAt) {\n account.emailAuthFactorAt = emailAuthFactorAt\n\n return account\n }\n }\n\n throw new InvalidRequestError(\n 'A confirmed email address is required to enable email-based two-factor authentication',\n )\n }\n\n /**\n * Disable email-based two-factor authentication. This supports a two-phase\n * flow, if a token isn't initially supplied for proving control of the inbox\n * which prevents a hijacked session from silently turning off the factor. The\n * second call (with a valid `token`) actually disables it. Disabling an\n * already-disabled factor is an idempotent no-op.\n *\n * @throws InvalidRequestError if the account has no matching email, or the\n * token is invalid\n * @throws InvalidRequestError with `TokenRequired` error code if a\n * confirmation token is required but not provided\n */\n async disableEmailAuthFactor(opts: {\n did: DidString\n token?: string\n locale?: string\n }): Promise<ActorAccount> {\n const { did, token, locale } = opts\n\n const account = await this.getAccount(did, {\n includeDeactivated: true,\n includeTakenDown: true,\n })\n\n if (!account) {\n throw new InvalidRequestError('account not found')\n }\n\n // Already disabled → idempotent no-op; nothing to confirm, no OTP sent.\n if (!account.emailAuthFactorAt) {\n return account\n }\n\n // Fool-proof: account in invalid state\n if (!account.email) {\n throw new Error('account has no email address')\n }\n\n // Phase one: no token yet, send a one-time code and signal \"pending\". MUST\n // use `update_email` due to social-app using requestEmailUpdate, not\n // two-step updateEmail:\n if (!token) {\n const otp = await this.createEmailToken(did, 'update_email')\n await this.mailer.sendUpdateEmail(\n { token: otp, locale: locale },\n { to: account.email },\n )\n\n throw new InvalidRequestError(\n 'confirmation token required',\n 'TokenRequired',\n )\n }\n\n // Phase two: verify the one-time code, then disable the factor.\n await this.assertValidEmailTokenAndCleanup(did, 'update_email', token)\n\n // The returned flag is deliberately ignored here, unlike in\n // `enableEmailAuthFactor`. Disabling only conditions the write on `did` and\n // `email` matching, so a miss means no row matched either, leaving nothing\n // worth reporting. A deleted account has no factor left to disable, and a\n // changed email drops the factor row in the same transaction (see\n // `updateAccountEmail`). That second case stops arising once unconfirmed\n // emails get a column of their own, since `account.email` will no longer\n // move mid-flow; the conclusion holds either way.\n //\n // Enabling is the opposite: a miss there leaves the account in the very\n // state the caller asked to change, hence the throw.\n await emailAuthFactor.disable(this.db, did, account.email)\n\n account.emailAuthFactorAt = null\n\n return account\n }\n\n async resetPassword(opts: { password: string; token: string }) {\n const did = await emailToken.assertValidTokenAndFindDid(\n this.db,\n 'reset_password',\n opts.token,\n )\n await this.updateAccountPassword({ did, password: opts.password })\n\n return did\n }\n\n async updateAccountPassword(opts: { did: DidString; password: string }) {\n const { did } = opts\n const passwordScrypt = await scrypt.genSaltAndHash(opts.password)\n await this.db.transaction(async (dbTxn) =>\n Promise.all([\n password.updateUserPassword(dbTxn, { did, passwordScrypt }),\n emailToken.deleteEmailToken(dbTxn, did, 'reset_password'),\n auth.revokeRefreshTokensByDid(dbTxn, did),\n ]),\n )\n }\n}\n"]}
@@ -31,7 +31,7 @@ export declare class OAuthStore implements AccountStore, RequestStore, DeviceSto
31
31
  private verifyEmailAvailability;
32
32
  private verifyInviteCode;
33
33
  createAccount({ locale: _locale, inviteCode, handle, email, password, }: SignUpData): Promise<Account>;
34
- authenticateAccount({ locale, username: identifier, password, emailOtp, }: AuthenticateAccountData): Promise<Account>;
34
+ authenticateAccount({ locale, username: identifier, password, emailOtp, deviceAccounts, }: AuthenticateAccountData): Promise<Account>;
35
35
  setAuthorizedClient(did: Did, clientId: ClientId, data: AuthorizedClientData): Promise<void>;
36
36
  getAccount(did: Did): Promise<{
37
37
  account: Account;
@@ -1 +1 @@
1
- {"version":3,"file":"oauth-store.d.ts","sourceRoot":"","sources":["../../src/account-manager/oauth-store.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAA2B,MAAM,cAAc,CAAA;AAEnE,OAAO,EAAE,KAAK,OAAO,EAAoB,MAAM,iBAAiB,CAAA;AAChE,OAAO,EAEL,KAAK,YAAY,EAElB,MAAM,cAAc,CAAA;AAOrB,OAAO,KAAK,EACV,OAAO,EACP,YAAY,EACZ,uBAAuB,EACvB,oBAAoB,EACpB,iBAAiB,EACjB,QAAQ,EACR,IA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AAC,EACvB,GAAG,EACH,KAAK,EACL,KAAK,GACN,EAAE,uBAAuB,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAYnD;IAEK,kBAAkB,CAAC,EACvB,GAAG,EACH,MAAM,GACP,EAAE,uBAAuB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAE7D;IAEK,kBAAkB,CAAC,EACvB,GAAG,EACH,KAAK,EACL,KAAK,EACL,MAAM,GACP,EAAE,uBAAuB,GAAG,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAenD;IAEK,qBAAqB,CAAC,EAC1B,GAAG,GACJ,EAAE,0BAA0B,GAAG,OAAO,CAAC,OAAO,CAAC,CAY/C;IAEK,sBAAsB,CAAC,EAC3B,GAAG,EACH,KAAK,EACL,MAAM,GACP,EAAE,2BAA2B,GAAG,OAAO,CAAC,OAAO,CAAC,CAqBhD;IAEK,YAAY,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC,CAQtE;IAEK,iBAAiB,CAAC,EACtB,GAAG,EACH,WAAW,GACZ,EAAE,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC,CAO1C;IAEK,iBAAiB,CAAC,EAAE,GAAG,EAAE,EAAE,qBAAqB,GAAG,OAAO,CAAC,OAAO,CAAC,CAYxE;IAEK,oBAAoB,CAAC,EACzB,GAAG,EACH,MAAM,GACP,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC,CAuB3C;IAEK,oBAAoB,CAAC,EACzB,GAAG,EACH,KAAK,EACL,QAAQ,GACT,EAAE,yBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC,CAoC3C;YAEa,WAAW;YAWX,YAAY;CAmC3B"}
@@ -1,5 +1,6 @@
1
1
  import assert from 'node:assert';
2
2
  import { createOp as createPlcOp } from '@did-plc/lib';
3
+ import { DAY } from '@atproto/common';
3
4
  import { Secp256k1Keypair } from '@atproto/crypto';
4
5
  import { getBlobCidString, } from '@atproto/lex';
5
6
  import { HandleUnavailableError, InvalidCredentialsError, InvalidRequestError, SecondAuthenticationFactorRequiredError, } from '@atproto/oauth-provider/errors';
@@ -151,7 +152,7 @@ export class OAuthStore {
151
152
  throw err;
152
153
  }
153
154
  }
154
- async authenticateAccount({ locale, username: identifier, password, emailOtp, }) {
155
+ async authenticateAccount({ locale, username: identifier, password, emailOtp, deviceAccounts, }) {
155
156
  // @TODO (?) Send an email to the user to notify them of the login attempt
156
157
  try {
157
158
  const { user, appPassword, isSoftDeleted } = await this.accountManager.login({
@@ -159,6 +160,17 @@ export class OAuthStore {
159
160
  password,
160
161
  authFactorToken: emailOtp,
161
162
  locale,
163
+ // Allow users that last signed in on the same device within 30 days
164
+ // to skip OTP.
165
+ // @NOTE that oauth-provider will require a fresh sign-in (password)
166
+ // after one week. This allows to improve UX by reducing the frequency
167
+ // of OTP prompts for trusted devices.
168
+ // @NOTE this is based on Google Workspace approach that requires a
169
+ // fresh sign-in (password) every week, but does not require OTP when
170
+ // it does.
171
+ allowOtpBypassFor: deviceAccounts
172
+ .filter((da) => Date.now() - da.updatedAt.getTime() < 30 * DAY)
173
+ .map((da) => da.account.did),
162
174
  });
163
175
  if (isSoftDeleted) {
164
176
  throw new InvalidRequestError('Account was taken down');
@@ -175,7 +187,7 @@ export class OAuthStore {
175
187
  // Surfacing the matched `did` as the `sub` lets the oauth-provider's
176
188
  // `onSignInFailed` hook distinguish "identifier known, credentials wrong"
177
189
  // from "identifier unknown".
178
- throw new InvalidCredentialsError(err.message, err.did, err);
190
+ throw new InvalidCredentialsError(err.did, err);
179
191
  }
180
192
  // @NOTE The credentials were valid here — the account simply owes a
181
193
  // second factor, and `login()` has already sent the code. This is the
@@ -184,7 +196,7 @@ export class OAuthStore {
184
196
  throw new SecondAuthenticationFactorRequiredError(err.factor, err.hint, err);
185
197
  }
186
198
  if (err instanceof XrpcAuthRequiredError) {
187
- throw new InvalidCredentialsError(err.message, undefined, err);
199
+ throw new InvalidCredentialsError(null, err);
188
200
  }
189
201
  throw err;
190
202
  }
@@ -541,7 +553,7 @@ export class OAuthStore {
541
553
  }
542
554
  const validPass = await this.accountManager.verifyAccountPassword(did, password);
543
555
  if (!validPass) {
544
- throw new InvalidCredentialsError('Invalid did or password', did);
556
+ throw new InvalidCredentialsError(did);
545
557
  }
546
558
  await this.accountManager.assertValidEmailToken(did, 'delete_account', token);
547
559
  // @NOTE Order matters here: first "unlink" the account by removing it