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":
|
2020-07-15 03:51:33 +00:00
|
|
|
var seqno = 11'u64
|
2020-06-28 15:56:38 +00:00
|
|
|
let
|
2020-07-07 11:14:11 +00:00
|
|
|
peer = PeerInfo.init(PrivateKey.random(ECDSA, rng[]).get())
|
2020-07-15 03:51:33 +00:00
|
|
|
msg = Message.init(peer, @[], "topic", seqno, sign = true)
|
2020-05-27 18:33:49 +00:00
|
|
|
|
2020-06-28 15:56:38 +00:00
|
|
|
check verify(msg, peer)
|