-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a function for overriding the receiver domain in the lnurlp.
This is useful for cases where the receiver domain is not the same as the incoming request Host, for example when the request is being proxied to another internal service.
- Loading branch information
Showing
2 changed files
with
27 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,6 +117,20 @@ func TestSignAndVerifyLnurlpRequest(t *testing.T) { | |
require.NoError(t, err) | ||
} | ||
|
||
func TestSignAndVerifyLnurlpRequestReplacingDomain(t *testing.T) { | ||
privateKey, err := secp256k1.GeneratePrivateKey() | ||
require.NoError(t, err) | ||
queryUrl, err := uma.GetSignedLnurlpRequestUrl(privateKey.Serialize(), "[email protected]", "vasp1.com", true, nil) | ||
require.NoError(t, err) | ||
queryUrl.Host = "vasp2.com" | ||
query, err := uma.ParseLnurlpRequestWithReceiverDomain(*queryUrl, "vasp3.com") | ||
require.NoError(t, err) | ||
require.Equal(t, *query.UmaVersion, uma.UmaProtocolVersion) | ||
require.Equal(t, query.ReceiverAddress, "[email protected]") | ||
err = uma.VerifyUmaLnurlpQuerySignature(*query.AsUmaRequest(), getPubKeyResponse(privateKey), getNonceCache()) | ||
require.NoError(t, err) | ||
} | ||
|
||
func TestParseLnurlpRequestUnsupportedVersion(t *testing.T) { | ||
privateKey, err := secp256k1.GeneratePrivateKey() | ||
require.NoError(t, err) | ||
|
This file contains 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