Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use ed25519 instead of ecdsa keys #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions cmd/test-client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"context"
"crypto/rand"
"flag"
"fmt"
"log"
Expand All @@ -15,6 +16,7 @@ import (

manet "github.com/multiformats/go-multiaddr/net"

"github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p-core/protocol"
Expand Down Expand Up @@ -96,7 +98,13 @@ func main() {
}
}

privKey, _, err := crypto.GenerateEd25519Key(rand.Reader)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this the default now? libp2p/go-libp2p#1576

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wasn’t when I was using it. I didn’t look into it though

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah this is using v0.21 and that change is in v0.22

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved: #4.

if err != nil {
log.Fatal(err)
}

host, err := libp2p.New(
libp2p.Identity(privKey),
libp2p.NoListenAddrs,
libp2p.Transport(tcp.NewTCPTransport),
libp2p.Transport(quic.NewTransport),
Expand Down
2 changes: 1 addition & 1 deletion cmd/test-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func main() {
port := flag.Int("port", 4001, "server listen port (raw TCP prot will be +1)")
flag.Parse()

privKey, _, err := crypto.GenerateECDSAKeyPair(bytes.NewReader(bytes.Repeat([]byte{1}, 100)))
privKey, _, err := crypto.GenerateEd25519Key(bytes.NewReader(bytes.Repeat([]byte{1}, 100)))
if err != nil {
log.Fatal(err)
}
Expand Down