From e35f684f5673086cefc78b80c9e0d35befe49007 Mon Sep 17 00:00:00 2001 From: dholms Date: Mon, 20 Nov 2023 16:03:13 -0600 Subject: [PATCH] allow did:web transter --- .../pds/src/migrate-script/migrate-all.ts | 53 ++++++++++--------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/packages/pds/src/migrate-script/migrate-all.ts b/packages/pds/src/migrate-script/migrate-all.ts index 890a56d63ed..e14b173a85e 100644 --- a/packages/pds/src/migrate-script/migrate-all.ts +++ b/packages/pds/src/migrate-script/migrate-all.ts @@ -266,31 +266,36 @@ const lockAndTransfer = async ( status.importedRev ?? undefined, ) - const lastOp = await ctx.plcClient.getLastOp(status.did) - if (!lastOp || lastOp.type === 'plc_tombstone') { - throw new Error('could not find last plc op') - } - const plcOp = await plcLib.createUpdateOp( - lastOp, - ctx.plcRotationKey, - (normalized) => { - if (!status.signingKey) { - throw new Error('no reserved signing key') - } - return { - ...normalized, - verificationMethods: { - atproto: status.signingKey, - }, - services: { - atproto_pds: { - type: 'AtprotoPersonalDataServer', - endpoint: pds.url, + let plcOp + if (status.did.startsWith('did:web')) { + plcOp = {} + } else { + const lastOp = await ctx.plcClient.getLastOp(status.did) + if (!lastOp || lastOp.type === 'plc_tombstone') { + throw new Error('could not find last plc op') + } + plcOp = await plcLib.createUpdateOp( + lastOp, + ctx.plcRotationKey, + (normalized) => { + if (!status.signingKey) { + throw new Error('no reserved signing key') + } + return { + ...normalized, + verificationMethods: { + atproto: status.signingKey, }, - }, - } - }, - ) + services: { + atproto_pds: { + type: 'AtprotoPersonalDataServer', + endpoint: pds.url, + }, + }, + } + }, + ) + } assert(!txFinished) const accountRes = await getUserAccount(ctx, status.did) await httpClient.post(