aboutsummaryrefslogtreecommitdiffstats
path: root/lib/changeid.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-11-02 13:19:16 -0700
committerAdam Soltys <[email protected]>2026-11-02 13:19:16 -0700
commit10218ae86b464b8e3d29c27513eb5cc0554d044b (patch)
tree4b7525c2d716c68a1ccbe6540e7f60c211fd2dc5 /lib/changeid.ts
parente3ab990961397ba821faaf3cee7d872175f77ffa (diff)
downloadcoinos-server-10218ae86b464b8e3d29c27513eb5cc0554d044b.tar.gz
coinos-server-10218ae86b464b8e3d29c27513eb5cc0554d044b.zip
users: ignore pubkey on signup, revoke a rekeyed account's nostr key
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01VMan6VN9xvnX1cgvV6hrUV
Diffstat (limited to 'lib/changeid.ts')
-rw-r--r--lib/changeid.ts11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/changeid.ts b/lib/changeid.ts
index d4eca441..3c1f573d 100644
--- a/lib/changeid.ts
+++ b/lib/changeid.ts
@@ -16,9 +16,16 @@ export default async function changeid(un: string) {
user.id = nid;
user.password = "reset";
+ // A rekey assumes the account's credentials are compromised, nostr key
+ // included. Drop the pubkey's login mapping rather than pointing it at the
+ // new id, and revoke the key so nostr login can't register a fresh account
+ // with it either. user.pubkey stays on the record so an admin can re-link.
if (user.pubkey) {
- await s(user.pubkey, nid);
- await sa(user.pubkey, nid);
+ for (const k of [`user:${user.pubkey}`, user.pubkey]) {
+ await db.del(k);
+ await arc.del(k);
+ }
+ await db.sAdd("revoked:pubkeys", user.pubkey);
}
await s(`user:${un}`, nid);
await sa(`user:${un}`, nid);