• Welcome to forex.pm forex forum binary options trade. Please login or sign up.
 

How to verify a lnurl-auth callback with python

Started by Bitcoin, Apr 20, 2022, 08:42 pm

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bitcoin

How to verify a lnurl-auth callback with python

I want to create a Python implementation of an lnurl-auth server.


I started a quick HTTP server to be the callback url, and captured the signed callback sent by BLW on Android.


?tag=login
&k1=7c27131e7fb37df50d12b0cb56ac1b76f817a5ba535b15afe43390a1f6b55d4d
&sig=30450221008172a00276a4724909b37051e98b36ba4f465aac82dd4d9609f91a3cd3be1a32022075bffd8d7697d140055b27e67d31a606435fdf5073c9c96d46a02cae06a5abc4&key=030f12794ae14407b8e1bfa1cbc297bb68ce6b24455ceab52c02da7a92782b6b14

Here is some python that attempts to verify that signature.


import secp256k1

k1 = bytes.fromhex("7c27131e7fb37df50d12b0cb56ac1b76f817a5ba535b15afe43390a1f6b55d4d")
key = bytes.fromhex('030f12794ae14407b8e1bfa1cbc297bb68ce6b24455ceab52c02da7a92782b6b14')
sig = bytes.fromhex('30450221008172a00276a4724909b37051e98b36ba4f465aac82dd4d9609f91a3cd3be1a32022075bffd8d7697d140055b27e67d31a606435fdf5073c9c96d46a02cae06a5abc4')


pubkey = secp256k1.PublicKey(key, raw=True)
sig = pubkey.ecdsa_deserialize(sig)
print(pubkey.ecdsa_verify(k1, sig))

Output: False


I don't know enough to tell what I'm doing wrong. It seems like this should be fairly standard use of the secp256k1 library.


Source: How to verify a lnurl-auth callback with python