From 38f3baf94d08b0e3ec40e6bacc4e330459e2a4d3 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 19 Sep 2026 22:06:16 -0700 Subject: users: reserve service names on registration and rename A username is also a lightning address, so a name that reads as the service collects payments meant for it. "mint" was registered days after the ecash redesign freed it and received payments addressed to mint@coinos.io; the reserved list held only "ecash", and was duplicated in two places. One shared list now, checked on both paths, covering the service-sounding names an account should never be able to take. Co-Authored-By: Claude Opus 5 (1M context) --- lib/register.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/register.ts') diff --git a/lib/register.ts b/lib/register.ts index e140947b..a9e9d7f7 100644 --- a/lib/register.ts +++ b/lib/register.ts @@ -4,6 +4,7 @@ import { db, s } from "$lib/db"; import { l, warn } from "$lib/logging"; import { fail } from "$lib/utils"; import { assertNameFree } from "$lib/names"; +import { isReserved } from "$lib/reserved"; import { bytesToHex, randomBytes } from "@noble/hashes/utils"; import { got } from "got"; import { getPublicKey, nip19 } from "nostr-tools"; @@ -16,12 +17,11 @@ export default async (user, ip) => { let { password, pubkey, username } = user; l("registering", username); - const reserved = ["ecash"]; if (!username) fail("Username required"); username = username.toLowerCase().replace(/\s/g, ""); if (!valid.test(username)) fail("Usernames can only have letters and numbers"); - if (reserved.includes(username)) fail("Invalid username"); + if (isReserved(username)) fail("Invalid username"); if (username.includes("undefined")) fail("Invalid username"); const id = v4(); -- cgit v1.2.3