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