nim-libp2p/tests/pubsub/testmessage.nim
Jacek Sieka aa6756dfe0
allow message id provider to be specified (#243)
* don't send public key in message when not signing (information leak)
* don't run rebalance if there are peers in gossip (see #242)
* don't crash randomly on bad peer id from remote
2020-06-28 09:56:38 -06:00

15 lines
385 B
Nim

import unittest
import ../../libp2p/[peer, peerinfo,
crypto/crypto,
protocols/pubsub/rpc/message,
protocols/pubsub/rpc/messages]
suite "Message":
test "signature":
let
peer = PeerInfo.init(PrivateKey.random(ECDSA).get())
msg = Message.init(peer, @[], "topic", sign = true)
check verify(msg, peer)