mirror of
https://github.com/vacp2p/nim-libp2p.git
synced 2025-01-11 01:06:23 +00:00
846baf3853
* raise -> raise exc * replace stdlib random with bearssl * object init -> new * Remove deprecated procs * getMandatoryField
19 lines
443 B
Nim
19 lines
443 B
Nim
{.used.}
|
|
|
|
import options, bearssl
|
|
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()
|
|
var peerInfo = PeerInfo.new(seckey)
|
|
var peerId = PeerID.init(seckey).get()
|
|
|
|
check peerId == peerInfo.peerId
|
|
check seckey.getPublicKey().get() == peerInfo.publicKey
|