lightning community – The right way to confirm a lnurl-auth callback with python

0
43


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

I began a fast HTTP server to be the callback url, and captured the signed callback despatched by BLW on Android.

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

Right here is a few python that makes an attempt to confirm that signature.

import secp256k1

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


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

Output: False

I do not know sufficient to inform what I am doing fallacious. It looks like this ought to be pretty normal use of the secp256k1 library.



Supply hyperlink

Leave a reply