author: akumaigorodski author: fiatjaf author: hampus_s discussion: https://t.me/lnurl/5155
Seed generation method for the auth protocol
This is based on thesignmessage API provided by some Lightning node implementations. It signs an HMAC of a message in a standard way using ECDSA with deterministic nonces, so it’s always the same signature given the same key and message.
Here we define a canonical phrase to be signed, and from that we will derive the LNURL-auth seed.
linkingKey derivation for wallets which don’t have an access to master privKey:
In this case neither hashingKey nor domain-specific linkingKeys can be derived by the path. To overcome this limitation a different scheme is used for this class of wallets:
- The following canonical phrase is defined:
DO NOT EVER SIGN THIS TEXT WITH YOUR PRIVATE KEYS! IT IS ONLY USED FOR DERIVATION OF LNURL-AUTH HASHING-KEY, DISCLOSING ITS SIGNATURE WILL COMPROMISE YOUR LNURL-AUTH IDENTITY AND MAY LEAD TO LOSS OF FUNDS!. LN WALLETobtains anRFC6979deterministic signature ofsha256(utf8ToBytes(canonical phrase))usingsecp256k1with node private key.LN WALLETdefineshashingKeyasPrivateKey(sha256(obtained signature)).SERVICEdomain name is extracted from authLNURLand then service-specificlinkingPrivKeyis defined asPrivateKey(hmacSha256(hashingKey, service domain name)).
LN WALLET must make sure it is not possible to accidentally or automatically sign and hand out a signature of canonical phrase.