From 93a890cc1d7baf7aa6565a84c45c5c5ed8a4eb62 Mon Sep 17 00:00:00 2001 From: Chad Miller Date: Mon, 5 Jan 2026 08:29:26 -0800 Subject: [PATCH] feat: add handle storage to identity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- src/pds.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/pds.js b/src/pds.js index 53a1d42..4ff8fd7 100644 --- a/src/pds.js +++ b/src/pds.js @@ -483,9 +483,12 @@ export class PersonalDataServer { `) } - async initIdentity(did, privateKeyHex) { + async initIdentity(did, privateKeyHex, handle = null) { await this.state.storage.put('did', did) await this.state.storage.put('privateKey', privateKeyHex) + if (handle) { + await this.state.storage.put('handle', handle) + } } async getDid() { @@ -495,6 +498,10 @@ export class PersonalDataServer { return this._did } + async getHandle() { + return this.state.storage.get('handle') + } + async getSigningKey() { const hex = await this.state.storage.get('privateKey') if (!hex) return null @@ -638,8 +645,8 @@ export class PersonalDataServer { if (!body.did || !body.privateKey) { return Response.json({ error: 'missing did or privateKey' }, { status: 400 }) } - await this.initIdentity(body.did, body.privateKey) - return Response.json({ ok: true, did: body.did }) + await this.initIdentity(body.did, body.privateKey, body.handle || null) + return Response.json({ ok: true, did: body.did, handle: body.handle || null }) } if (url.pathname === '/status') { const did = await this.getDid() -- 2.51.2