From 2d4ac7a81a0a2e65a510951921630ed27a58ed75 Mon Sep 17 00:00:00 2001 From: dholms Date: Tue, 12 Mar 2024 15:15:44 -0500 Subject: [PATCH] clean up plc op submission --- .../api/com/atproto/identity/submitPlcOperation.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/pds/src/api/com/atproto/identity/submitPlcOperation.ts b/packages/pds/src/api/com/atproto/identity/submitPlcOperation.ts index 66db47fe482..13ba7bc07da 100644 --- a/packages/pds/src/api/com/atproto/identity/submitPlcOperation.ts +++ b/packages/pds/src/api/com/atproto/identity/submitPlcOperation.ts @@ -3,6 +3,7 @@ import AppContext from '../../../../context' import * as plc from '@did-plc/lib' import { check } from '@atproto/common' import { InvalidRequestError } from '@atproto/xrpc-server' +import { httpLogger as log } from '../../../../logger' export default function (server: Server, ctx: AppContext) { server.com.atproto.identity.submitPlcOperation({ @@ -15,7 +16,9 @@ export default function (server: Server, ctx: AppContext) { throw new InvalidRequestError('Invalid operation') } - if (!op.rotationKeys.includes(ctx.plcRotationKey.did())) { + const rotationKey = + ctx.cfg.entryway?.plcRotationKey ?? ctx.plcRotationKey.did() + if (!op.rotationKeys.includes(rotationKey)) { throw new InvalidRequestError( "Rotation keys do not include server's rotation key", ) @@ -43,6 +46,15 @@ export default function (server: Server, ctx: AppContext) { } await ctx.plcClient.sendOperation(requester, op) + await ctx.sequencer.sequenceIdentityEvt(requester) + try { + await ctx.idResolver.did.resolve(requester, true) + } catch (err) { + log.error( + { err, did: requester }, + 'failed to refresh did after plc update', + ) + } }, }) }