diff options
| author | Adam Soltys <[email protected]> | 2026-10-09 00:58:46 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-10-09 00:58:46 -0700 |
| commit | 843feca4dfdd42e15da56b57efb4a95d1bdf404a (patch) | |
| tree | 11b5c5833403289456513266b358d991c63457a2 /src/features | |
| parent | 2d13695021c80892af3604907a8501cc5d42e443 (diff) | |
| download | coinosv3-843feca4dfdd42e15da56b57efb4a95d1bdf404a.tar.gz coinosv3-843feca4dfdd42e15da56b57efb4a95d1bdf404a.zip | |
Change username: a name this wallet's key claimed before a login identity was attached no longer reads as taken — the identity-signed claim is refused, so retry signed by the wallet key that owns the record
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/features')
| -rw-r--r-- | src/features/names.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/features/names.js b/src/features/names.js index 43d4895..ea94d2a 100644 --- a/src/features/names.js +++ b/src/features/names.js @@ -146,6 +146,17 @@ export function namesFeature(ctx) { const domain = DOMAIN(); try { return await claim(name, opts); } catch (err) { + // Signed by the login identity, a name this WALLET's key claimed + // earlier (before the identity was attached) reads as someone else's — + // the record names the wallet key as owner and no manager. The wallet + // key may always update its own record, so retry with it. + if (opts.signer && err.message === 'name is taken') { + const mine = await fetch(`${REGISTRAR}/name/${encodeURIComponent(name)}?domain=${encodeURIComponent(domain)}`, + { signal: AbortSignal.timeout(8000), cache: 'no-store' }).then((r) => (r.ok ? r.json() : null)).catch(() => null); + const pk = wallet.nostrPubkey && wallet.nostrPubkey(); + if (pk && mine?.taken && (mine.pubkey === pk || mine.manager === pk)) + return claim(name, { ...opts, signer: undefined, manager: undefined }); + } if (domain === 'coinos.io' && ['name is taken', 'name is reserved'].includes(err.message)) { try { const r = await fetch(`${REGISTRAR}/name/${encodeURIComponent(name)}?domain=${encodeURIComponent(domain)}`, |
