@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.
- package/CHANGELOG.md +27 -0
- package/dist/account-manager/account-manager.d.ts +35 -4
- package/dist/account-manager/account-manager.d.ts.map +1 -1
- package/dist/account-manager/account-manager.js +67 -6
- package/dist/account-manager/account-manager.js.map +1 -1
- package/dist/account-manager/helpers/account.d.ts +1 -1
- package/dist/account-manager/helpers/account.d.ts.map +1 -1
- package/dist/account-manager/helpers/account.js +10 -4
- package/dist/account-manager/helpers/account.js.map +1 -1
- package/dist/account-manager/oauth-store.d.ts +2 -1
- package/dist/account-manager/oauth-store.d.ts.map +1 -1
- package/dist/account-manager/oauth-store.js +61 -12
- package/dist/account-manager/oauth-store.js.map +1 -1
- package/dist/actor-store/record/reader.d.ts +1 -1
- package/dist/actor-store/record/reader.d.ts.map +1 -1
- package/dist/actor-store/record/reader.js.map +1 -1
- package/dist/api/app/bsky/actor/getPreferences.d.ts.map +1 -1
- package/dist/api/app/bsky/actor/getPreferences.js +7 -2
- package/dist/api/app/bsky/actor/getPreferences.js.map +1 -1
- package/dist/api/app/bsky/actor/putPreferences.d.ts.map +1 -1
- package/dist/api/app/bsky/actor/putPreferences.js +7 -2
- package/dist/api/app/bsky/actor/putPreferences.js.map +1 -1
- package/dist/api/com/atproto/admin/updateAccountHandle.d.ts.map +1 -1
- package/dist/api/com/atproto/admin/updateAccountHandle.js +33 -43
- package/dist/api/com/atproto/admin/updateAccountHandle.js.map +1 -1
- package/dist/api/com/atproto/identity/updateHandle.d.ts.map +1 -1
- package/dist/api/com/atproto/identity/updateHandle.js +39 -61
- package/dist/api/com/atproto/identity/updateHandle.js.map +1 -1
- package/dist/api/com/atproto/repo/getRecord.js +3 -3
- package/dist/api/com/atproto/repo/getRecord.js.map +1 -1
- package/dist/api/com/atproto/repo/putRecord.js +2 -2
- package/dist/api/com/atproto/repo/putRecord.js.map +1 -1
- package/dist/api/com/atproto/server/getServiceAuth.d.ts.map +1 -1
- package/dist/api/com/atproto/server/getServiceAuth.js +4 -0
- package/dist/api/com/atproto/server/getServiceAuth.js.map +1 -1
- package/dist/config/config.d.ts +5 -2
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/config.js +50 -46
- package/dist/config/config.js.map +1 -1
- package/dist/config/env.d.ts +1 -0
- package/dist/config/env.d.ts.map +1 -1
- package/dist/config/env.js +1 -0
- package/dist/config/env.js.map +1 -1
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +3 -3
- package/dist/context.js.map +1 -1
- package/dist/lexicons/app/bsky/actor/defs.defs.d.ts +8 -0
- package/dist/lexicons/app/bsky/actor/defs.defs.d.ts.map +1 -1
- package/dist/lexicons/app/bsky/actor/defs.defs.js +3 -0
- package/dist/lexicons/app/bsky/actor/defs.defs.js.map +1 -1
- package/dist/lexicons/app/bsky/actor/profile.defs.d.ts.map +1 -1
- package/dist/lexicons/app/bsky/actor/status.defs.d.ts.map +1 -1
- package/dist/lexicons/app/bsky/draft/defs.defs.d.ts +22 -0
- package/dist/lexicons/app/bsky/draft/defs.defs.d.ts.map +1 -1
- package/dist/lexicons/app/bsky/draft/defs.defs.js +11 -0
- package/dist/lexicons/app/bsky/draft/defs.defs.js.map +1 -1
- package/dist/lexicons/app/bsky/embed/gallery.d.ts +3 -0
- package/dist/lexicons/app/bsky/embed/gallery.d.ts.map +1 -0
- package/dist/lexicons/app/bsky/embed/gallery.defs.d.ts +130 -0
- package/dist/lexicons/app/bsky/embed/gallery.defs.d.ts.map +1 -0
- package/dist/lexicons/app/bsky/embed/gallery.defs.js +47 -0
- package/dist/lexicons/app/bsky/embed/gallery.defs.js.map +1 -0
- package/dist/lexicons/app/bsky/embed/gallery.js +6 -0
- package/dist/lexicons/app/bsky/embed/gallery.js.map +1 -0
- package/dist/lexicons/app/bsky/embed/record.defs.d.ts +2 -1
- package/dist/lexicons/app/bsky/embed/record.defs.d.ts.map +1 -1
- package/dist/lexicons/app/bsky/embed/record.defs.js +2 -0
- package/dist/lexicons/app/bsky/embed/record.defs.js.map +1 -1
- package/dist/lexicons/app/bsky/embed/recordWithMedia.defs.d.ts +13 -12
- package/dist/lexicons/app/bsky/embed/recordWithMedia.defs.d.ts.map +1 -1
- package/dist/lexicons/app/bsky/embed/recordWithMedia.defs.js +3 -0
- package/dist/lexicons/app/bsky/embed/recordWithMedia.defs.js.map +1 -1
- package/dist/lexicons/app/bsky/embed.d.ts +1 -0
- package/dist/lexicons/app/bsky/embed.d.ts.map +1 -1
- package/dist/lexicons/app/bsky/embed.js +1 -0
- package/dist/lexicons/app/bsky/embed.js.map +1 -1
- package/dist/lexicons/app/bsky/feed/defs.defs.d.ts +2 -1
- package/dist/lexicons/app/bsky/feed/defs.defs.d.ts.map +1 -1
- package/dist/lexicons/app/bsky/feed/defs.defs.js +2 -0
- package/dist/lexicons/app/bsky/feed/defs.defs.js.map +1 -1
- package/dist/lexicons/app/bsky/feed/generator.defs.d.ts.map +1 -1
- package/dist/lexicons/app/bsky/feed/like.defs.d.ts.map +1 -1
- package/dist/lexicons/app/bsky/feed/post.defs.d.ts +12 -11
- package/dist/lexicons/app/bsky/feed/post.defs.d.ts.map +1 -1
- package/dist/lexicons/app/bsky/feed/post.defs.js +2 -0
- package/dist/lexicons/app/bsky/feed/post.defs.js.map +1 -1
- package/dist/lexicons/app/bsky/feed/postgate.defs.d.ts.map +1 -1
- package/dist/lexicons/app/bsky/feed/repost.defs.d.ts.map +1 -1
- package/dist/lexicons/app/bsky/feed/threadgate.defs.d.ts.map +1 -1
- package/dist/lexicons/app/bsky/graph/block.defs.d.ts.map +1 -1
- package/dist/lexicons/app/bsky/graph/follow.defs.d.ts.map +1 -1
- package/dist/lexicons/app/bsky/graph/list.defs.d.ts.map +1 -1
- package/dist/lexicons/app/bsky/graph/listblock.defs.d.ts.map +1 -1
- package/dist/lexicons/app/bsky/graph/listitem.defs.d.ts.map +1 -1
- package/dist/lexicons/app/bsky/graph/starterpack.defs.d.ts.map +1 -1
- package/dist/lexicons/app/bsky/graph/verification.defs.d.ts.map +1 -1
- package/dist/lexicons/app/bsky/labeler/service.defs.d.ts.map +1 -1
- package/dist/lexicons/app/bsky/notification/declaration.defs.d.ts.map +1 -1
- package/dist/lexicons/chat/bsky/actor/declaration.defs.d.ts.map +1 -1
- package/dist/lexicons/chat/bsky/actor/getStatus.defs.d.ts +2 -0
- package/dist/lexicons/chat/bsky/actor/getStatus.defs.d.ts.map +1 -1
- package/dist/lexicons/chat/bsky/actor/getStatus.defs.js +1 -0
- package/dist/lexicons/chat/bsky/actor/getStatus.defs.js.map +1 -1
- package/dist/lexicons/chat/bsky/authFullChatClient.defs.d.ts.map +1 -1
- package/dist/lexicons/chat/bsky/authFullChatClient.defs.js +1 -0
- package/dist/lexicons/chat/bsky/authFullChatClient.defs.js.map +1 -1
- package/dist/lexicons/chat/bsky/convo/defs.defs.d.ts +53 -14
- package/dist/lexicons/chat/bsky/convo/defs.defs.d.ts.map +1 -1
- package/dist/lexicons/chat/bsky/convo/defs.defs.js +33 -5
- package/dist/lexicons/chat/bsky/convo/defs.defs.js.map +1 -1
- package/dist/lexicons/chat/bsky/convo/getConvoForMembers.defs.d.ts +1 -1
- package/dist/lexicons/chat/bsky/convo/getConvoForMembers.defs.d.ts.map +1 -1
- package/dist/lexicons/chat/bsky/convo/getConvoForMembers.defs.js +1 -0
- package/dist/lexicons/chat/bsky/convo/getConvoForMembers.defs.js.map +1 -1
- package/dist/lexicons/chat/bsky/convo/getLog.defs.d.ts +2 -2
- package/dist/lexicons/chat/bsky/convo/getLog.defs.d.ts.map +1 -1
- package/dist/lexicons/chat/bsky/convo/getLog.defs.js +3 -0
- package/dist/lexicons/chat/bsky/convo/getLog.defs.js.map +1 -1
- package/dist/lexicons/chat/bsky/embed/joinLink.d.ts +3 -0
- package/dist/lexicons/chat/bsky/embed/joinLink.d.ts.map +1 -0
- package/dist/lexicons/chat/bsky/embed/joinLink.defs.d.ts +99 -0
- package/dist/lexicons/chat/bsky/embed/joinLink.defs.d.ts.map +1 -0
- package/dist/lexicons/chat/bsky/embed/joinLink.defs.js +28 -0
- package/dist/lexicons/chat/bsky/embed/joinLink.defs.js.map +1 -0
- package/dist/lexicons/chat/bsky/embed/joinLink.js +6 -0
- package/dist/lexicons/chat/bsky/embed/joinLink.js.map +1 -0
- package/dist/lexicons/chat/bsky/embed.d.ts +2 -0
- package/dist/lexicons/chat/bsky/embed.d.ts.map +1 -0
- package/dist/lexicons/chat/bsky/embed.js +5 -0
- package/dist/lexicons/chat/bsky/embed.js.map +1 -0
- package/dist/lexicons/chat/bsky/group/addMembers.defs.d.ts +1 -1
- package/dist/lexicons/chat/bsky/group/addMembers.defs.d.ts.map +1 -1
- package/dist/lexicons/chat/bsky/group/addMembers.defs.js +1 -0
- package/dist/lexicons/chat/bsky/group/addMembers.defs.js.map +1 -1
- package/dist/lexicons/chat/bsky/group/createGroup.defs.d.ts +1 -1
- package/dist/lexicons/chat/bsky/group/createGroup.defs.d.ts.map +1 -1
- package/dist/lexicons/chat/bsky/group/createGroup.defs.js +1 -0
- package/dist/lexicons/chat/bsky/group/createGroup.defs.js.map +1 -1
- package/dist/lexicons/chat/bsky/group/getJoinLinkPreviews.defs.d.ts +1 -1
- package/dist/lexicons/chat/bsky/group/getJoinLinkPreviews.defs.d.ts.map +1 -1
- package/dist/lexicons/chat/bsky/group/getJoinLinkPreviews.defs.js +1 -1
- package/dist/lexicons/chat/bsky/group/getJoinLinkPreviews.defs.js.map +1 -1
- package/dist/lexicons/chat/bsky/group/updateJoinRequestsRead.d.ts +3 -0
- package/dist/lexicons/chat/bsky/group/updateJoinRequestsRead.d.ts.map +1 -0
- package/dist/lexicons/chat/bsky/group/updateJoinRequestsRead.defs.d.ts +20 -0
- package/dist/lexicons/chat/bsky/group/updateJoinRequestsRead.defs.d.ts.map +1 -0
- package/dist/lexicons/chat/bsky/group/updateJoinRequestsRead.defs.js +19 -0
- package/dist/lexicons/chat/bsky/group/updateJoinRequestsRead.defs.js.map +1 -0
- package/dist/lexicons/chat/bsky/group/updateJoinRequestsRead.js +6 -0
- package/dist/lexicons/chat/bsky/group/updateJoinRequestsRead.js.map +1 -0
- package/dist/lexicons/chat/bsky/group/withdrawJoinRequest.d.ts +3 -0
- package/dist/lexicons/chat/bsky/group/withdrawJoinRequest.d.ts.map +1 -0
- package/dist/lexicons/chat/bsky/group/withdrawJoinRequest.defs.d.ts +20 -0
- package/dist/lexicons/chat/bsky/group/withdrawJoinRequest.defs.d.ts.map +1 -0
- package/dist/lexicons/chat/bsky/group/withdrawJoinRequest.defs.js +18 -0
- package/dist/lexicons/chat/bsky/group/withdrawJoinRequest.defs.js.map +1 -0
- package/dist/lexicons/chat/bsky/group/withdrawJoinRequest.js +6 -0
- package/dist/lexicons/chat/bsky/group/withdrawJoinRequest.js.map +1 -0
- package/dist/lexicons/chat/bsky/group.d.ts +2 -0
- package/dist/lexicons/chat/bsky/group.d.ts.map +1 -1
- package/dist/lexicons/chat/bsky/group.js +2 -0
- package/dist/lexicons/chat/bsky/group.js.map +1 -1
- package/dist/lexicons/chat/bsky/moderation/defs.d.ts +2 -0
- package/dist/lexicons/chat/bsky/moderation/defs.d.ts.map +1 -0
- package/dist/lexicons/chat/bsky/moderation/defs.defs.d.ts +58 -0
- package/dist/lexicons/chat/bsky/moderation/defs.defs.d.ts.map +1 -0
- package/dist/lexicons/chat/bsky/moderation/defs.defs.js +38 -0
- package/dist/lexicons/chat/bsky/moderation/defs.defs.js.map +1 -0
- package/dist/lexicons/chat/bsky/moderation/defs.js +5 -0
- package/dist/lexicons/chat/bsky/moderation/defs.js.map +1 -0
- package/dist/lexicons/chat/bsky/moderation/getConvo.d.ts +3 -0
- package/dist/lexicons/chat/bsky/moderation/getConvo.d.ts.map +1 -0
- package/dist/lexicons/chat/bsky/moderation/getConvo.defs.d.ts +22 -0
- package/dist/lexicons/chat/bsky/moderation/getConvo.defs.d.ts.map +1 -0
- package/dist/lexicons/chat/bsky/moderation/getConvo.defs.js +18 -0
- package/dist/lexicons/chat/bsky/moderation/getConvo.defs.js.map +1 -0
- package/dist/lexicons/chat/bsky/moderation/getConvo.js +6 -0
- package/dist/lexicons/chat/bsky/moderation/getConvo.js.map +1 -0
- package/dist/lexicons/chat/bsky/moderation/getConvoMembers.d.ts +3 -0
- package/dist/lexicons/chat/bsky/moderation/getConvoMembers.d.ts.map +1 -0
- package/dist/lexicons/chat/bsky/moderation/getConvoMembers.defs.d.ts +28 -0
- package/dist/lexicons/chat/bsky/moderation/getConvoMembers.defs.d.ts.map +1 -0
- package/dist/lexicons/chat/bsky/moderation/getConvoMembers.defs.js +24 -0
- package/dist/lexicons/chat/bsky/moderation/getConvoMembers.defs.js.map +1 -0
- package/dist/lexicons/chat/bsky/moderation/getConvoMembers.js +6 -0
- package/dist/lexicons/chat/bsky/moderation/getConvoMembers.js.map +1 -0
- package/dist/lexicons/chat/bsky/moderation/getConvos.d.ts +3 -0
- package/dist/lexicons/chat/bsky/moderation/getConvos.d.ts.map +1 -0
- package/dist/lexicons/chat/bsky/moderation/getConvos.defs.d.ts +22 -0
- package/dist/lexicons/chat/bsky/moderation/getConvos.defs.d.ts.map +1 -0
- package/dist/lexicons/chat/bsky/moderation/getConvos.defs.js +22 -0
- package/dist/lexicons/chat/bsky/moderation/getConvos.defs.js.map +1 -0
- package/dist/lexicons/chat/bsky/moderation/getConvos.js +6 -0
- package/dist/lexicons/chat/bsky/moderation/getConvos.js.map +1 -0
- package/dist/lexicons/chat/bsky/moderation/subscribeModEvents.defs.d.ts +20 -2
- package/dist/lexicons/chat/bsky/moderation/subscribeModEvents.defs.d.ts.map +1 -1
- package/dist/lexicons/chat/bsky/moderation/subscribeModEvents.defs.js +11 -0
- package/dist/lexicons/chat/bsky/moderation/subscribeModEvents.defs.js.map +1 -1
- package/dist/lexicons/chat/bsky/moderation.d.ts +4 -0
- package/dist/lexicons/chat/bsky/moderation.d.ts.map +1 -1
- package/dist/lexicons/chat/bsky/moderation.js +4 -0
- package/dist/lexicons/chat/bsky/moderation.js.map +1 -1
- package/dist/lexicons/chat/bsky.d.ts +1 -0
- package/dist/lexicons/chat/bsky.d.ts.map +1 -1
- package/dist/lexicons/chat/bsky.js +1 -0
- package/dist/lexicons/chat/bsky.js.map +1 -1
- package/dist/lexicons/com/atproto/lexicon/schema.defs.d.ts.map +1 -1
- package/dist/lexicons/com/atproto/server/getServiceAuth.defs.d.ts +2 -2
- package/dist/lexicons/com/atproto/server/getServiceAuth.defs.js +1 -1
- package/dist/lexicons/com/atproto/server/getServiceAuth.defs.js.map +1 -1
- package/dist/lexicons/com/germnetwork/declaration.defs.d.ts.map +1 -1
- package/dist/lexicons/site/standard/document.defs.d.ts.map +1 -1
- package/dist/lexicons/site/standard/graph/recommend.defs.d.ts.map +1 -1
- package/dist/lexicons/site/standard/graph/subscription.defs.d.ts.map +1 -1
- package/dist/lexicons/site/standard/publication.defs.d.ts.map +1 -1
- package/dist/lexicons/site/standard/theme/basic.defs.d.ts.map +1 -1
- package/dist/lexicons/tools/ozone/moderation/defs.defs.d.ts +11 -3
- package/dist/lexicons/tools/ozone/moderation/defs.defs.d.ts.map +1 -1
- package/dist/lexicons/tools/ozone/moderation/defs.defs.js +9 -0
- package/dist/lexicons/tools/ozone/moderation/defs.defs.js.map +1 -1
- package/dist/lexicons/tools/ozone/moderation/queryEvents.defs.d.ts +2 -2
- package/dist/lexicons/tools/ozone/moderation/queryEvents.defs.d.ts.map +1 -1
- package/dist/lexicons/tools/ozone/moderation/queryEvents.defs.js.map +1 -1
- package/dist/lexicons/tools/ozone/moderation/queryStatuses.defs.d.ts +2 -2
- package/dist/lexicons/tools/ozone/moderation/queryStatuses.defs.d.ts.map +1 -1
- package/dist/lexicons/tools/ozone/moderation/queryStatuses.defs.js.map +1 -1
- package/dist/mailer/index.d.ts +3 -3
- package/dist/mailer/index.d.ts.map +1 -1
- package/dist/mailer/index.js +18 -9
- package/dist/mailer/index.js.map +1 -1
- package/dist/mailer/templates/confirm-email.js +11 -3
- package/dist/mailer/templates/confirm-email.js.map +2 -2
- package/dist/mailer/templates/delete-account.js +2 -2
- package/dist/mailer/templates/delete-account.js.map +2 -2
- package/dist/mailer/templates/plc-operation.js +2 -2
- package/dist/mailer/templates/plc-operation.js.map +2 -2
- package/dist/mailer/templates/reset-password.js +2 -2
- package/dist/mailer/templates/reset-password.js.map +2 -2
- package/dist/mailer/templates/update-email.js +2 -2
- package/dist/mailer/templates/update-email.js.map +2 -2
- package/dist/mailer/templates.d.ts +11 -0
- package/dist/mailer/templates.d.ts.map +1 -1
- package/dist/mailer/templates.js.map +1 -1
- package/dist/pipethrough.d.ts +3 -0
- package/dist/pipethrough.d.ts.map +1 -1
- package/dist/pipethrough.js +25 -9
- package/dist/pipethrough.js.map +1 -1
- package/dist/read-after-write/viewer.d.ts +2 -2
- package/package.json +7 -6
- package/src/account-manager/account-manager.ts +105 -7
- package/src/account-manager/helpers/account.ts +15 -7
- package/src/account-manager/oauth-store.ts +76 -18
- package/src/actor-store/record/reader.ts +1 -1
- package/src/api/app/bsky/actor/getPreferences.ts +11 -2
- package/src/api/app/bsky/actor/putPreferences.ts +11 -2
- package/src/api/com/atproto/admin/updateAccountHandle.ts +37 -46
- package/src/api/com/atproto/identity/updateHandle.ts +45 -76
- package/src/api/com/atproto/repo/getRecord.ts +3 -3
- package/src/api/com/atproto/repo/putRecord.ts +2 -2
- package/src/api/com/atproto/server/getServiceAuth.ts +7 -0
- package/src/config/config.ts +69 -57
- package/src/config/env.ts +3 -0
- package/src/context.ts +13 -10
- package/src/mailer/index.ts +25 -9
- package/src/mailer/templates/confirm-email.hbs +18 -17
- package/src/mailer/templates/delete-account.hbs +6 -6
- package/src/mailer/templates/plc-operation.hbs +6 -6
- package/src/mailer/templates/reset-password.hbs +7 -7
- package/src/mailer/templates/update-email.hbs +6 -6
- package/src/mailer/templates.ts +12 -0
- package/src/pipethrough.ts +33 -12
- package/tests/_puppeteer.ts +8 -2
- package/tests/account-manager.test.ts +123 -50
- package/tests/app-passwords.test.ts +5 -5
- package/tests/get-service-auth.test.ts +81 -0
- package/tests/oauth.test.ts +5 -5
- package/tests/proxied/proxy-header.test.ts +1 -0
- package/tests/proxied/proxy-oauth-aud.test.ts +175 -0
- 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 {
|
|
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
|
-
|
|
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 {
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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 {
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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:
|
|
49
|
+
did: auth.credentials.did,
|
|
45
50
|
},
|
|
46
51
|
})
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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 {
|
|
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 =
|
|
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
|
|
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 =
|
|
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
|
package/src/config/config.ts
CHANGED
|
@@ -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 {
|
|
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:
|
|
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,
|
package/src/mailer/index.ts
CHANGED
|
@@ -1,22 +1,38 @@
|
|
|
1
1
|
import { SendMailOptions, Transporter } from 'nodemailer'
|
|
2
2
|
import { htmlToText } from 'nodemailer-html-to-text'
|
|
3
|
-
import {
|
|
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
|
|
21
|
+
private readonly email: EmailConfig | null,
|
|
22
|
+
branding: BrandingConfig,
|
|
13
23
|
) {
|
|
14
24
|
transporter.use('compile', htmlToText())
|
|
15
|
-
}
|
|
16
25
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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:
|
|
94
|
+
config: this.config,
|
|
79
95
|
} as any)
|
|
80
96
|
const res = await this.transporter.sendMail({
|
|
81
97
|
...mailOpts,
|
|
82
|
-
from: mailOpts.from ?? this.
|
|
98
|
+
from: mailOpts.from ?? this.email?.fromAddress,
|
|
83
99
|
html,
|
|
84
100
|
})
|
|
85
|
-
if (!this.
|
|
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),
|