2020-12-21 11:45:07 +00:00
|
|
|
{.used.}
|
|
|
|
|
2021-06-09 14:59:52 +00:00
|
|
|
import options, bearssl
|
2020-12-21 11:45:07 +00:00
|
|
|
import chronos
|
|
|
|
import ../libp2p/crypto/crypto,
|
|
|
|
../libp2p/peerinfo,
|
|
|
|
../libp2p/peerid
|
|
|
|
|
|
|
|
import ./helpers
|
|
|
|
|
|
|
|
suite "PeerInfo":
|
|
|
|
test "Should init with private key":
|
|
|
|
let seckey = PrivateKey.random(ECDSA, rng[]).get()
|
2021-11-04 15:08:02 +00:00
|
|
|
var peerInfo = PeerInfo.new(seckey)
|
2022-01-14 09:51:22 +00:00
|
|
|
var peerId = PeerId.init(seckey).get()
|
2020-12-21 11:45:07 +00:00
|
|
|
|
|
|
|
check peerId == peerInfo.peerId
|
2021-10-06 13:10:43 +00:00
|
|
|
check seckey.getPublicKey().get() == peerInfo.publicKey
|