Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
31a62aff
Commit
31a62aff
authored
Dec 17, 2014
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testutil: gen peers with keys
parent
6884c9dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
util/testutil/gen.go
util/testutil/gen.go
+10
-0
No files found.
util/testutil/gen.go
View file @
31a62aff
...
...
@@ -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
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment