Commit 31a62aff authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

testutil: gen peers with keys

parent 6884c9dd
......@@ -2,6 +2,7 @@ package testutil
import (
crand "crypto/rand"
ci "github.com/jbenet/go-ipfs/crypto"
peer "github.com/jbenet/go-ipfs/peer"
u "github.com/jbenet/go-ipfs/util"
)
......@@ -12,3 +13,12 @@ func RandPeer() peer.Peer {
mhid := u.Hash(id)
return NewPeerWithID(peer.ID(mhid))
}
func PeerWithNewKeys() (peer.Peer, error) {
sk, pk, err := ci.GenerateKeyPair(ci.RSA, 512)
if err != nil {
return nil, err
}
return NewPeerWithKeyPair(sk, pk)
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment