work-in-progress atproto PDS
typescript atproto pds atcute

refactor: ensure consistent plc rotation key during dev

mary.my.id a3423f79 bc1b9743

verified
Changed files
+9 -1
packages
danaus
src
bin
test
+4
packages/danaus/src/bin/pds.ts
··· 6 6 import type { ProxyTargetConfig } from '#app/config.ts'; 7 7 import { TestPds } from '#app/test/test-pds.ts'; 8 8 9 + // stable rotation key for dev environment (persisted DIDs expect this key) 10 + const DEV_PLC_ROTATION_KEY = '3f916c70dc69e4c5e83877f013325b11ecac31742e6a42f5c4fb240d0703d9d5'; 11 + 9 12 const DATA_DIR = path.resolve('data/pds'); 10 13 const PLC_URL = process.env.PLC_URL ?? 'http://localhost:2582'; 11 14 ··· 34 37 plcUrl: PLC_URL, 35 38 port: PDS_PORT, 36 39 dataDirectory: DATA_DIR, 40 + plcRotationKey: DEV_PLC_ROTATION_KEY, 37 41 proxy: { 38 42 targets: targets, 39 43 },
+5 -1
packages/danaus/src/test/test-pds.ts
··· 24 24 port?: number; 25 25 /** persistent data directory; uses temp directory if not provided */ 26 26 dataDirectory?: string; 27 + /** hex-encoded secp256k1 private key for PLC rotation */ 28 + plcRotationKey?: string; 27 29 } 28 30 29 31 /** ··· 59 61 await fs.mkdir(blobDir, { recursive: true }); 60 62 await fs.mkdir(blobTempDir, { recursive: true }); 61 63 62 - const plcRotationKey = await Secp256k1PrivateKeyExportable.createKeypair(); 64 + const plcRotationKey = cfg.plcRotationKey 65 + ? await Secp256k1PrivateKeyExportable.importRaw(Buffer.from(cfg.plcRotationKey, 'hex')) 66 + : await Secp256k1PrivateKeyExportable.createKeypair(); 63 67 64 68 const service: ServiceConfig = { 65 69 version: 'test',