Support multiple usernames (aliases) per address - #630
Merged
Abdulazeem-code merged 2 commits intoAug 29, 2026
Conversation
A Stellar address may now hold up to 5 federation usernames, e.g. payments*domain and support*domain for one business account. The first username registered for an address is its primary; reverse (type=id) federation lookups and /lookup?address= resolve to the primary. - schema: drop the unique constraint on User.address, add is_primary, add a plain index on address, plus a migration that marks existing rows primary - register (/register and /api/v1/register): allow another username for a known address while it is under the cap, assign is_primary to the first, respond 409 once the address already has 5 - federation type=id and /lookup?address=: order results primary-first
|
@Tijesunimi004 is attempting to deploy a commit to the Abdulazeem's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@Tijesunimi004 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
A Stellar address can now hold up to 5 federation usernames (aliases), so a business can run department-specific federation addresses (
payments*domain,support*domain) against a single account. Closes #613.Data model
prisma/schema.prisma:User.addressis no longer@unique. NewisPrimary Boolean @default(false)column and a plain@@index([address])for the reverse lookups that used to rely on the unique index.prisma/migrations/20260829120000_add_username_aliases/: dropsusername_registry_address_key, addsis_primary, creates the address index, and marks every existing (non-deleted) rowis_primary = trueso current single registrations become their address's primary.Registration (
POST /registerandPOST /api/v1/register)is_primary: truein the response)409 CONFLICT, "This address already has the maximum of 5 federation usernames."Lookups
GET /federation?type=idandGET /lookup?address=order results primary-first (isPrimary desc, createdAt asc), so a reverse lookup resolves to the primary username. The tiebreak keeps the result stable for legacy rows and if a primary is later soft-deleted.Tests
tests/username-aliases.test.js(new): slot assignment, the 5-username cap, the address-scoped count, and primary-firsttype=idresolution.register-endpoint,register-multisigner,sql-injection,tests/register, andserver.testwhere they asserted the old "address already registered" 409 or mocked onlyfindFirstfor the pre-registration check.Notes
SERIALIZABLEwould tighten it if needed.