Skip to content

Commit

Permalink
PDS: fix account deactivation when behind entryway by using entryway …
Browse files Browse the repository at this point in the history
…auth (#3173)

pds: fix account deactivation when behind entryway by using entryway auth
  • Loading branch information
devinivy authored Dec 11, 2024
1 parent 51b0c48 commit a940c3f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 21 deletions.
14 changes: 3 additions & 11 deletions packages/pds/src/api/com/atproto/server/activateAccount.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,21 @@
import assert from 'node:assert'

import { CidSet } from '@atproto/repo'
import { INVALID_HANDLE } from '@atproto/syntax'
import { InvalidRequestError } from '@atproto/xrpc-server'

import AppContext from '../../../../context'
import { Server } from '../../../../lexicon'
import { ids } from '../../../../lexicon/lexicons'
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 ({ req, auth }) => {
// in the case of entryway, the full flow is activateAccount (PDS) -> activateAccount (Entryway) -> updateSubjectStatus(PDS)
if (ctx.entrywayAgent) {
assert(ctx.cfg.entryway)

await ctx.entrywayAgent.com.atproto.server.activateAccount(
undefined,
await ctx.serviceAuthHeaders(
auth.credentials.did,
ctx.cfg.entryway.did,
ids.ComAtprotoServerActivateAccount,
),
authPassthru(req),
)
return
}
Expand Down
13 changes: 3 additions & 10 deletions packages/pds/src/api/com/atproto/server/deactivateAccount.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,16 @@
import assert from 'node:assert'

import AppContext from '../../../../context'
import { Server } from '../../../../lexicon'
import { ids } from '../../../../lexicon/lexicons'
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 ({ req, auth, input }) => {
// in the case of entryway, the full flow is deactivateAccount (PDS) -> deactivateAccount (Entryway) -> updateSubjectStatus(PDS)
if (ctx.entrywayAgent) {
assert(ctx.cfg.entryway)
await ctx.entrywayAgent.com.atproto.server.deactivateAccount(
input.body,
await ctx.serviceAuthHeaders(
auth.credentials.did,
ctx.cfg.entryway.did,
ids.ComAtprotoServerDeactivateAccount,
),
authPassthru(req),
)
return
}
Expand Down

0 comments on commit a940c3f

Please sign in to comment.