Redirect lightning payments from your email address + ".ln2.email" to your current lightning wallet.
- Sign up to an email service like Amazon SES. This will be your
SMTP_SERVER
. - Generate a random secret here. This will be your
NEXTAUTH_SECRET
. - Configure your MongoDB URI in
MONGODB_URI
. - Configure
PROJECT_ID_VERCEL
andAUTH_BEARER_TOKEN
to automatically add users' email-addresses' domains as subdomains, using Vercel domains api.
https://vercel.com/integrations/mongodbatlas
When a lightning wallet wants to pay to a lightning address like "[email protected]", it sends an HTTP request to https://somedomain.com/.well-known/lnurlp/someuser, to get technical details for how to proceed with the payment.
When a user signs in with email like "[email protected]", and configures his lightning address "[email protected]", he gets a new lightning address "[email protected]" that redirects the HTTP requests: any HTTP request to https://mailserver.com.ln2.email/.well-known/lnurlp/johndoe responds with a 307 Redirect to https://somedomain.com/.well-known/lnurlp/someuser, and the payment continues from there.
This way ln2.email never holds users' funds at any point.
Most lightning wallets do support paying to onion lightning addresses (that look like "[email protected]"), which are common in personal nodes whose owner don't want to buy a domain.
Unfortunately, when our server replies with a 307 Redirect to an onion address, most wallets simply break. We have decided to block this capability until most wallets will support the redirection.