Skip to content

Commit

Permalink
Forward deactivation for PDSs running behind an entryway (bluesky-soc…
Browse files Browse the repository at this point in the history
…ial#2550)

* Forward deactivation to entryway

* comments
  • Loading branch information
dholms authored Jun 4, 2024
1 parent d8e2fef commit 5007d74
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
12 changes: 11 additions & 1 deletion packages/pds/src/api/com/atproto/server/activateAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,21 @@ import { INVALID_HANDLE } from '@atproto/syntax'
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'
import { assertValidDidDocumentForService } from './util'
import { authPassthru } from '../../../proxy'

export default function (server: Server, ctx: AppContext) {
server.com.atproto.server.activateAccount({
auth: ctx.authVerifier.accessFull(),
handler: async ({ auth }) => {
handler: async ({ auth, req }) => {
// in the case of entryway, the full flow is activateAccount (PDS) -> activateAccount (Entryway) -> updateSubjectStatus(PDS)
if (ctx.entrywayAgent) {
await ctx.entrywayAgent.com.atproto.server.activateAccount(
undefined,
authPassthru(req, true),
)
return
}

const requester = auth.credentials.did

await assertValidDidDocumentForService(ctx, requester)
Expand Down
12 changes: 11 additions & 1 deletion packages/pds/src/api/com/atproto/server/deactivateAccount.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
import { Server } from '../../../../lexicon'
import AppContext from '../../../../context'
import { authPassthru } from '../../../proxy'

export default function (server: Server, ctx: AppContext) {
server.com.atproto.server.deactivateAccount({
auth: ctx.authVerifier.accessFull(),
handler: async ({ auth, input }) => {
handler: async ({ auth, input, req }) => {
// in the case of entryway, the full flow is deactivateAccount (PDS) -> deactivateAccount (Entryway) -> updateSubjectStatus(PDS)
if (ctx.entrywayAgent) {
await ctx.entrywayAgent.com.atproto.server.deactivateAccount(
input.body,
authPassthru(req, true),
)
return
}

const requester = auth.credentials.did
await ctx.accountManager.deactivateAccount(
requester,
Expand Down

0 comments on commit 5007d74

Please sign in to comment.