Allow dot in usernames per NIP-05 local-part spec
Extend usernameRE to [a-z0-9_.-], preserve dots in SanitizeForUsername, and add tests for validation, sanitization, and nip05 sync precedence. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -10,9 +10,12 @@ func TestValidateUsername(t *testing.T) {
|
||||
{"alice", true},
|
||||
{"al-ice_42", true},
|
||||
{"a", true},
|
||||
{"alice.bob", true},
|
||||
{"alice.smith.42", true},
|
||||
{"", false},
|
||||
{"-alice", false},
|
||||
{"_alice", false},
|
||||
{".alice", false},
|
||||
{"thisusernameiswaytoolongtobevalid12345", false},
|
||||
{"admin", false},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user