username@npubx.cash or username@sovran.money that are permanently linked to their Nostr pubkey.
Available Domains
Sovran supports two Lightning address domains:Username Requirements
- Minimum length: 3 characters
- Allowed characters: Lowercase letters (
a-z), numbers (0-9), underscores (_) - No spaces or special characters
- Case-insensitive: All usernames stored as lowercase
Claim Username Screen
The main UI is inapp/claimUsername.tsx:
Screen Components
Username Input
Domain Selector
Availability Checking
Username availability is checked in real-time across all domains:Debounced Checking
NIP-98 HTTP Authentication
Claiming a username requires proving ownership of your Nostr pubkey using NIP-98:Example NIP-98 Event
- ✅ You control the private key for the pubkey
- ✅ The request was made recently (via
created_at) - ✅ The request is for a specific URL and method
Claiming Process
When the user clicks “Continue”:Local Server Flow
- Generate NIP-98 auth: Sign an event proving pubkey ownership
- Open local URL: Pass auth to Sovran’s local server at
localhost:8080 - Server forwards: Local server proxies the request to npub.cash API
- Username claimed: npub.cash links username to pubkey
The local server pattern allows the mobile app to make authenticated API calls without exposing the private key to third parties.
Preview Section
Once a username is available, show a preview:Integration with npub.cash
API Endpoint
Verification
npub.cash verifies the NIP-98 auth event:- Extract event: Decode base64, parse JSON
- Verify signature: Check event signature matches pubkey
- Check URL: Ensure
utag matches request URL - Check method: Ensure
methodtag matches request method - Check timestamp: Reject old events (> 60 seconds)
Lightning Address Resolution
Once claimed, the Lightning address resolves via LNURL-pay:The
nostrPubkey field links the Lightning address back to the user’s Nostr identity.Profile Integration
Claimed Lightning addresses appear in user profiles:- Display the address in their profile
- Receive payments via Lightning
- Share the address as a QR code
Best Practices
Validate username before submission
Validate username before submission
Check availability on all domains
Check availability on all domains
Handle NIP-98 auth errors
Handle NIP-98 auth errors
Verify timestamp freshness
Verify timestamp freshness
Security Considerations
NIP-98 Auth Security
- Short-lived events: Events expire after 60 seconds
- URL binding: Auth is only valid for specific URL
- Method binding: Auth is only valid for specific HTTP method
- Signature verification: Proves pubkey ownership
Private Key Protection
- Never send privateKey over network: Only send signed events
- Use local server: Proxy requests through localhost:8080
- Validate before signing: Check URL and method before signing
Username Squatting Prevention
npub.cash may implement:- Reputation requirements: Require minimum follower count or reputation score
- Payment requirements: Charge a small fee to claim premium usernames
- Time delays: Prevent rapid claiming/releasing
Guidelines Display
When no username is entered, show guidelines:Related Documentation
Identity & Keys
NIP-06 key derivation for NIP-98 signing
User Profiles
Display claimed Lightning addresses in profiles
Lightning Payments
Send/receive payments to Lightning addresses
NIP-98 Spec
Official NIP-98 specification