2020-05-27 18:33:49 +00:00
|
|
|
import unittest
|
2020-06-28 15:56:38 +00:00
|
|
|
|
2020-07-07 11:14:11 +00:00
|
|
|
{.used.}
|
|
|
|
|
2020-07-01 06:25:09 +00:00
|
|
|
import ../../libp2p/[peerid, peerinfo,
|
2020-05-27 18:33:49 +00:00
|
|
|
crypto/crypto,
|
|
|
|
protocols/pubsub/rpc/message,
|
|
|
|
protocols/pubsub/rpc/messages]
|
|
|
|
|
2020-07-07 11:14:11 +00:00
|
|
|
let rng = newRng()
|
|
|
|
|
2020-05-27 18:33:49 +00:00
|
|
|
suite "Message":
|
2020-06-28 15:56:38 +00:00
|
|
|
test "signature":
|
|
|
|
let
|
2020-07-07 11:14:11 +00:00
|
|
|
peer = PeerInfo.init(PrivateKey.random(ECDSA, rng[]).get())
|
2020-06-28 15:56:38 +00:00
|
|
|
msg = Message.init(peer, @[], "topic", sign = true)
|
2020-05-27 18:33:49 +00:00
|
|
|
|
2020-06-28 15:56:38 +00:00
|
|
|
check verify(msg, peer)
|