noise: Implement signature verification of chat messages

Since we don't pass the public key we just rely on the pubkey recovery and the
`checkmessage` interface to tell us whether it is a publicly known `node_id`
or not.
This commit is contained in:
Christian Decker
2020-01-19 15:14:09 +01:00
parent 3d3c7f75ba
commit 528aa8410b
4 changed files with 110 additions and 8 deletions

View File

@@ -1,6 +1,8 @@
from pyln.testing.fixtures import *
from pyln.testing.utils import wait_for
from pprint import pprint
import zbase32
plugin = os.path.join(os.path.dirname(__file__), 'noise.py')
@@ -20,6 +22,9 @@ def test_sendmsg_success(node_factory, executor):
# They should be the same :-)
assert(m1 == m2)
assert(m2['sender'] == l1.info['id'])
assert(m2['verified'] == True)
def test_sendmsg_retry(node_factory, executor):
opts = [{'plugin': plugin}, {}, {'fee-base': 10000}, {'plugin': plugin}]
@@ -52,3 +57,10 @@ def test_sendmsg_retry(node_factory, executor):
print(recv.result(10))
msg = l4.rpc.recvmsg(last_id=-1)
def test_zbase32():
zb32 = b'd75qtmgijm79rpooshmgzjwji9gj7dsdat8remuskyjp9oq1ugkaoj6orbxzhuo4njtyh96e3aq84p1tiuz77nchgxa1s4ka4carnbiy'
b = zbase32.decode(zb32)
enc = zbase32.encode(b)
assert(enc == zb32)