@atproto/pds 0.4.103 → 0.4.105

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 (328) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/account-manager/{index.d.ts → account-manager.d.ts} +26 -35
  3. package/dist/account-manager/account-manager.d.ts.map +1 -0
  4. package/dist/account-manager/{index.js → account-manager.js} +52 -207
  5. package/dist/account-manager/account-manager.js.map +1 -0
  6. package/dist/account-manager/helpers/account.d.ts +3 -3
  7. package/dist/account-manager/helpers/device-account.d.ts +15 -15
  8. package/dist/account-manager/helpers/device-account.d.ts.map +1 -1
  9. package/dist/account-manager/helpers/device-account.js +2 -1
  10. package/dist/account-manager/helpers/device-account.js.map +1 -1
  11. package/dist/account-manager/helpers/token.d.ts +98 -98
  12. package/dist/account-manager/oauth-store.d.ts +58 -0
  13. package/dist/account-manager/oauth-store.d.ts.map +1 -0
  14. package/dist/account-manager/oauth-store.js +417 -0
  15. package/dist/account-manager/oauth-store.js.map +1 -0
  16. package/dist/actor-store/record/reader.d.ts +3 -3
  17. package/dist/actor-store/repo/reader.d.ts +2 -0
  18. package/dist/actor-store/repo/reader.d.ts.map +1 -1
  19. package/dist/actor-store/repo/reader.js +9 -0
  20. package/dist/actor-store/repo/reader.js.map +1 -1
  21. package/dist/actor-store/repo/sql-repo-reader.d.ts +1 -1
  22. package/dist/actor-store/repo/transactor.d.ts.map +1 -1
  23. package/dist/actor-store/repo/transactor.js +13 -4
  24. package/dist/actor-store/repo/transactor.js.map +1 -1
  25. package/dist/api/com/atproto/admin/deleteAccount.d.ts.map +1 -1
  26. package/dist/api/com/atproto/admin/deleteAccount.js +2 -3
  27. package/dist/api/com/atproto/admin/deleteAccount.js.map +1 -1
  28. package/dist/api/com/atproto/admin/sendEmail.d.ts.map +1 -1
  29. package/dist/api/com/atproto/admin/sendEmail.js +2 -7
  30. package/dist/api/com/atproto/admin/sendEmail.js.map +1 -1
  31. package/dist/api/com/atproto/admin/updateAccountEmail.d.ts.map +1 -1
  32. package/dist/api/com/atproto/admin/updateAccountEmail.js +1 -2
  33. package/dist/api/com/atproto/admin/updateAccountEmail.js.map +1 -1
  34. package/dist/api/com/atproto/admin/updateAccountHandle.d.ts.map +1 -1
  35. package/dist/api/com/atproto/admin/updateAccountHandle.js +2 -6
  36. package/dist/api/com/atproto/admin/updateAccountHandle.js.map +1 -1
  37. package/dist/api/com/atproto/admin/updateAccountPassword.d.ts.map +1 -1
  38. package/dist/api/com/atproto/admin/updateAccountPassword.js +1 -2
  39. package/dist/api/com/atproto/admin/updateAccountPassword.js.map +1 -1
  40. package/dist/api/com/atproto/identity/requestPlcOperationSignature.d.ts.map +1 -1
  41. package/dist/api/com/atproto/identity/requestPlcOperationSignature.js +2 -7
  42. package/dist/api/com/atproto/identity/requestPlcOperationSignature.js.map +1 -1
  43. package/dist/api/com/atproto/identity/resolveHandle.d.ts.map +1 -1
  44. package/dist/api/com/atproto/identity/resolveHandle.js +2 -36
  45. package/dist/api/com/atproto/identity/resolveHandle.js.map +1 -1
  46. package/dist/api/com/atproto/identity/signPlcOperation.d.ts.map +1 -1
  47. package/dist/api/com/atproto/identity/signPlcOperation.js +2 -7
  48. package/dist/api/com/atproto/identity/signPlcOperation.js.map +1 -1
  49. package/dist/api/com/atproto/identity/updateHandle.d.ts.map +1 -1
  50. package/dist/api/com/atproto/identity/updateHandle.js +3 -14
  51. package/dist/api/com/atproto/identity/updateHandle.js.map +1 -1
  52. package/dist/api/com/atproto/repo/applyWrites.d.ts.map +1 -1
  53. package/dist/api/com/atproto/repo/applyWrites.js +12 -7
  54. package/dist/api/com/atproto/repo/applyWrites.js.map +1 -1
  55. package/dist/api/com/atproto/repo/createRecord.d.ts.map +1 -1
  56. package/dist/api/com/atproto/repo/createRecord.js +12 -8
  57. package/dist/api/com/atproto/repo/createRecord.js.map +1 -1
  58. package/dist/api/com/atproto/repo/deleteRecord.d.ts.map +1 -1
  59. package/dist/api/com/atproto/repo/deleteRecord.js +12 -7
  60. package/dist/api/com/atproto/repo/deleteRecord.js.map +1 -1
  61. package/dist/api/com/atproto/repo/listRecords.d.ts.map +1 -1
  62. package/dist/api/com/atproto/repo/listRecords.js +1 -3
  63. package/dist/api/com/atproto/repo/listRecords.js.map +1 -1
  64. package/dist/api/com/atproto/repo/putRecord.d.ts.map +1 -1
  65. package/dist/api/com/atproto/repo/putRecord.js +11 -8
  66. package/dist/api/com/atproto/repo/putRecord.js.map +1 -1
  67. package/dist/api/com/atproto/server/activateAccount.d.ts.map +1 -1
  68. package/dist/api/com/atproto/server/activateAccount.js +3 -20
  69. package/dist/api/com/atproto/server/activateAccount.js.map +1 -1
  70. package/dist/api/com/atproto/server/confirmEmail.d.ts.map +1 -1
  71. package/dist/api/com/atproto/server/confirmEmail.js +2 -7
  72. package/dist/api/com/atproto/server/confirmEmail.js.map +1 -1
  73. package/dist/api/com/atproto/server/createAccount.d.ts.map +1 -1
  74. package/dist/api/com/atproto/server/createAccount.js +5 -7
  75. package/dist/api/com/atproto/server/createAccount.js.map +1 -1
  76. package/dist/api/com/atproto/server/createAppPassword.d.ts.map +1 -1
  77. package/dist/api/com/atproto/server/createAppPassword.js +2 -7
  78. package/dist/api/com/atproto/server/createAppPassword.js.map +1 -1
  79. package/dist/api/com/atproto/server/createSession.js +2 -2
  80. package/dist/api/com/atproto/server/createSession.js.map +1 -1
  81. package/dist/api/com/atproto/server/deactivateAccount.d.ts.map +1 -1
  82. package/dist/api/com/atproto/server/deactivateAccount.js +1 -2
  83. package/dist/api/com/atproto/server/deactivateAccount.js.map +1 -1
  84. package/dist/api/com/atproto/server/deleteAccount.d.ts.map +1 -1
  85. package/dist/api/com/atproto/server/deleteAccount.js +3 -5
  86. package/dist/api/com/atproto/server/deleteAccount.js.map +1 -1
  87. package/dist/api/com/atproto/server/deleteSession.d.ts.map +1 -1
  88. package/dist/api/com/atproto/server/deleteSession.js +2 -3
  89. package/dist/api/com/atproto/server/deleteSession.js.map +1 -1
  90. package/dist/api/com/atproto/server/getAccountInviteCodes.d.ts.map +1 -1
  91. package/dist/api/com/atproto/server/getAccountInviteCodes.js +2 -7
  92. package/dist/api/com/atproto/server/getAccountInviteCodes.js.map +1 -1
  93. package/dist/api/com/atproto/server/getSession.js +2 -2
  94. package/dist/api/com/atproto/server/getSession.js.map +1 -1
  95. package/dist/api/com/atproto/server/listAppPasswords.d.ts.map +1 -1
  96. package/dist/api/com/atproto/server/listAppPasswords.js +2 -7
  97. package/dist/api/com/atproto/server/listAppPasswords.js.map +1 -1
  98. package/dist/api/com/atproto/server/refreshSession.js +2 -2
  99. package/dist/api/com/atproto/server/refreshSession.js.map +1 -1
  100. package/dist/api/com/atproto/server/requestAccountDelete.d.ts.map +1 -1
  101. package/dist/api/com/atproto/server/requestAccountDelete.js +2 -7
  102. package/dist/api/com/atproto/server/requestAccountDelete.js.map +1 -1
  103. package/dist/api/com/atproto/server/requestEmailConfirmation.d.ts.map +1 -1
  104. package/dist/api/com/atproto/server/requestEmailConfirmation.js +2 -7
  105. package/dist/api/com/atproto/server/requestEmailConfirmation.js.map +1 -1
  106. package/dist/api/com/atproto/server/requestEmailUpdate.d.ts.map +1 -1
  107. package/dist/api/com/atproto/server/requestEmailUpdate.js +2 -7
  108. package/dist/api/com/atproto/server/requestEmailUpdate.js.map +1 -1
  109. package/dist/api/com/atproto/server/requestPasswordReset.d.ts.map +1 -1
  110. package/dist/api/com/atproto/server/requestPasswordReset.js +1 -2
  111. package/dist/api/com/atproto/server/requestPasswordReset.js.map +1 -1
  112. package/dist/api/com/atproto/server/resetPassword.d.ts.map +1 -1
  113. package/dist/api/com/atproto/server/resetPassword.js +1 -2
  114. package/dist/api/com/atproto/server/resetPassword.js.map +1 -1
  115. package/dist/api/com/atproto/server/revokeAppPassword.d.ts.map +1 -1
  116. package/dist/api/com/atproto/server/revokeAppPassword.js +2 -7
  117. package/dist/api/com/atproto/server/revokeAppPassword.js.map +1 -1
  118. package/dist/api/com/atproto/server/updateEmail.d.ts.map +1 -1
  119. package/dist/api/com/atproto/server/updateEmail.js +2 -7
  120. package/dist/api/com/atproto/server/updateEmail.js.map +1 -1
  121. package/dist/api/com/atproto/sync/getRecord.d.ts.map +1 -1
  122. package/dist/api/com/atproto/sync/getRecord.js +1 -4
  123. package/dist/api/com/atproto/sync/getRecord.js.map +1 -1
  124. package/dist/api/com/atproto/sync/getRepoStatus.js +1 -1
  125. package/dist/api/com/atproto/sync/getRepoStatus.js.map +1 -1
  126. package/dist/api/com/atproto/sync/listRepos.js +1 -1
  127. package/dist/api/com/atproto/sync/listRepos.js.map +1 -1
  128. package/dist/api/com/atproto/sync/subscribeRepos.d.ts.map +1 -1
  129. package/dist/api/com/atproto/sync/subscribeRepos.js +2 -10
  130. package/dist/api/com/atproto/sync/subscribeRepos.js.map +1 -1
  131. package/dist/api/com/atproto/temp/checkSignupQueue.js +1 -1
  132. package/dist/api/com/atproto/temp/checkSignupQueue.js.map +1 -1
  133. package/dist/api/proxy.d.ts +7 -8
  134. package/dist/api/proxy.d.ts.map +1 -1
  135. package/dist/api/proxy.js +14 -6
  136. package/dist/api/proxy.js.map +1 -1
  137. package/dist/app-view.d.ts +14 -0
  138. package/dist/app-view.d.ts.map +1 -0
  139. package/dist/app-view.js +36 -0
  140. package/dist/app-view.js.map +1 -0
  141. package/dist/auth-routes.d.ts +1 -1
  142. package/dist/auth-routes.d.ts.map +1 -1
  143. package/dist/auth-routes.js +9 -3
  144. package/dist/auth-routes.js.map +1 -1
  145. package/dist/auth-verifier.d.ts +1 -1
  146. package/dist/auth-verifier.d.ts.map +1 -1
  147. package/dist/config/config.d.ts +3 -2
  148. package/dist/config/config.d.ts.map +1 -1
  149. package/dist/config/config.js +17 -7
  150. package/dist/config/config.js.map +1 -1
  151. package/dist/config/env.d.ts +4 -0
  152. package/dist/config/env.d.ts.map +1 -1
  153. package/dist/config/env.js +5 -0
  154. package/dist/config/env.js.map +1 -1
  155. package/dist/context.d.ts +11 -4
  156. package/dist/context.d.ts.map +1 -1
  157. package/dist/context.js +33 -18
  158. package/dist/context.js.map +1 -1
  159. package/dist/handle/index.d.ts +0 -7
  160. package/dist/handle/index.d.ts.map +1 -1
  161. package/dist/handle/index.js +4 -58
  162. package/dist/handle/index.js.map +1 -1
  163. package/dist/image/image-url.d.ts +8 -0
  164. package/dist/image/image-url.d.ts.map +1 -0
  165. package/dist/image/image-url.js +26 -0
  166. package/dist/image/image-url.js.map +1 -0
  167. package/dist/index.js +1 -1
  168. package/dist/index.js.map +1 -1
  169. package/dist/lexicon/index.d.ts +6 -0
  170. package/dist/lexicon/index.d.ts.map +1 -1
  171. package/dist/lexicon/index.js +12 -0
  172. package/dist/lexicon/index.js.map +1 -1
  173. package/dist/lexicon/lexicons.d.ts +412 -158
  174. package/dist/lexicon/lexicons.d.ts.map +1 -1
  175. package/dist/lexicon/lexicons.js +222 -81
  176. package/dist/lexicon/lexicons.js.map +1 -1
  177. package/dist/lexicon/types/app/bsky/embed/video.d.ts +1 -0
  178. package/dist/lexicon/types/app/bsky/embed/video.d.ts.map +1 -1
  179. package/dist/lexicon/types/app/bsky/embed/video.js.map +1 -1
  180. package/dist/lexicon/types/app/bsky/labeler/defs.d.ts +7 -0
  181. package/dist/lexicon/types/app/bsky/labeler/defs.d.ts.map +1 -1
  182. package/dist/lexicon/types/app/bsky/labeler/defs.js.map +1 -1
  183. package/dist/lexicon/types/app/bsky/labeler/service.d.ts +7 -0
  184. package/dist/lexicon/types/app/bsky/labeler/service.d.ts.map +1 -1
  185. package/dist/lexicon/types/app/bsky/labeler/service.js.map +1 -1
  186. package/dist/lexicon/types/com/atproto/identity/defs.d.ts +17 -0
  187. package/dist/lexicon/types/com/atproto/identity/defs.d.ts.map +1 -0
  188. package/dist/lexicon/types/com/atproto/identity/defs.js +16 -0
  189. package/dist/lexicon/types/com/atproto/identity/defs.js.map +1 -0
  190. package/dist/lexicon/types/com/atproto/identity/refreshIdentity.d.ts +39 -0
  191. package/dist/lexicon/types/com/atproto/identity/refreshIdentity.d.ts.map +1 -0
  192. package/dist/lexicon/types/com/atproto/identity/refreshIdentity.js +7 -0
  193. package/dist/lexicon/types/com/atproto/identity/refreshIdentity.js.map +1 -0
  194. package/dist/lexicon/types/com/atproto/identity/resolveDid.d.ts +40 -0
  195. package/dist/lexicon/types/com/atproto/identity/resolveDid.d.ts.map +1 -0
  196. package/dist/lexicon/types/com/atproto/identity/resolveDid.js +7 -0
  197. package/dist/lexicon/types/com/atproto/identity/resolveDid.js.map +1 -0
  198. package/dist/lexicon/types/com/atproto/identity/resolveHandle.d.ts +1 -0
  199. package/dist/lexicon/types/com/atproto/identity/resolveHandle.d.ts.map +1 -1
  200. package/dist/lexicon/types/com/atproto/identity/resolveIdentity.d.ts +36 -0
  201. package/dist/lexicon/types/com/atproto/identity/resolveIdentity.d.ts.map +1 -0
  202. package/dist/lexicon/types/com/atproto/identity/resolveIdentity.js +7 -0
  203. package/dist/lexicon/types/com/atproto/identity/resolveIdentity.js.map +1 -0
  204. package/dist/lexicon/types/com/atproto/moderation/defs.d.ts +2 -0
  205. package/dist/lexicon/types/com/atproto/moderation/defs.d.ts.map +1 -1
  206. package/dist/lexicon/types/com/atproto/repo/listRecords.d.ts +0 -4
  207. package/dist/lexicon/types/com/atproto/repo/listRecords.d.ts.map +1 -1
  208. package/dist/lexicon/types/com/atproto/repo/listRecords.js.map +1 -1
  209. package/dist/lexicon/types/com/atproto/sync/getRecord.d.ts +0 -2
  210. package/dist/lexicon/types/com/atproto/sync/getRecord.d.ts.map +1 -1
  211. package/dist/lexicon/types/com/atproto/sync/subscribeRepos.d.ts +1 -30
  212. package/dist/lexicon/types/com/atproto/sync/subscribeRepos.d.ts.map +1 -1
  213. package/dist/lexicon/types/com/atproto/sync/subscribeRepos.js +0 -27
  214. package/dist/lexicon/types/com/atproto/sync/subscribeRepos.js.map +1 -1
  215. package/dist/mailer/index.d.ts +5 -5
  216. package/dist/mailer/index.d.ts.map +1 -1
  217. package/dist/mailer/index.js +6 -5
  218. package/dist/mailer/index.js.map +1 -1
  219. package/dist/read-after-write/viewer.d.ts +1 -1
  220. package/dist/read-after-write/viewer.d.ts.map +1 -1
  221. package/dist/repo/types.d.ts +6 -2
  222. package/dist/repo/types.d.ts.map +1 -1
  223. package/dist/repo/types.js.map +1 -1
  224. package/dist/scripts/rebuild-repo.d.ts.map +1 -1
  225. package/dist/scripts/rebuild-repo.js +2 -1
  226. package/dist/scripts/rebuild-repo.js.map +1 -1
  227. package/dist/sequencer/db/schema.d.ts +1 -1
  228. package/dist/sequencer/db/schema.d.ts.map +1 -1
  229. package/dist/sequencer/events.d.ts +29 -41
  230. package/dist/sequencer/events.d.ts.map +1 -1
  231. package/dist/sequencer/events.js +24 -58
  232. package/dist/sequencer/events.js.map +1 -1
  233. package/dist/sequencer/sequencer.d.ts +2 -3
  234. package/dist/sequencer/sequencer.d.ts.map +1 -1
  235. package/dist/sequencer/sequencer.js +5 -17
  236. package/dist/sequencer/sequencer.js.map +1 -1
  237. package/package.json +15 -15
  238. package/src/account-manager/{index.ts → account-manager.ts} +107 -307
  239. package/src/account-manager/helpers/device-account.ts +1 -0
  240. package/src/account-manager/oauth-store.ts +494 -0
  241. package/src/actor-store/repo/reader.ts +11 -0
  242. package/src/actor-store/repo/transactor.ts +15 -4
  243. package/src/api/com/atproto/admin/deleteAccount.ts +2 -3
  244. package/src/api/com/atproto/admin/sendEmail.ts +3 -5
  245. package/src/api/com/atproto/admin/updateAccountEmail.ts +1 -2
  246. package/src/api/com/atproto/admin/updateAccountHandle.ts +7 -8
  247. package/src/api/com/atproto/admin/updateAccountPassword.ts +1 -2
  248. package/src/api/com/atproto/identity/requestPlcOperationSignature.ts +3 -5
  249. package/src/api/com/atproto/identity/resolveHandle.ts +2 -11
  250. package/src/api/com/atproto/identity/signPlcOperation.ts +3 -5
  251. package/src/api/com/atproto/identity/updateHandle.ts +7 -13
  252. package/src/api/com/atproto/repo/applyWrites.ts +21 -11
  253. package/src/api/com/atproto/repo/createRecord.ts +19 -14
  254. package/src/api/com/atproto/repo/deleteRecord.ts +26 -14
  255. package/src/api/com/atproto/repo/listRecords.ts +1 -11
  256. package/src/api/com/atproto/repo/putRecord.ts +24 -16
  257. package/src/api/com/atproto/server/activateAccount.ts +5 -20
  258. package/src/api/com/atproto/server/confirmEmail.ts +3 -5
  259. package/src/api/com/atproto/server/createAccount.ts +10 -11
  260. package/src/api/com/atproto/server/createAppPassword.ts +3 -6
  261. package/src/api/com/atproto/server/createSession.ts +3 -3
  262. package/src/api/com/atproto/server/deactivateAccount.ts +1 -2
  263. package/src/api/com/atproto/server/deleteAccount.ts +3 -5
  264. package/src/api/com/atproto/server/deleteSession.ts +2 -3
  265. package/src/api/com/atproto/server/getAccountInviteCodes.ts +3 -5
  266. package/src/api/com/atproto/server/getSession.ts +3 -3
  267. package/src/api/com/atproto/server/listAppPasswords.ts +3 -5
  268. package/src/api/com/atproto/server/refreshSession.ts +3 -3
  269. package/src/api/com/atproto/server/requestAccountDelete.ts +3 -5
  270. package/src/api/com/atproto/server/requestEmailConfirmation.ts +3 -5
  271. package/src/api/com/atproto/server/requestEmailUpdate.ts +3 -5
  272. package/src/api/com/atproto/server/requestPasswordReset.ts +1 -2
  273. package/src/api/com/atproto/server/resetPassword.ts +1 -2
  274. package/src/api/com/atproto/server/revokeAppPassword.ts +3 -5
  275. package/src/api/com/atproto/server/updateEmail.ts +3 -5
  276. package/src/api/com/atproto/sync/getRecord.ts +1 -4
  277. package/src/api/com/atproto/sync/getRepoStatus.ts +1 -1
  278. package/src/api/com/atproto/sync/listRepos.ts +1 -1
  279. package/src/api/com/atproto/sync/subscribeRepos.ts +2 -9
  280. package/src/api/com/atproto/temp/checkSignupQueue.ts +2 -2
  281. package/src/api/proxy.ts +19 -19
  282. package/src/app-view.ts +24 -0
  283. package/src/auth-routes.ts +9 -3
  284. package/src/auth-verifier.ts +1 -1
  285. package/src/config/config.ts +25 -13
  286. package/src/config/env.ts +12 -0
  287. package/src/context.ts +60 -24
  288. package/src/handle/index.ts +6 -52
  289. package/src/image/image-url.ts +16 -0
  290. package/src/index.ts +1 -1
  291. package/src/lexicon/index.ts +36 -0
  292. package/src/lexicon/lexicons.ts +243 -84
  293. package/src/lexicon/types/app/bsky/embed/video.ts +1 -0
  294. package/src/lexicon/types/app/bsky/labeler/defs.ts +7 -0
  295. package/src/lexicon/types/app/bsky/labeler/service.ts +7 -0
  296. package/src/lexicon/types/com/atproto/identity/defs.ts +30 -0
  297. package/src/lexicon/types/com/atproto/identity/refreshIdentity.ts +52 -0
  298. package/src/lexicon/types/com/atproto/identity/resolveDid.ts +52 -0
  299. package/src/lexicon/types/com/atproto/identity/resolveHandle.ts +1 -0
  300. package/src/lexicon/types/com/atproto/identity/resolveIdentity.ts +48 -0
  301. package/src/lexicon/types/com/atproto/moderation/defs.ts +3 -0
  302. package/src/lexicon/types/com/atproto/repo/listRecords.ts +0 -4
  303. package/src/lexicon/types/com/atproto/sync/getRecord.ts +0 -2
  304. package/src/lexicon/types/com/atproto/sync/subscribeRepos.ts +0 -59
  305. package/src/mailer/index.ts +7 -5
  306. package/src/read-after-write/viewer.ts +1 -1
  307. package/src/repo/types.ts +7 -2
  308. package/src/scripts/rebuild-repo.ts +4 -1
  309. package/src/sequencer/db/schema.ts +1 -8
  310. package/src/sequencer/events.ts +29 -75
  311. package/src/sequencer/sequencer.ts +9 -23
  312. package/tests/account-deletion.test.ts +3 -5
  313. package/tests/oauth.test.ts +286 -71
  314. package/tests/sequencer.test.ts +18 -27
  315. package/tests/sync/subscribe-repos.test.ts +67 -45
  316. package/tsconfig.build.tsbuildinfo +1 -1
  317. package/dist/account-manager/index.d.ts.map +0 -1
  318. package/dist/account-manager/index.js.map +0 -1
  319. package/dist/actor-store/repo/util.d.ts +0 -5
  320. package/dist/actor-store/repo/util.d.ts.map +0 -1
  321. package/dist/actor-store/repo/util.js +0 -25
  322. package/dist/actor-store/repo/util.js.map +0 -1
  323. package/dist/oauth/provider.d.ts +0 -10
  324. package/dist/oauth/provider.d.ts.map +0 -1
  325. package/dist/oauth/provider.js +0 -38
  326. package/dist/oauth/provider.js.map +0 -1
  327. package/src/actor-store/repo/util.ts +0 -22
  328. package/src/oauth/provider.ts +0 -59
@@ -1,10 +1,10 @@
1
1
  import { INVALID_HANDLE } from '@atproto/syntax'
2
2
  import { InvalidRequestError } from '@atproto/xrpc-server'
3
- import { formatAccountStatus } from '../../../../account-manager'
3
+ import { formatAccountStatus } from '../../../../account-manager/account-manager'
4
4
  import { AuthScope } from '../../../../auth-verifier'
5
5
  import { AppContext } from '../../../../context'
6
6
  import { Server } from '../../../../lexicon'
7
- import { authPassthru, resultPassthru } from '../../../proxy'
7
+ import { resultPassthru } from '../../../proxy'
8
8
  import { didDocForSession } from './util'
9
9
 
10
10
  export default function (server: Server, ctx: AppContext) {
@@ -17,7 +17,7 @@ export default function (server: Server, ctx: AppContext) {
17
17
  return resultPassthru(
18
18
  await ctx.entrywayAgent.com.atproto.server.getSession(
19
19
  undefined,
20
- authPassthru(req),
20
+ ctx.entrywayPassthruHeaders(req),
21
21
  ),
22
22
  )
23
23
  }
@@ -1,4 +1,3 @@
1
- import assert from 'node:assert'
2
1
  import { AppContext } from '../../../../context'
3
2
  import { Server } from '../../../../lexicon'
4
3
  import { ids } from '../../../../lexicon/lexicons'
@@ -7,15 +6,14 @@ import { resultPassthru } from '../../../proxy'
7
6
  export default function (server: Server, ctx: AppContext) {
8
7
  server.com.atproto.server.listAppPasswords({
9
8
  auth: ctx.authVerifier.accessStandard(),
10
- handler: async ({ auth }) => {
9
+ handler: async ({ auth, req }) => {
11
10
  if (ctx.entrywayAgent) {
12
- assert(ctx.cfg.entryway)
13
11
  return resultPassthru(
14
12
  await ctx.entrywayAgent.com.atproto.server.listAppPasswords(
15
13
  undefined,
16
- await ctx.serviceAuthHeaders(
14
+ await ctx.entrywayAuthHeaders(
15
+ req,
17
16
  auth.credentials.did,
18
- ctx.cfg.entryway.did,
19
17
  ids.ComAtprotoServerListAppPasswords,
20
18
  ),
21
19
  ),
@@ -1,10 +1,10 @@
1
1
  import { INVALID_HANDLE } from '@atproto/syntax'
2
2
  import { AuthRequiredError, InvalidRequestError } from '@atproto/xrpc-server'
3
- import { formatAccountStatus } from '../../../../account-manager'
3
+ import { formatAccountStatus } from '../../../../account-manager/account-manager'
4
4
  import { AppContext } from '../../../../context'
5
5
  import { softDeleted } from '../../../../db/util'
6
6
  import { Server } from '../../../../lexicon'
7
- import { authPassthru, resultPassthru } from '../../../proxy'
7
+ import { resultPassthru } from '../../../proxy'
8
8
  import { didDocForSession } from './util'
9
9
 
10
10
  export default function (server: Server, ctx: AppContext) {
@@ -32,7 +32,7 @@ export default function (server: Server, ctx: AppContext) {
32
32
  return resultPassthru(
33
33
  await ctx.entrywayAgent.com.atproto.server.refreshSession(
34
34
  undefined,
35
- authPassthru(req),
35
+ ctx.entrywayPassthruHeaders(req),
36
36
  ),
37
37
  )
38
38
  }
@@ -1,4 +1,3 @@
1
- import assert from 'node:assert'
2
1
  import { DAY, HOUR } from '@atproto/common'
3
2
  import { InvalidRequestError } from '@atproto/xrpc-server'
4
3
  import { AppContext } from '../../../../context'
@@ -20,7 +19,7 @@ export default function (server: Server, ctx: AppContext) {
20
19
  },
21
20
  ],
22
21
  auth: ctx.authVerifier.accessFull({ checkTakedown: true }),
23
- handler: async ({ auth }) => {
22
+ handler: async ({ auth, req }) => {
24
23
  const did = auth.credentials.did
25
24
  const account = await ctx.accountManager.getAccount(did, {
26
25
  includeDeactivated: true,
@@ -31,12 +30,11 @@ export default function (server: Server, ctx: AppContext) {
31
30
  }
32
31
 
33
32
  if (ctx.entrywayAgent) {
34
- assert(ctx.cfg.entryway)
35
33
  await ctx.entrywayAgent.com.atproto.server.requestAccountDelete(
36
34
  undefined,
37
- await ctx.serviceAuthHeaders(
35
+ await ctx.entrywayAuthHeaders(
36
+ req,
38
37
  auth.credentials.did,
39
- ctx.cfg.entryway.did,
40
38
  ids.ComAtprotoServerRequestAccountDelete,
41
39
  ),
42
40
  )
@@ -1,4 +1,3 @@
1
- import assert from 'node:assert'
2
1
  import { DAY, HOUR } from '@atproto/common'
3
2
  import { InvalidRequestError } from '@atproto/xrpc-server'
4
3
  import { AppContext } from '../../../../context'
@@ -20,7 +19,7 @@ export default function (server: Server, ctx: AppContext) {
20
19
  },
21
20
  ],
22
21
  auth: ctx.authVerifier.accessStandard({ checkTakedown: true }),
23
- handler: async ({ auth }) => {
22
+ handler: async ({ auth, req }) => {
24
23
  const did = auth.credentials.did
25
24
  const account = await ctx.accountManager.getAccount(did, {
26
25
  includeDeactivated: true,
@@ -31,12 +30,11 @@ export default function (server: Server, ctx: AppContext) {
31
30
  }
32
31
 
33
32
  if (ctx.entrywayAgent) {
34
- assert(ctx.cfg.entryway)
35
33
  await ctx.entrywayAgent.com.atproto.server.requestEmailConfirmation(
36
34
  undefined,
37
- await ctx.serviceAuthHeaders(
35
+ await ctx.entrywayAuthHeaders(
36
+ req,
38
37
  auth.credentials.did,
39
- ctx.cfg.entryway.did,
40
38
  ids.ComAtprotoServerRequestEmailConfirmation,
41
39
  ),
42
40
  )
@@ -1,4 +1,3 @@
1
- import assert from 'node:assert'
2
1
  import { DAY, HOUR } from '@atproto/common'
3
2
  import { InvalidRequestError } from '@atproto/xrpc-server'
4
3
  import { AppContext } from '../../../../context'
@@ -21,7 +20,7 @@ export default function (server: Server, ctx: AppContext) {
21
20
  },
22
21
  ],
23
22
  auth: ctx.authVerifier.accessStandard({ checkTakedown: true }),
24
- handler: async ({ auth }) => {
23
+ handler: async ({ auth, req }) => {
25
24
  const did = auth.credentials.did
26
25
  const account = await ctx.accountManager.getAccount(did, {
27
26
  includeDeactivated: true,
@@ -32,13 +31,12 @@ export default function (server: Server, ctx: AppContext) {
32
31
  }
33
32
 
34
33
  if (ctx.entrywayAgent) {
35
- assert(ctx.cfg.entryway)
36
34
  return resultPassthru(
37
35
  await ctx.entrywayAgent.com.atproto.server.requestEmailUpdate(
38
36
  undefined,
39
- await ctx.serviceAuthHeaders(
37
+ await ctx.entrywayAuthHeaders(
38
+ req,
40
39
  auth.credentials.did,
41
- ctx.cfg.entryway.did,
42
40
  ids.ComAtprotoServerRequestEmailUpdate,
43
41
  ),
44
42
  ),
@@ -2,7 +2,6 @@ import { DAY, HOUR } from '@atproto/common'
2
2
  import { InvalidRequestError } from '@atproto/xrpc-server'
3
3
  import { AppContext } from '../../../../context'
4
4
  import { Server } from '../../../../lexicon'
5
- import { authPassthru } from '../../../proxy'
6
5
 
7
6
  export default function (server: Server, ctx: AppContext) {
8
7
  server.com.atproto.server.requestPasswordReset({
@@ -28,7 +27,7 @@ export default function (server: Server, ctx: AppContext) {
28
27
  if (ctx.entrywayAgent) {
29
28
  await ctx.entrywayAgent.com.atproto.server.requestPasswordReset(
30
29
  input.body,
31
- authPassthru(req, true),
30
+ ctx.entrywayPassthruHeaders(req),
32
31
  )
33
32
  return
34
33
  }
@@ -1,7 +1,6 @@
1
1
  import { MINUTE } from '@atproto/common'
2
2
  import { AppContext } from '../../../../context'
3
3
  import { Server } from '../../../../lexicon'
4
- import { authPassthru } from '../../../proxy'
5
4
 
6
5
  export default function (server: Server, ctx: AppContext) {
7
6
  server.com.atproto.server.resetPassword({
@@ -15,7 +14,7 @@ export default function (server: Server, ctx: AppContext) {
15
14
  if (ctx.entrywayAgent) {
16
15
  await ctx.entrywayAgent.com.atproto.server.resetPassword(
17
16
  input.body,
18
- authPassthru(req, true),
17
+ ctx.entrywayPassthruHeaders(req),
19
18
  )
20
19
  return
21
20
  }
@@ -1,4 +1,3 @@
1
- import assert from 'node:assert'
2
1
  import { AppContext } from '../../../../context'
3
2
  import { Server } from '../../../../lexicon'
4
3
  import { ids } from '../../../../lexicon/lexicons'
@@ -6,14 +5,13 @@ import { ids } from '../../../../lexicon/lexicons'
6
5
  export default function (server: Server, ctx: AppContext) {
7
6
  server.com.atproto.server.revokeAppPassword({
8
7
  auth: ctx.authVerifier.accessStandard(),
9
- handler: async ({ auth, input }) => {
8
+ handler: async ({ auth, input, req }) => {
10
9
  if (ctx.entrywayAgent) {
11
- assert(ctx.cfg.entryway)
12
10
  await ctx.entrywayAgent.com.atproto.server.revokeAppPassword(
13
11
  input.body,
14
- await ctx.serviceAuthHeaders(
12
+ await ctx.entrywayAuthHeaders(
13
+ req,
15
14
  auth.credentials.did,
16
- ctx.cfg.entryway.did,
17
15
  ids.ComAtprotoServerRevokeAppPassword,
18
16
  ),
19
17
  )
@@ -1,4 +1,3 @@
1
- import assert from 'node:assert'
2
1
  import { isEmailValid } from '@hapi/address'
3
2
  import { isDisposableEmail } from 'disposable-email-domains-js'
4
3
  import { InvalidRequestError } from '@atproto/xrpc-server'
@@ -10,7 +9,7 @@ import { ids } from '../../../../lexicon/lexicons'
10
9
  export default function (server: Server, ctx: AppContext) {
11
10
  server.com.atproto.server.updateEmail({
12
11
  auth: ctx.authVerifier.accessFull({ checkTakedown: true }),
13
- handler: async ({ auth, input }) => {
12
+ handler: async ({ auth, input, req }) => {
14
13
  const did = auth.credentials.did
15
14
  const { token, email } = input.body
16
15
  if (!isEmailValid(email) || isDisposableEmail(email)) {
@@ -26,12 +25,11 @@ export default function (server: Server, ctx: AppContext) {
26
25
  }
27
26
 
28
27
  if (ctx.entrywayAgent) {
29
- assert(ctx.cfg.entryway)
30
28
  await ctx.entrywayAgent.com.atproto.server.updateEmail(
31
29
  input.body,
32
- await ctx.serviceAuthHeaders(
30
+ await ctx.entrywayAuthHeaders(
31
+ req,
33
32
  auth.credentials.did,
34
- ctx.cfg.entryway.did,
35
33
  ids.ComAtprotoServerUpdateEmail,
36
34
  ),
37
35
  )
@@ -1,5 +1,4 @@
1
1
  import stream from 'node:stream'
2
- import { CID } from 'multiformats/cid'
3
2
  import { byteIterableToStream } from '@atproto/common'
4
3
  import * as repo from '@atproto/repo'
5
4
  import { InvalidRequestError } from '@atproto/xrpc-server'
@@ -25,9 +24,7 @@ export default function (server: Server, ctx: AppContext) {
25
24
  let carStream: stream.Readable
26
25
  try {
27
26
  const storage = new SqlRepoReader(actorDb)
28
- const commit = params.commit
29
- ? CID.parse(params.commit)
30
- : await storage.getRoot()
27
+ const commit = await storage.getRoot()
31
28
 
32
29
  if (!commit) {
33
30
  throw new InvalidRequestError(`Could not find repo for DID: ${did}`)
@@ -1,4 +1,4 @@
1
- import { formatAccountStatus } from '../../../../account-manager'
1
+ import { formatAccountStatus } from '../../../../account-manager/account-manager'
2
2
  import { AppContext } from '../../../../context'
3
3
  import { Server } from '../../../../lexicon'
4
4
  import { assertRepoAvailability } from './util'
@@ -1,5 +1,5 @@
1
1
  import { InvalidRequestError } from '@atproto/xrpc-server'
2
- import { formatAccountStatus } from '../../../../account-manager'
2
+ import { formatAccountStatus } from '../../../../account-manager/account-manager'
3
3
  import { AppContext } from '../../../../context'
4
4
  import { Cursor, GenericKeyset, paginate } from '../../../../db/pagination'
5
5
  import { Server } from '../../../../lexicon'
@@ -45,9 +45,9 @@ export default function (server: Server, ctx: AppContext) {
45
45
  time: evt.time,
46
46
  ...evt.evt,
47
47
  }
48
- } else if (evt.type === 'handle') {
48
+ } else if (evt.type === 'sync') {
49
49
  yield {
50
- $type: '#handle',
50
+ $type: '#sync',
51
51
  seq: evt.seq,
52
52
  time: evt.time,
53
53
  ...evt.evt,
@@ -66,13 +66,6 @@ export default function (server: Server, ctx: AppContext) {
66
66
  time: evt.time,
67
67
  ...evt.evt,
68
68
  }
69
- } else if (evt.type === 'tombstone') {
70
- yield {
71
- $type: '#tombstone',
72
- seq: evt.seq,
73
- time: evt.time,
74
- ...evt.evt,
75
- }
76
69
  }
77
70
  }
78
71
  })
@@ -1,7 +1,7 @@
1
1
  import { AuthScope } from '../../../../auth-verifier'
2
2
  import { AppContext } from '../../../../context'
3
3
  import { Server } from '../../../../lexicon'
4
- import { authPassthru, resultPassthru } from '../../../proxy'
4
+ import { resultPassthru } from '../../../proxy'
5
5
 
6
6
  // THIS IS A TEMPORARY UNSPECCED ROUTE
7
7
  export default function (server: Server, ctx: AppContext) {
@@ -21,7 +21,7 @@ export default function (server: Server, ctx: AppContext) {
21
21
  return resultPassthru(
22
22
  await ctx.entrywayAgent.com.atproto.temp.checkSignupQueue(
23
23
  undefined,
24
- authPassthru(req),
24
+ ctx.entrywayPassthruHeaders(req),
25
25
  ),
26
26
  )
27
27
  },
package/src/api/proxy.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { IncomingMessage } from 'node:http'
2
+ import express from 'express'
2
3
  import { Headers } from '@atproto/xrpc'
3
4
  import { InvalidRequestError } from '@atproto/xrpc-server'
4
5
 
@@ -10,21 +11,7 @@ export const resultPassthru = <T>(result: { headers: Headers; data: T }) => {
10
11
  }
11
12
  }
12
13
 
13
- // Output designed to passed as second arg to AtpAgent methods.
14
- // The encoding field here is a quirk of the AtpAgent.
15
- export function authPassthru(
16
- req: IncomingMessage,
17
- withEncoding?: false,
18
- ): { headers: { authorization: string }; encoding: undefined } | undefined
19
-
20
- export function authPassthru(
21
- req: IncomingMessage,
22
- withEncoding: true,
23
- ):
24
- | { headers: { authorization: string }; encoding: 'application/json' }
25
- | undefined
26
-
27
- export function authPassthru(req: IncomingMessage, withEncoding?: boolean) {
14
+ export function authPassthru(req: IncomingMessage) {
28
15
  const { authorization } = req.headers
29
16
 
30
17
  if (authorization) {
@@ -45,9 +32,22 @@ export function authPassthru(req: IncomingMessage, withEncoding?: boolean) {
45
32
  throw new InvalidRequestError('DPoP requests cannot be proxied')
46
33
  }
47
34
 
48
- return {
49
- headers: { authorization },
50
- encoding: withEncoding ? 'application/json' : undefined,
51
- }
35
+ return { headers: { authorization } }
52
36
  }
53
37
  }
38
+
39
+ // @NOTE this function may mutate its params input
40
+ // future improvement here would be to forward along all untrusted ips rather than just the first (req.ip)
41
+ export const forwardedFor = (
42
+ req: express.Request,
43
+ params: HeadersParam | undefined,
44
+ ) => {
45
+ const result: HeadersParam = params ?? { headers: {} }
46
+ const ip = req.ip
47
+ if (ip) {
48
+ result.headers['x-forwarded-for'] = ip
49
+ }
50
+ return result
51
+ }
52
+
53
+ type HeadersParam = { headers: Record<string, string> }
@@ -0,0 +1,24 @@
1
+ import { format } from 'node:util'
2
+ import { AtpAgent } from '@atproto/api'
3
+
4
+ export type AppViewOptions = {
5
+ url: string
6
+ did: string
7
+ cdnUrlPattern?: string
8
+ }
9
+
10
+ export class AppView {
11
+ public did: string
12
+ public agent: AtpAgent
13
+ private cdnUrlPattern?: string
14
+
15
+ constructor(options: AppViewOptions) {
16
+ this.did = options.did
17
+ this.agent = new AtpAgent({ service: options.url })
18
+ this.cdnUrlPattern = options.cdnUrlPattern
19
+ }
20
+
21
+ getImageUrl(pattern: string, did: string, cid: string): string | undefined {
22
+ if (this.cdnUrlPattern) return format(this.cdnUrlPattern, pattern, did, cid)
23
+ }
24
+ }
@@ -1,8 +1,9 @@
1
1
  import { Router } from 'express'
2
2
  import { oauthProtectedResourceMetadataSchema } from '@atproto/oauth-provider'
3
3
  import { AppContext } from './context'
4
+ import { oauthLogger } from './logger'
4
5
 
5
- export const createRouter = ({ authProvider, cfg }: AppContext): Router => {
6
+ export const createRouter = ({ oauthProvider, cfg }: AppContext): Router => {
6
7
  const router = Router()
7
8
 
8
9
  const oauthProtectedResourceMetadata =
@@ -28,8 +29,13 @@ export const createRouter = ({ authProvider, cfg }: AppContext): Router => {
28
29
  res.status(200).json(oauthProtectedResourceMetadata)
29
30
  })
30
31
 
31
- if (authProvider) {
32
- router.use(authProvider.createRouter())
32
+ if (oauthProvider) {
33
+ const oauthMiddleware = oauthProvider.httpHandler({
34
+ onError: (req, res, err, message) => {
35
+ oauthLogger.error({ err, req }, message)
36
+ },
37
+ })
38
+ router.use(oauthMiddleware)
33
39
  }
34
40
 
35
41
  return router
@@ -19,7 +19,7 @@ import {
19
19
  parseReqNsid,
20
20
  verifyJwt as verifyServiceJwt,
21
21
  } from '@atproto/xrpc-server'
22
- import { AccountManager } from './account-manager'
22
+ import { AccountManager } from './account-manager/account-manager'
23
23
  import { softDeleted } from './db'
24
24
 
25
25
  type ReqCtx = AuthVerifierContext | StreamAuthVerifierContext
@@ -1,7 +1,7 @@
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 { Customization } from '@atproto/oauth-provider'
4
+ import { BrandingConfig, HcaptchaConfig } from '@atproto/oauth-provider'
5
5
  import { ServerEnvironment } from './env'
6
6
 
7
7
  // off-config but still from env:
@@ -261,38 +261,49 @@ export const envToCfg = (env: ServerEnvironment): ServerConfig => {
261
261
  : {
262
262
  issuer: serviceCfg.publicUrl,
263
263
  provider: {
264
- customization: {
264
+ hcaptcha:
265
+ env.hcaptchaSiteKey &&
266
+ env.hcaptchaSecretKey &&
267
+ env.hcaptchaTokenSalt
268
+ ? {
269
+ siteKey: env.hcaptchaSiteKey,
270
+ secretKey: env.hcaptchaSecretKey,
271
+ tokenSalt: env.hcaptchaTokenSalt,
272
+ }
273
+ : undefined,
274
+ branding: {
265
275
  name: env.serviceName ?? 'Personal PDS',
266
276
  logo: env.logoUrl,
267
277
  colors: {
268
278
  brand: env.brandColor,
269
279
  error: env.errorColor,
270
280
  warning: env.warningColor,
281
+ success: env.successColor,
271
282
  },
272
283
  links: [
273
284
  {
274
- title: 'Home',
285
+ title: { en: 'Home', fr: 'Accueil' },
275
286
  href: env.homeUrl,
276
- rel: 'bookmark',
287
+ rel: 'canonical' as const, // Prevents login page from being indexed
277
288
  },
278
289
  {
279
- title: 'Terms of Service',
290
+ title: { en: 'Terms of Service' },
280
291
  href: env.termsOfServiceUrl,
281
- rel: 'terms-of-service',
292
+ rel: 'terms-of-service' as const,
282
293
  },
283
294
  {
284
- title: 'Privacy Policy',
295
+ title: { en: 'Privacy Policy' },
285
296
  href: env.privacyPolicyUrl,
286
- rel: 'privacy-policy',
297
+ rel: 'privacy-policy' as const,
287
298
  },
288
299
  {
289
- title: 'Support',
300
+ title: { en: 'Support' },
290
301
  href: env.supportUrl,
291
- rel: 'help',
302
+ rel: 'help' as const,
292
303
  },
293
304
  ].filter(
294
- (f): f is typeof f & { href: NonNullable<(typeof f)['href']> } =>
295
- f.href != null,
305
+ <T extends { href?: string }>(f: T): f is T & { href: string } =>
306
+ f.href != null && f.href !== '',
296
307
  ),
297
308
  },
298
309
  },
@@ -435,7 +446,8 @@ export type OAuthConfig = {
435
446
  provider:
436
447
  | false
437
448
  | {
438
- customization: Customization
449
+ hcaptcha?: HcaptchaConfig
450
+ branding: BrandingConfig
439
451
  }
440
452
  }
441
453
 
package/src/config/env.ts CHANGED
@@ -18,10 +18,16 @@ export const readEnv = (): ServerEnvironment => {
18
18
  blobUploadLimit: envInt('PDS_BLOB_UPLOAD_LIMIT'),
19
19
  devMode: envBool('PDS_DEV_MODE'),
20
20
 
21
+ // OAuth
22
+ hcaptchaSiteKey: envStr('PDS_HCAPTCHA_SITE_KEY'),
23
+ hcaptchaSecretKey: envStr('PDS_HCAPTCHA_SECRET_KEY'),
24
+ hcaptchaTokenSalt: envStr('PDS_HCAPTCHA_TOKEN_SALT'),
25
+
21
26
  // branding
22
27
  brandColor: envStr('PDS_PRIMARY_COLOR'),
23
28
  errorColor: envStr('PDS_ERROR_COLOR'),
24
29
  warningColor: envStr('PDS_WARNING_COLOR'),
30
+ successColor: envStr('PDS_SUCCESS_COLOR'),
25
31
 
26
32
  // database
27
33
  dataDirectory: envStr('PDS_DATA_DIRECTORY'),
@@ -150,10 +156,16 @@ export type ServerEnvironment = {
150
156
  blobUploadLimit?: number
151
157
  devMode?: boolean
152
158
 
159
+ // OAuth
160
+ hcaptchaSiteKey?: string
161
+ hcaptchaSecretKey?: string
162
+ hcaptchaTokenSalt?: string
163
+
153
164
  // branding
154
165
  brandColor?: string
155
166
  errorColor?: string
156
167
  warningColor?: string
168
+ successColor?: string
157
169
 
158
170
  // database
159
171
  dataDirectory?: string