@atproto/pds 0.5.0 → 0.5.2

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 (279) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/account-manager/account-manager.d.ts +35 -4
  3. package/dist/account-manager/account-manager.d.ts.map +1 -1
  4. package/dist/account-manager/account-manager.js +67 -6
  5. package/dist/account-manager/account-manager.js.map +1 -1
  6. package/dist/account-manager/helpers/account.d.ts +1 -1
  7. package/dist/account-manager/helpers/account.d.ts.map +1 -1
  8. package/dist/account-manager/helpers/account.js +10 -4
  9. package/dist/account-manager/helpers/account.js.map +1 -1
  10. package/dist/account-manager/oauth-store.d.ts +2 -1
  11. package/dist/account-manager/oauth-store.d.ts.map +1 -1
  12. package/dist/account-manager/oauth-store.js +61 -12
  13. package/dist/account-manager/oauth-store.js.map +1 -1
  14. package/dist/actor-store/record/reader.d.ts +1 -1
  15. package/dist/actor-store/record/reader.d.ts.map +1 -1
  16. package/dist/actor-store/record/reader.js.map +1 -1
  17. package/dist/api/app/bsky/actor/getPreferences.d.ts.map +1 -1
  18. package/dist/api/app/bsky/actor/getPreferences.js +7 -2
  19. package/dist/api/app/bsky/actor/getPreferences.js.map +1 -1
  20. package/dist/api/app/bsky/actor/putPreferences.d.ts.map +1 -1
  21. package/dist/api/app/bsky/actor/putPreferences.js +7 -2
  22. package/dist/api/app/bsky/actor/putPreferences.js.map +1 -1
  23. package/dist/api/com/atproto/admin/updateAccountHandle.d.ts.map +1 -1
  24. package/dist/api/com/atproto/admin/updateAccountHandle.js +33 -43
  25. package/dist/api/com/atproto/admin/updateAccountHandle.js.map +1 -1
  26. package/dist/api/com/atproto/identity/updateHandle.d.ts.map +1 -1
  27. package/dist/api/com/atproto/identity/updateHandle.js +39 -61
  28. package/dist/api/com/atproto/identity/updateHandle.js.map +1 -1
  29. package/dist/api/com/atproto/repo/getRecord.js +3 -3
  30. package/dist/api/com/atproto/repo/getRecord.js.map +1 -1
  31. package/dist/api/com/atproto/repo/putRecord.js +2 -2
  32. package/dist/api/com/atproto/repo/putRecord.js.map +1 -1
  33. package/dist/api/com/atproto/server/getServiceAuth.d.ts.map +1 -1
  34. package/dist/api/com/atproto/server/getServiceAuth.js +4 -0
  35. package/dist/api/com/atproto/server/getServiceAuth.js.map +1 -1
  36. package/dist/config/config.d.ts +5 -2
  37. package/dist/config/config.d.ts.map +1 -1
  38. package/dist/config/config.js +50 -46
  39. package/dist/config/config.js.map +1 -1
  40. package/dist/config/env.d.ts +1 -0
  41. package/dist/config/env.d.ts.map +1 -1
  42. package/dist/config/env.js +1 -0
  43. package/dist/config/env.js.map +1 -1
  44. package/dist/context.d.ts.map +1 -1
  45. package/dist/context.js +3 -3
  46. package/dist/context.js.map +1 -1
  47. package/dist/lexicons/app/bsky/actor/defs.defs.d.ts +8 -0
  48. package/dist/lexicons/app/bsky/actor/defs.defs.d.ts.map +1 -1
  49. package/dist/lexicons/app/bsky/actor/defs.defs.js +3 -0
  50. package/dist/lexicons/app/bsky/actor/defs.defs.js.map +1 -1
  51. package/dist/lexicons/app/bsky/actor/profile.defs.d.ts.map +1 -1
  52. package/dist/lexicons/app/bsky/actor/status.defs.d.ts.map +1 -1
  53. package/dist/lexicons/app/bsky/draft/defs.defs.d.ts +22 -0
  54. package/dist/lexicons/app/bsky/draft/defs.defs.d.ts.map +1 -1
  55. package/dist/lexicons/app/bsky/draft/defs.defs.js +11 -0
  56. package/dist/lexicons/app/bsky/draft/defs.defs.js.map +1 -1
  57. package/dist/lexicons/app/bsky/embed/gallery.d.ts +3 -0
  58. package/dist/lexicons/app/bsky/embed/gallery.d.ts.map +1 -0
  59. package/dist/lexicons/app/bsky/embed/gallery.defs.d.ts +130 -0
  60. package/dist/lexicons/app/bsky/embed/gallery.defs.d.ts.map +1 -0
  61. package/dist/lexicons/app/bsky/embed/gallery.defs.js +47 -0
  62. package/dist/lexicons/app/bsky/embed/gallery.defs.js.map +1 -0
  63. package/dist/lexicons/app/bsky/embed/gallery.js +6 -0
  64. package/dist/lexicons/app/bsky/embed/gallery.js.map +1 -0
  65. package/dist/lexicons/app/bsky/embed/record.defs.d.ts +2 -1
  66. package/dist/lexicons/app/bsky/embed/record.defs.d.ts.map +1 -1
  67. package/dist/lexicons/app/bsky/embed/record.defs.js +2 -0
  68. package/dist/lexicons/app/bsky/embed/record.defs.js.map +1 -1
  69. package/dist/lexicons/app/bsky/embed/recordWithMedia.defs.d.ts +13 -12
  70. package/dist/lexicons/app/bsky/embed/recordWithMedia.defs.d.ts.map +1 -1
  71. package/dist/lexicons/app/bsky/embed/recordWithMedia.defs.js +3 -0
  72. package/dist/lexicons/app/bsky/embed/recordWithMedia.defs.js.map +1 -1
  73. package/dist/lexicons/app/bsky/embed.d.ts +1 -0
  74. package/dist/lexicons/app/bsky/embed.d.ts.map +1 -1
  75. package/dist/lexicons/app/bsky/embed.js +1 -0
  76. package/dist/lexicons/app/bsky/embed.js.map +1 -1
  77. package/dist/lexicons/app/bsky/feed/defs.defs.d.ts +2 -1
  78. package/dist/lexicons/app/bsky/feed/defs.defs.d.ts.map +1 -1
  79. package/dist/lexicons/app/bsky/feed/defs.defs.js +2 -0
  80. package/dist/lexicons/app/bsky/feed/defs.defs.js.map +1 -1
  81. package/dist/lexicons/app/bsky/feed/generator.defs.d.ts.map +1 -1
  82. package/dist/lexicons/app/bsky/feed/like.defs.d.ts.map +1 -1
  83. package/dist/lexicons/app/bsky/feed/post.defs.d.ts +12 -11
  84. package/dist/lexicons/app/bsky/feed/post.defs.d.ts.map +1 -1
  85. package/dist/lexicons/app/bsky/feed/post.defs.js +2 -0
  86. package/dist/lexicons/app/bsky/feed/post.defs.js.map +1 -1
  87. package/dist/lexicons/app/bsky/feed/postgate.defs.d.ts.map +1 -1
  88. package/dist/lexicons/app/bsky/feed/repost.defs.d.ts.map +1 -1
  89. package/dist/lexicons/app/bsky/feed/threadgate.defs.d.ts.map +1 -1
  90. package/dist/lexicons/app/bsky/graph/block.defs.d.ts.map +1 -1
  91. package/dist/lexicons/app/bsky/graph/follow.defs.d.ts.map +1 -1
  92. package/dist/lexicons/app/bsky/graph/list.defs.d.ts.map +1 -1
  93. package/dist/lexicons/app/bsky/graph/listblock.defs.d.ts.map +1 -1
  94. package/dist/lexicons/app/bsky/graph/listitem.defs.d.ts.map +1 -1
  95. package/dist/lexicons/app/bsky/graph/starterpack.defs.d.ts.map +1 -1
  96. package/dist/lexicons/app/bsky/graph/verification.defs.d.ts.map +1 -1
  97. package/dist/lexicons/app/bsky/labeler/service.defs.d.ts.map +1 -1
  98. package/dist/lexicons/app/bsky/notification/declaration.defs.d.ts.map +1 -1
  99. package/dist/lexicons/chat/bsky/actor/declaration.defs.d.ts.map +1 -1
  100. package/dist/lexicons/chat/bsky/actor/getStatus.defs.d.ts +2 -0
  101. package/dist/lexicons/chat/bsky/actor/getStatus.defs.d.ts.map +1 -1
  102. package/dist/lexicons/chat/bsky/actor/getStatus.defs.js +1 -0
  103. package/dist/lexicons/chat/bsky/actor/getStatus.defs.js.map +1 -1
  104. package/dist/lexicons/chat/bsky/authFullChatClient.defs.d.ts.map +1 -1
  105. package/dist/lexicons/chat/bsky/authFullChatClient.defs.js +1 -0
  106. package/dist/lexicons/chat/bsky/authFullChatClient.defs.js.map +1 -1
  107. package/dist/lexicons/chat/bsky/convo/defs.defs.d.ts +53 -14
  108. package/dist/lexicons/chat/bsky/convo/defs.defs.d.ts.map +1 -1
  109. package/dist/lexicons/chat/bsky/convo/defs.defs.js +33 -5
  110. package/dist/lexicons/chat/bsky/convo/defs.defs.js.map +1 -1
  111. package/dist/lexicons/chat/bsky/convo/getConvoForMembers.defs.d.ts +1 -1
  112. package/dist/lexicons/chat/bsky/convo/getConvoForMembers.defs.d.ts.map +1 -1
  113. package/dist/lexicons/chat/bsky/convo/getConvoForMembers.defs.js +1 -0
  114. package/dist/lexicons/chat/bsky/convo/getConvoForMembers.defs.js.map +1 -1
  115. package/dist/lexicons/chat/bsky/convo/getLog.defs.d.ts +2 -2
  116. package/dist/lexicons/chat/bsky/convo/getLog.defs.d.ts.map +1 -1
  117. package/dist/lexicons/chat/bsky/convo/getLog.defs.js +3 -0
  118. package/dist/lexicons/chat/bsky/convo/getLog.defs.js.map +1 -1
  119. package/dist/lexicons/chat/bsky/embed/joinLink.d.ts +3 -0
  120. package/dist/lexicons/chat/bsky/embed/joinLink.d.ts.map +1 -0
  121. package/dist/lexicons/chat/bsky/embed/joinLink.defs.d.ts +99 -0
  122. package/dist/lexicons/chat/bsky/embed/joinLink.defs.d.ts.map +1 -0
  123. package/dist/lexicons/chat/bsky/embed/joinLink.defs.js +28 -0
  124. package/dist/lexicons/chat/bsky/embed/joinLink.defs.js.map +1 -0
  125. package/dist/lexicons/chat/bsky/embed/joinLink.js +6 -0
  126. package/dist/lexicons/chat/bsky/embed/joinLink.js.map +1 -0
  127. package/dist/lexicons/chat/bsky/embed.d.ts +2 -0
  128. package/dist/lexicons/chat/bsky/embed.d.ts.map +1 -0
  129. package/dist/lexicons/chat/bsky/embed.js +5 -0
  130. package/dist/lexicons/chat/bsky/embed.js.map +1 -0
  131. package/dist/lexicons/chat/bsky/group/addMembers.defs.d.ts +1 -1
  132. package/dist/lexicons/chat/bsky/group/addMembers.defs.d.ts.map +1 -1
  133. package/dist/lexicons/chat/bsky/group/addMembers.defs.js +1 -0
  134. package/dist/lexicons/chat/bsky/group/addMembers.defs.js.map +1 -1
  135. package/dist/lexicons/chat/bsky/group/createGroup.defs.d.ts +1 -1
  136. package/dist/lexicons/chat/bsky/group/createGroup.defs.d.ts.map +1 -1
  137. package/dist/lexicons/chat/bsky/group/createGroup.defs.js +1 -0
  138. package/dist/lexicons/chat/bsky/group/createGroup.defs.js.map +1 -1
  139. package/dist/lexicons/chat/bsky/group/getJoinLinkPreviews.defs.d.ts +1 -1
  140. package/dist/lexicons/chat/bsky/group/getJoinLinkPreviews.defs.d.ts.map +1 -1
  141. package/dist/lexicons/chat/bsky/group/getJoinLinkPreviews.defs.js +1 -1
  142. package/dist/lexicons/chat/bsky/group/getJoinLinkPreviews.defs.js.map +1 -1
  143. package/dist/lexicons/chat/bsky/group/updateJoinRequestsRead.d.ts +3 -0
  144. package/dist/lexicons/chat/bsky/group/updateJoinRequestsRead.d.ts.map +1 -0
  145. package/dist/lexicons/chat/bsky/group/updateJoinRequestsRead.defs.d.ts +20 -0
  146. package/dist/lexicons/chat/bsky/group/updateJoinRequestsRead.defs.d.ts.map +1 -0
  147. package/dist/lexicons/chat/bsky/group/updateJoinRequestsRead.defs.js +19 -0
  148. package/dist/lexicons/chat/bsky/group/updateJoinRequestsRead.defs.js.map +1 -0
  149. package/dist/lexicons/chat/bsky/group/updateJoinRequestsRead.js +6 -0
  150. package/dist/lexicons/chat/bsky/group/updateJoinRequestsRead.js.map +1 -0
  151. package/dist/lexicons/chat/bsky/group/withdrawJoinRequest.d.ts +3 -0
  152. package/dist/lexicons/chat/bsky/group/withdrawJoinRequest.d.ts.map +1 -0
  153. package/dist/lexicons/chat/bsky/group/withdrawJoinRequest.defs.d.ts +20 -0
  154. package/dist/lexicons/chat/bsky/group/withdrawJoinRequest.defs.d.ts.map +1 -0
  155. package/dist/lexicons/chat/bsky/group/withdrawJoinRequest.defs.js +18 -0
  156. package/dist/lexicons/chat/bsky/group/withdrawJoinRequest.defs.js.map +1 -0
  157. package/dist/lexicons/chat/bsky/group/withdrawJoinRequest.js +6 -0
  158. package/dist/lexicons/chat/bsky/group/withdrawJoinRequest.js.map +1 -0
  159. package/dist/lexicons/chat/bsky/group.d.ts +2 -0
  160. package/dist/lexicons/chat/bsky/group.d.ts.map +1 -1
  161. package/dist/lexicons/chat/bsky/group.js +2 -0
  162. package/dist/lexicons/chat/bsky/group.js.map +1 -1
  163. package/dist/lexicons/chat/bsky/moderation/defs.d.ts +2 -0
  164. package/dist/lexicons/chat/bsky/moderation/defs.d.ts.map +1 -0
  165. package/dist/lexicons/chat/bsky/moderation/defs.defs.d.ts +58 -0
  166. package/dist/lexicons/chat/bsky/moderation/defs.defs.d.ts.map +1 -0
  167. package/dist/lexicons/chat/bsky/moderation/defs.defs.js +38 -0
  168. package/dist/lexicons/chat/bsky/moderation/defs.defs.js.map +1 -0
  169. package/dist/lexicons/chat/bsky/moderation/defs.js +5 -0
  170. package/dist/lexicons/chat/bsky/moderation/defs.js.map +1 -0
  171. package/dist/lexicons/chat/bsky/moderation/getConvo.d.ts +3 -0
  172. package/dist/lexicons/chat/bsky/moderation/getConvo.d.ts.map +1 -0
  173. package/dist/lexicons/chat/bsky/moderation/getConvo.defs.d.ts +22 -0
  174. package/dist/lexicons/chat/bsky/moderation/getConvo.defs.d.ts.map +1 -0
  175. package/dist/lexicons/chat/bsky/moderation/getConvo.defs.js +18 -0
  176. package/dist/lexicons/chat/bsky/moderation/getConvo.defs.js.map +1 -0
  177. package/dist/lexicons/chat/bsky/moderation/getConvo.js +6 -0
  178. package/dist/lexicons/chat/bsky/moderation/getConvo.js.map +1 -0
  179. package/dist/lexicons/chat/bsky/moderation/getConvoMembers.d.ts +3 -0
  180. package/dist/lexicons/chat/bsky/moderation/getConvoMembers.d.ts.map +1 -0
  181. package/dist/lexicons/chat/bsky/moderation/getConvoMembers.defs.d.ts +28 -0
  182. package/dist/lexicons/chat/bsky/moderation/getConvoMembers.defs.d.ts.map +1 -0
  183. package/dist/lexicons/chat/bsky/moderation/getConvoMembers.defs.js +24 -0
  184. package/dist/lexicons/chat/bsky/moderation/getConvoMembers.defs.js.map +1 -0
  185. package/dist/lexicons/chat/bsky/moderation/getConvoMembers.js +6 -0
  186. package/dist/lexicons/chat/bsky/moderation/getConvoMembers.js.map +1 -0
  187. package/dist/lexicons/chat/bsky/moderation/getConvos.d.ts +3 -0
  188. package/dist/lexicons/chat/bsky/moderation/getConvos.d.ts.map +1 -0
  189. package/dist/lexicons/chat/bsky/moderation/getConvos.defs.d.ts +22 -0
  190. package/dist/lexicons/chat/bsky/moderation/getConvos.defs.d.ts.map +1 -0
  191. package/dist/lexicons/chat/bsky/moderation/getConvos.defs.js +22 -0
  192. package/dist/lexicons/chat/bsky/moderation/getConvos.defs.js.map +1 -0
  193. package/dist/lexicons/chat/bsky/moderation/getConvos.js +6 -0
  194. package/dist/lexicons/chat/bsky/moderation/getConvos.js.map +1 -0
  195. package/dist/lexicons/chat/bsky/moderation/subscribeModEvents.defs.d.ts +20 -2
  196. package/dist/lexicons/chat/bsky/moderation/subscribeModEvents.defs.d.ts.map +1 -1
  197. package/dist/lexicons/chat/bsky/moderation/subscribeModEvents.defs.js +11 -0
  198. package/dist/lexicons/chat/bsky/moderation/subscribeModEvents.defs.js.map +1 -1
  199. package/dist/lexicons/chat/bsky/moderation.d.ts +4 -0
  200. package/dist/lexicons/chat/bsky/moderation.d.ts.map +1 -1
  201. package/dist/lexicons/chat/bsky/moderation.js +4 -0
  202. package/dist/lexicons/chat/bsky/moderation.js.map +1 -1
  203. package/dist/lexicons/chat/bsky.d.ts +1 -0
  204. package/dist/lexicons/chat/bsky.d.ts.map +1 -1
  205. package/dist/lexicons/chat/bsky.js +1 -0
  206. package/dist/lexicons/chat/bsky.js.map +1 -1
  207. package/dist/lexicons/com/atproto/lexicon/schema.defs.d.ts.map +1 -1
  208. package/dist/lexicons/com/atproto/server/getServiceAuth.defs.d.ts +2 -2
  209. package/dist/lexicons/com/atproto/server/getServiceAuth.defs.js +1 -1
  210. package/dist/lexicons/com/atproto/server/getServiceAuth.defs.js.map +1 -1
  211. package/dist/lexicons/com/germnetwork/declaration.defs.d.ts.map +1 -1
  212. package/dist/lexicons/site/standard/document.defs.d.ts.map +1 -1
  213. package/dist/lexicons/site/standard/graph/recommend.defs.d.ts.map +1 -1
  214. package/dist/lexicons/site/standard/graph/subscription.defs.d.ts.map +1 -1
  215. package/dist/lexicons/site/standard/publication.defs.d.ts.map +1 -1
  216. package/dist/lexicons/site/standard/theme/basic.defs.d.ts.map +1 -1
  217. package/dist/lexicons/tools/ozone/moderation/defs.defs.d.ts +11 -3
  218. package/dist/lexicons/tools/ozone/moderation/defs.defs.d.ts.map +1 -1
  219. package/dist/lexicons/tools/ozone/moderation/defs.defs.js +9 -0
  220. package/dist/lexicons/tools/ozone/moderation/defs.defs.js.map +1 -1
  221. package/dist/lexicons/tools/ozone/moderation/queryEvents.defs.d.ts +2 -2
  222. package/dist/lexicons/tools/ozone/moderation/queryEvents.defs.d.ts.map +1 -1
  223. package/dist/lexicons/tools/ozone/moderation/queryEvents.defs.js.map +1 -1
  224. package/dist/lexicons/tools/ozone/moderation/queryStatuses.defs.d.ts +2 -2
  225. package/dist/lexicons/tools/ozone/moderation/queryStatuses.defs.d.ts.map +1 -1
  226. package/dist/lexicons/tools/ozone/moderation/queryStatuses.defs.js.map +1 -1
  227. package/dist/mailer/index.d.ts +3 -3
  228. package/dist/mailer/index.d.ts.map +1 -1
  229. package/dist/mailer/index.js +18 -9
  230. package/dist/mailer/index.js.map +1 -1
  231. package/dist/mailer/templates/confirm-email.js +11 -3
  232. package/dist/mailer/templates/confirm-email.js.map +2 -2
  233. package/dist/mailer/templates/delete-account.js +2 -2
  234. package/dist/mailer/templates/delete-account.js.map +2 -2
  235. package/dist/mailer/templates/plc-operation.js +2 -2
  236. package/dist/mailer/templates/plc-operation.js.map +2 -2
  237. package/dist/mailer/templates/reset-password.js +2 -2
  238. package/dist/mailer/templates/reset-password.js.map +2 -2
  239. package/dist/mailer/templates/update-email.js +2 -2
  240. package/dist/mailer/templates/update-email.js.map +2 -2
  241. package/dist/mailer/templates.d.ts +11 -0
  242. package/dist/mailer/templates.d.ts.map +1 -1
  243. package/dist/mailer/templates.js.map +1 -1
  244. package/dist/pipethrough.d.ts +3 -0
  245. package/dist/pipethrough.d.ts.map +1 -1
  246. package/dist/pipethrough.js +25 -9
  247. package/dist/pipethrough.js.map +1 -1
  248. package/dist/read-after-write/viewer.d.ts +2 -2
  249. package/package.json +7 -6
  250. package/src/account-manager/account-manager.ts +105 -7
  251. package/src/account-manager/helpers/account.ts +15 -7
  252. package/src/account-manager/oauth-store.ts +76 -18
  253. package/src/actor-store/record/reader.ts +1 -1
  254. package/src/api/app/bsky/actor/getPreferences.ts +11 -2
  255. package/src/api/app/bsky/actor/putPreferences.ts +11 -2
  256. package/src/api/com/atproto/admin/updateAccountHandle.ts +37 -46
  257. package/src/api/com/atproto/identity/updateHandle.ts +45 -76
  258. package/src/api/com/atproto/repo/getRecord.ts +3 -3
  259. package/src/api/com/atproto/repo/putRecord.ts +2 -2
  260. package/src/api/com/atproto/server/getServiceAuth.ts +7 -0
  261. package/src/config/config.ts +69 -57
  262. package/src/config/env.ts +3 -0
  263. package/src/context.ts +13 -10
  264. package/src/mailer/index.ts +25 -9
  265. package/src/mailer/templates/confirm-email.hbs +18 -17
  266. package/src/mailer/templates/delete-account.hbs +6 -6
  267. package/src/mailer/templates/plc-operation.hbs +6 -6
  268. package/src/mailer/templates/reset-password.hbs +7 -7
  269. package/src/mailer/templates/update-email.hbs +6 -6
  270. package/src/mailer/templates.ts +12 -0
  271. package/src/pipethrough.ts +33 -12
  272. package/tests/_puppeteer.ts +8 -2
  273. package/tests/account-manager.test.ts +123 -50
  274. package/tests/app-passwords.test.ts +5 -5
  275. package/tests/get-service-auth.test.ts +81 -0
  276. package/tests/oauth.test.ts +5 -5
  277. package/tests/proxied/proxy-header.test.ts +1 -0
  278. package/tests/proxied/proxy-oauth-aud.test.ts +175 -0
  279. package/tsconfig.build.tsbuildinfo +1 -1
@@ -2,7 +2,11 @@ import { Server } from '@atproto/xrpc-server'
2
2
  import { AuthScope, isAccessFull } from '../../../../auth-scope.js'
3
3
  import { AppContext } from '../../../../context.js'
4
4
  import { app } from '../../../../lexicons/index.js'
5
- import { computeProxyTo, pipethrough } from '../../../../pipethrough.js'
5
+ import {
6
+ bareDidFromProxyTo,
7
+ computeProxyTo,
8
+ pipethrough,
9
+ } from '../../../../pipethrough.js'
6
10
 
7
11
  export default function (server: Server, ctx: AppContext) {
8
12
  const { bskyAppView } = ctx
@@ -26,7 +30,12 @@ export default function (server: Server, ctx: AppContext) {
26
30
  const lxm = app.bsky.actor.getPreferences.$lxm
27
31
  const aud = computeProxyTo(ctx, req, lxm)
28
32
  if (aud !== `${bskyAppView.did}#bsky_appview`) {
29
- return pipethrough(ctx, req, { iss: did, aud, lxm })
33
+ // Phase 1 of service auth updates: outbound JWT keeps bare-DID aud.
34
+ return pipethrough(ctx, req, {
35
+ iss: did,
36
+ aud: bareDidFromProxyTo(aud),
37
+ lxm,
38
+ })
30
39
  }
31
40
 
32
41
  const hasAccessFull =
@@ -3,7 +3,11 @@ import { AccountPreference } from '../../../../actor-store/preference/reader.js'
3
3
  import { isAccessFull } from '../../../../auth-scope.js'
4
4
  import { AppContext } from '../../../../context.js'
5
5
  import { app } from '../../../../lexicons/index.js'
6
- import { computeProxyTo, pipethrough } from '../../../../pipethrough.js'
6
+ import {
7
+ bareDidFromProxyTo,
8
+ computeProxyTo,
9
+ pipethrough,
10
+ } from '../../../../pipethrough.js'
7
11
 
8
12
  export default function (server: Server, ctx: AppContext) {
9
13
  const { bskyAppView } = ctx
@@ -27,7 +31,12 @@ export default function (server: Server, ctx: AppContext) {
27
31
  const lxm = app.bsky.actor.putPreferences.$lxm
28
32
  const aud = computeProxyTo(ctx, req, lxm)
29
33
  if (aud !== `${bskyAppView.did}#bsky_appview`) {
30
- return pipethrough(ctx, req, { iss: did, aud, lxm })
34
+ // Phase 1 of service auth updates: outbound JWT keeps bare-DID aud.
35
+ return pipethrough(ctx, req, {
36
+ iss: did,
37
+ aud: bareDidFromProxyTo(aud),
38
+ lxm,
39
+ })
31
40
  }
32
41
 
33
42
  const checkedPreferences: AccountPreference[] = []
@@ -1,56 +1,47 @@
1
1
  import { InvalidRequestError, Server } from '@atproto/xrpc-server'
2
2
  import { AppContext } from '../../../../context.js'
3
3
  import { com } from '../../../../lexicons/index.js'
4
- import { httpLogger } from '../../../../logger.js'
5
4
 
6
5
  export default function (server: Server, ctx: AppContext) {
7
- server.add(com.atproto.admin.updateAccountHandle, {
8
- auth: ctx.authVerifier.adminToken,
9
- handler: async ({ input }) => {
10
- const { did } = input.body
11
- const handle = await ctx.accountManager.normalizeAndValidateHandle(
12
- input.body.handle,
13
- {
14
- did,
15
- allowAnyValid: true,
16
- },
17
- )
6
+ const { entrywayClient } = ctx
18
7
 
19
- // Pessimistic check to handle spam: also enforced by updateHandle() and the db.
20
- const account = await ctx.accountManager.getAccount(handle, {
21
- includeDeactivated: true,
22
- includeTakenDown: true,
23
- })
8
+ if (entrywayClient) {
9
+ server.add(com.atproto.admin.updateAccountHandle, {
10
+ auth: ctx.authVerifier.adminToken,
11
+ handler: async ({ input: { body } }) => {
12
+ const { did, handle } = await ctx.accountManager.validateHandleUpdate(
13
+ body.did,
14
+ body.handle,
15
+ { allowAnyValid: true },
16
+ )
24
17
 
25
- if (account) {
26
- if (account.did !== did) {
27
- throw new InvalidRequestError(`Handle already taken: ${handle}`)
28
- }
29
- } else {
30
- if (ctx.cfg.entryway) {
31
- // the pds defers to the entryway for updating the handle in the user's did doc.
32
- // here was just check that the handle is already bidirectionally confirmed.
33
- // @TODO if handle is taken according to this PDS, should we force-update?
34
- const doc = await ctx.idResolver.did
35
- .resolveAtprotoData(did, true)
36
- .catch(() => undefined)
37
- if (doc?.handle !== handle) {
38
- throw new InvalidRequestError('Handle does not match DID doc')
39
- }
40
- } else {
41
- await ctx.plcClient.updateHandle(did, ctx.plcRotationKey, handle)
18
+ // the pds defers to the entryway for updating the handle in the user's
19
+ // did doc. here was just check that the handle is already
20
+ // bidirectionally confirmed.
21
+ //
22
+ // -> entryway(identity.updateHandle) [update handle, submit plc op]
23
+ // -> pds(admin.updateAccountHandle) [track handle, sequence handle update]
24
+ //
25
+ // @TODO if handle is taken according to this PDS, should we force-update?
26
+ const doc = await ctx.idResolver.did
27
+ .resolveAtprotoData(did, true)
28
+ .catch(() => undefined)
29
+
30
+ if (!doc || doc.handle !== handle) {
31
+ throw new InvalidRequestError('Handle does not match DID doc')
42
32
  }
43
- await ctx.accountManager.updateHandle(did, handle)
44
- }
45
33
 
46
- try {
47
- await ctx.sequencer.sequenceIdentityEvt(did, handle)
48
- } catch (err) {
49
- httpLogger.error(
50
- { err, did, handle },
51
- 'failed to sequence handle update',
52
- )
53
- }
54
- },
55
- })
34
+ await ctx.accountManager.updateAccountHandle(did, handle)
35
+ },
36
+ })
37
+ } else {
38
+ server.add(com.atproto.admin.updateAccountHandle, {
39
+ auth: ctx.authVerifier.adminToken,
40
+ handler: async ({ input: { body } }) => {
41
+ await ctx.accountManager.updateHandle(body.did, body.handle, {
42
+ allowAnyValid: true,
43
+ })
44
+ },
45
+ })
46
+ }
56
47
  }
@@ -1,97 +1,66 @@
1
1
  import { DAY, MINUTE } from '@atproto/common'
2
- import { InvalidRequestError, Server } from '@atproto/xrpc-server'
2
+ import { MethodRateLimit, Server } from '@atproto/xrpc-server'
3
+ import { AccessOutput, OAuthOutput } from '../../../../auth-output.js'
3
4
  import { AppContext } from '../../../../context.js'
4
5
  import { com } from '../../../../lexicons/index.js'
5
- import { httpLogger } from '../../../../logger.js'
6
6
 
7
7
  export default function (server: Server, ctx: AppContext) {
8
- server.add(com.atproto.identity.updateHandle, {
9
- auth: ctx.authVerifier.authorization({
10
- checkTakedown: true,
11
- authorize: (permissions) => {
12
- permissions.assertIdentity({ attr: 'handle' })
13
- },
14
- }),
15
- rateLimit: [
16
- {
17
- durationMs: 5 * MINUTE,
18
- points: 10,
19
- calcKey: ({ auth }) => auth.credentials.did,
20
- },
21
- {
22
- durationMs: DAY,
23
- points: 50,
24
- calcKey: ({ auth }) => auth.credentials.did,
25
- },
26
- ],
27
- handler: async ({ auth, input, req }) => {
28
- const requester = auth.credentials.did
8
+ const { entrywayClient } = ctx
9
+
10
+ const auth = ctx.authVerifier.authorization({
11
+ checkTakedown: true,
12
+ authorize: (permissions) => {
13
+ permissions.assertIdentity({ attr: 'handle' })
14
+ },
15
+ })
29
16
 
30
- if (ctx.entrywayClient) {
17
+ const rateLimit: MethodRateLimit<AccessOutput | OAuthOutput> = [
18
+ {
19
+ durationMs: 5 * MINUTE,
20
+ points: 10,
21
+ calcKey: ({ auth }) => auth.credentials.did,
22
+ },
23
+ {
24
+ durationMs: DAY,
25
+ points: 50,
26
+ calcKey: ({ auth }) => auth.credentials.did,
27
+ },
28
+ ]
29
+
30
+ if (entrywayClient) {
31
+ server.add(com.atproto.identity.updateHandle, {
32
+ auth,
33
+ rateLimit,
34
+ handler: async ({ auth, input, req }) => {
31
35
  const { headers } = await ctx.entrywayAuthHeaders(
32
36
  req,
33
37
  auth.credentials.did,
34
38
  com.atproto.identity.updateHandle.$lxm,
35
39
  )
36
- // the full flow is:
40
+
41
+ // The full flow is:
37
42
  // -> entryway(identity.updateHandle) [update handle, submit plc op]
38
43
  // -> pds(admin.updateAccountHandle) [track handle, sequence handle update]
39
- await ctx.entrywayClient.xrpc(com.atproto.identity.updateHandle, {
44
+ await entrywayClient.xrpc(com.atproto.identity.updateHandle, {
40
45
  headers,
41
46
  body: {
42
47
  handle: input.body.handle,
43
48
  // @ts-expect-error "did" is not in the schema
44
- did: requester,
49
+ did: auth.credentials.did,
45
50
  },
46
51
  })
47
- return
48
- }
49
-
50
- const handle = await ctx.accountManager.normalizeAndValidateHandle(
51
- input.body.handle,
52
- { did: requester },
53
- )
54
-
55
- // Pessimistic check to handle spam: also enforced by updateHandle() and the db.
56
- const account = await ctx.accountManager.getAccount(handle, {
57
- includeDeactivated: true,
58
- })
59
-
60
- if (!account) {
61
- if (requester.startsWith('did:plc:')) {
62
- await ctx.plcClient.updateHandle(
63
- requester,
64
- ctx.plcRotationKey,
65
- handle,
66
- )
67
- } else {
68
- const resolved = await ctx.idResolver.did.resolveAtprotoData(
69
- requester,
70
- true,
71
- )
72
- if (resolved.handle !== handle) {
73
- throw new InvalidRequestError(
74
- 'DID is not properly configured for handle',
75
- )
76
- }
77
- }
78
- await ctx.accountManager.updateHandle(requester, handle)
79
- } else {
80
- // if we found an account with matching handle, check if it is the same as requester
81
- // if so emit an identity event, otherwise error.
82
- if (account.did !== requester) {
83
- throw new InvalidRequestError(`Handle already taken: ${handle}`)
84
- }
85
- }
86
-
87
- try {
88
- await ctx.sequencer.sequenceIdentityEvt(requester, handle)
89
- } catch (err) {
90
- httpLogger.error(
91
- { err, did: requester, handle },
92
- 'failed to sequence handle update',
52
+ },
53
+ })
54
+ } else {
55
+ server.add(com.atproto.identity.updateHandle, {
56
+ auth,
57
+ rateLimit,
58
+ handler: async ({ auth, input }) => {
59
+ await ctx.accountManager.updateHandle(
60
+ auth.credentials.did,
61
+ input.body.handle,
93
62
  )
94
- }
95
- },
96
- })
63
+ },
64
+ })
65
+ }
97
66
  }
@@ -1,4 +1,4 @@
1
- import { AtUri } from '@atproto/syntax'
1
+ import { atUri } from '@atproto/lex'
2
2
  import { InvalidRequestError, Server } from '@atproto/xrpc-server'
3
3
  import { AppContext } from '../../../../context.js'
4
4
  import { com } from '../../../../lexicons/index.js'
@@ -11,7 +11,7 @@ export default function (server: Server, ctx: AppContext) {
11
11
 
12
12
  // fetch from pds if available, if not then fetch from appview
13
13
  if (did) {
14
- const uri = AtUri.make(did, collection, rkey)
14
+ const uri = atUri(did, collection, rkey)
15
15
  const record = await ctx.actorStore.read(did, (store) =>
16
16
  store.record.getRecord(uri, cid ?? null),
17
17
  )
@@ -24,7 +24,7 @@ export default function (server: Server, ctx: AppContext) {
24
24
  return {
25
25
  encoding: 'application/json' as const,
26
26
  body: {
27
- uri: uri.toString(),
27
+ uri,
28
28
  cid: record.cid,
29
29
  value: record.value,
30
30
  },
@@ -1,3 +1,4 @@
1
+ import { atUri } from '@atproto/lex'
1
2
  import {
2
3
  LegacyBlobRef,
3
4
  LexMap,
@@ -5,7 +6,6 @@ import {
5
6
  isLegacyBlobRef,
6
7
  parseCid,
7
8
  } from '@atproto/lex-data'
8
- import { AtUri } from '@atproto/syntax'
9
9
  import {
10
10
  AuthRequiredError,
11
11
  InvalidRequestError,
@@ -90,7 +90,7 @@ export default function (server: Server, ctx: AppContext) {
90
90
  })
91
91
  }
92
92
 
93
- const uri = AtUri.make(did, collection, rkey)
93
+ const uri = atUri(did, collection, rkey)
94
94
  const swapCommitCid = swapCommit ? parseCid(swapCommit) : undefined
95
95
  const swapRecordCid =
96
96
  typeof swapRecord === 'string' ? parseCid(swapRecord) : swapRecord
@@ -1,4 +1,5 @@
1
1
  import { HOUR, MINUTE } from '@atproto/common'
2
+ import { isAtprotoDid, isAtprotoDidRefAbsolute } from '@atproto/did'
2
3
  import { l } from '@atproto/lex'
3
4
  import {
4
5
  InvalidRequestError,
@@ -34,6 +35,12 @@ export default function (server: Server, ctx: AppContext) {
34
35
  // @NOTE "exp" is expressed in seconds since epoch, not milliseconds
35
36
  const { aud, exp, lxm = null } = params
36
37
 
38
+ if (!isAtprotoDid(aud) && !isAtprotoDidRefAbsolute(aud)) {
39
+ throw new InvalidRequestError(
40
+ 'aud must be a valid atproto DID or did#serviceId reference',
41
+ )
42
+ }
43
+
37
44
  // Takendown accounts should not be able to generate service auth tokens except for methods necessary for account migration
38
45
  if (auth.credentials.type === 'access') {
39
46
  // @NOTE We should probably use "ForbiddenError" here. Using
@@ -1,10 +1,15 @@
1
1
  import assert from 'node:assert'
2
2
  import path from 'node:path'
3
3
  import { DAY, HOUR, SECOND } from '@atproto/common'
4
- import { BrandingInput, HcaptchaConfig } from '@atproto/oauth-provider'
4
+ import {
5
+ BrandingInput as BrandingConfig,
6
+ HcaptchaConfig,
7
+ } from '@atproto/oauth-provider'
5
8
  import { ensureValidDid } from '@atproto/syntax'
6
9
  import { ServerEnvironment } from './env.js'
7
10
 
11
+ export type { BrandingConfig }
12
+
8
13
  // off-config but still from env:
9
14
  // logging: LOG_LEVEL, LOG_SYSTEMS, LOG_ENABLED, LOG_DESTINATION
10
15
 
@@ -152,6 +157,7 @@ export const envToCfg = (env: ServerEnvironment): ServerConfig => {
152
157
  emailCfg = {
153
158
  smtpUrl: env.emailSmtpUrl,
154
159
  fromAddress: env.emailFromAddress,
160
+ disableConfirmationLink: env.emailDisableConfirmationLink ?? false,
155
161
  }
156
162
  }
157
163
 
@@ -167,6 +173,7 @@ export const envToCfg = (env: ServerEnvironment): ServerConfig => {
167
173
  moderationEmailCfg = {
168
174
  smtpUrl: env.moderationEmailSmtpUrl,
169
175
  fromAddress: env.moderationEmailAddress,
176
+ disableConfirmationLink: false,
170
177
  }
171
178
  }
172
179
 
@@ -254,6 +261,62 @@ export const envToCfg = (env: ServerEnvironment): ServerConfig => {
254
261
  preferCompressed: env.proxyPreferCompressed ?? false,
255
262
  }
256
263
 
264
+ const brandingCfg = {
265
+ name: env.serviceName ?? `${hostname} PDS`,
266
+ logo: env.logoUrl,
267
+ colors: {
268
+ light: env.lightColor,
269
+ dark: env.darkColor,
270
+
271
+ contrastSaturation: env.contrastSaturation,
272
+
273
+ primary: env.primaryColor,
274
+ primaryContrast: env.primaryColorContrast,
275
+ primaryHue: env.primaryColorHue,
276
+
277
+ error: env.errorColor,
278
+ errorContrast: env.errorColorContrast,
279
+ errorHue: env.errorColorHue,
280
+
281
+ warning: env.warningColor,
282
+ warningContrast: env.warningColorContrast,
283
+ warningHue: env.warningColorHue,
284
+
285
+ info: env.infoColor,
286
+ infoContrast: env.infoColorContrast,
287
+ infoHue: env.infoColorHue,
288
+
289
+ success: env.successColor,
290
+ successContrast: env.successColorContrast,
291
+ successHue: env.successColorHue,
292
+ },
293
+ links: [
294
+ {
295
+ title: { en: 'Home', fr: 'Accueil' },
296
+ href: env.homeUrl,
297
+ rel: 'canonical' as const, // Prevents login page from being indexed
298
+ },
299
+ {
300
+ title: { en: 'Terms of Service' },
301
+ href: env.termsOfServiceUrl,
302
+ rel: 'terms-of-service' as const,
303
+ },
304
+ {
305
+ title: { en: 'Privacy Policy' },
306
+ href: env.privacyPolicyUrl,
307
+ rel: 'privacy-policy' as const,
308
+ },
309
+ {
310
+ title: { en: 'Support' },
311
+ href: env.supportUrl,
312
+ rel: 'help' as const,
313
+ },
314
+ ].filter(
315
+ <T extends { href?: string }>(f: T): f is T & { href: string } =>
316
+ f.href != null && f.href !== '',
317
+ ),
318
+ }
319
+
257
320
  const oauthCfg: ServerConfig['oauth'] = entrywayCfg
258
321
  ? {
259
322
  issuer: entrywayCfg.url,
@@ -272,61 +335,7 @@ export const envToCfg = (env: ServerEnvironment): ServerConfig => {
272
335
  tokenSalt: env.hcaptchaTokenSalt,
273
336
  }
274
337
  : undefined,
275
- branding: {
276
- name: env.serviceName ?? `${hostname} PDS`,
277
- logo: env.logoUrl,
278
- colors: {
279
- light: env.lightColor,
280
- dark: env.darkColor,
281
-
282
- contrastSaturation: env.contrastSaturation,
283
-
284
- primary: env.primaryColor,
285
- primaryContrast: env.primaryColorContrast,
286
- primaryHue: env.primaryColorHue,
287
-
288
- error: env.errorColor,
289
- errorContrast: env.errorColorContrast,
290
- errorHue: env.errorColorHue,
291
-
292
- warning: env.warningColor,
293
- warningContrast: env.warningColorContrast,
294
- warningHue: env.warningColorHue,
295
-
296
- info: env.infoColor,
297
- infoContrast: env.infoColorContrast,
298
- infoHue: env.infoColorHue,
299
-
300
- success: env.successColor,
301
- successContrast: env.successColorContrast,
302
- successHue: env.successColorHue,
303
- },
304
- links: [
305
- {
306
- title: { en: 'Home', fr: 'Accueil' },
307
- href: env.homeUrl,
308
- rel: 'canonical' as const, // Prevents login page from being indexed
309
- },
310
- {
311
- title: { en: 'Terms of Service' },
312
- href: env.termsOfServiceUrl,
313
- rel: 'terms-of-service' as const,
314
- },
315
- {
316
- title: { en: 'Privacy Policy' },
317
- href: env.privacyPolicyUrl,
318
- rel: 'privacy-policy' as const,
319
- },
320
- {
321
- title: { en: 'Support' },
322
- href: env.supportUrl,
323
- rel: 'help' as const,
324
- },
325
- ].filter(
326
- <T extends { href?: string }>(f: T): f is T & { href: string } =>
327
- f.href != null && f.href !== '',
328
- ),
329
- },
338
+ branding: brandingCfg,
330
339
  trustedClients: env.trustedOAuthClients,
331
340
  },
332
341
  }
@@ -358,6 +367,7 @@ export const envToCfg = (env: ServerEnvironment): ServerConfig => {
358
367
  fetch: fetchCfg,
359
368
  lexicon: lexiconCfg,
360
369
  proxy: proxyCfg,
370
+ branding: brandingCfg,
361
371
  oauth: oauthCfg,
362
372
  }
363
373
  }
@@ -381,6 +391,7 @@ export type ServerConfig = {
381
391
  crawlers: string[]
382
392
  fetch: FetchConfig
383
393
  proxy: ProxyConfig
394
+ branding: BrandingConfig
384
395
  oauth: OAuthConfig
385
396
  lexicon: LexiconResolverConfig
386
397
  }
@@ -477,7 +488,7 @@ export type OAuthConfig = {
477
488
  issuer: string
478
489
  provider?: {
479
490
  hcaptcha?: HcaptchaConfig
480
- branding: BrandingInput
491
+ branding: BrandingConfig
481
492
  trustedClients?: string[]
482
493
  }
483
494
  }
@@ -499,6 +510,7 @@ export type InvitesConfig =
499
510
  export type EmailConfig = {
500
511
  smtpUrl: string
501
512
  fromAddress: string
513
+ disableConfirmationLink: boolean
502
514
  }
503
515
 
504
516
  export type SubscriptionConfig = {
package/src/config/env.ts CHANGED
@@ -97,6 +97,9 @@ export function readEnv() {
97
97
  // email
98
98
  emailSmtpUrl: envStr('PDS_EMAIL_SMTP_URL'),
99
99
  emailFromAddress: envStr('PDS_EMAIL_FROM_ADDRESS'),
100
+ emailDisableConfirmationLink: envBool(
101
+ 'PDS_EMAIL_DISABLE_CONFIRMATION_LINK',
102
+ ),
100
103
  moderationEmailSmtpUrl: envStr('PDS_MODERATION_EMAIL_SMTP_URL'),
101
104
  moderationEmailAddress: envStr('PDS_MODERATION_EMAIL_ADDRESS'),
102
105
 
package/src/context.ts CHANGED
@@ -156,7 +156,7 @@ export class AppContext {
156
156
  ? nodemailer.createTransport(cfg.email.smtpUrl)
157
157
  : nodemailer.createTransport({ jsonTransport: true })
158
158
 
159
- const mailer = new ServerMailer(mailTransport, cfg)
159
+ const mailer = new ServerMailer(mailTransport, cfg.email, cfg.branding)
160
160
 
161
161
  const modMailTransport =
162
162
  cfg.moderationEmail !== null
@@ -267,25 +267,28 @@ export class AppContext {
267
267
  backgroundQueue,
268
268
  })
269
269
 
270
+ const plcRotationKey =
271
+ secrets.plcRotationKey.provider === 'kms'
272
+ ? await KmsKeypair.load({
273
+ keyId: secrets.plcRotationKey.keyId,
274
+ })
275
+ : await crypto.Secp256k1Keypair.import(
276
+ secrets.plcRotationKey.privateKeyHex,
277
+ )
278
+
270
279
  const accountManager = new AccountManager(
271
280
  idResolver,
272
281
  jwtSecretKey,
273
282
  mailer,
283
+ sequencer,
284
+ plcClient,
285
+ plcRotationKey,
274
286
  cfg.service.did,
275
287
  cfg.identity.serviceHandleDomains,
276
288
  cfg.db,
277
289
  )
278
290
  await accountManager.migrateOrThrow()
279
291
 
280
- const plcRotationKey =
281
- secrets.plcRotationKey.provider === 'kms'
282
- ? await KmsKeypair.load({
283
- keyId: secrets.plcRotationKey.keyId,
284
- })
285
- : await crypto.Secp256k1Keypair.import(
286
- secrets.plcRotationKey.privateKeyHex,
287
- )
288
-
289
292
  const localViewer = LocalViewer.creator(
290
293
  accountManager,
291
294
  imageUrlBuilder,
@@ -1,22 +1,38 @@
1
1
  import { SendMailOptions, Transporter } from 'nodemailer'
2
2
  import { htmlToText } from 'nodemailer-html-to-text'
3
- import { ServerConfig } from '../config/index.js'
3
+ import { BrandingConfig, EmailConfig } from '../config/index.js'
4
4
  import { mailerLogger } from '../logger.js'
5
5
  import * as templates from './templates.js'
6
6
 
7
7
  // @TODO Add support for i18n
8
8
 
9
+ const DEFAULT_LOGO_URL =
10
+ 'https://bsky.social/about/images/email/email_logo_default.png'
11
+ const DEFAULT_MARK_URL =
12
+ 'https://bsky.social/about/images/email/email_mark_dark.png'
13
+ const DEFAULT_HOME_URL = 'https://bsky.app'
14
+ const DEFAULT_PRIMARY_COLOR = '#067df7'
15
+
9
16
  export class ServerMailer {
17
+ private readonly config: templates.Config
18
+
10
19
  constructor(
11
20
  public readonly transporter: Transporter,
12
- private readonly config: ServerConfig,
21
+ private readonly email: EmailConfig | null,
22
+ branding: BrandingConfig,
13
23
  ) {
14
24
  transporter.use('compile', htmlToText())
15
- }
16
25
 
17
- // The returned config can be used inside email templates.
18
- static getEmailConfig(_config: ServerConfig) {
19
- return {}
26
+ this.config = {
27
+ serviceName: branding.name ?? 'Bluesky',
28
+ homeUrl:
29
+ branding.links?.find((link) => link.rel === 'canonical')?.href ??
30
+ DEFAULT_HOME_URL,
31
+ logoUrl: branding.logo ?? DEFAULT_LOGO_URL,
32
+ markUrl: branding.logo ?? DEFAULT_MARK_URL,
33
+ primaryColor: branding.colors?.primary ?? DEFAULT_PRIMARY_COLOR,
34
+ showBskyAppEmailConfirmationLink: email?.disableConfirmationLink !== true,
35
+ }
20
36
  }
21
37
 
22
38
  async sendResetPassword(
@@ -75,14 +91,14 @@ export class ServerMailer {
75
91
  ) {
76
92
  const html = templates[templateName]({
77
93
  ...params,
78
- config: ServerMailer.getEmailConfig(this.config),
94
+ config: this.config,
79
95
  } as any)
80
96
  const res = await this.transporter.sendMail({
81
97
  ...mailOpts,
82
- from: mailOpts.from ?? this.config.email?.fromAddress,
98
+ from: mailOpts.from ?? this.email?.fromAddress,
83
99
  html,
84
100
  })
85
- if (!this.config.email?.smtpUrl) {
101
+ if (!this.email?.smtpUrl) {
86
102
  mailerLogger.debug(
87
103
  'No SMTP URL has been configured. Intended to send email:\n' +
88
104
  JSON.stringify(res, null, 2),