1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-12-16 06:30:09 +08:00

fix: remove some deprecated calls

This commit is contained in:
Steven Allen
2021-07-22 15:36:32 -07:00
parent 6e610066f6
commit 2138798ea5
3 changed files with 7 additions and 8 deletions

View File

@@ -29,8 +29,7 @@ func KeyEncoderFromString(formatLabel string) (KeyEncoder, error) {
func (enc KeyEncoder) FormatID(id peer.ID) string {
if enc.baseEnc == nil {
//nolint deprecated
return peer.IDB58Encode(id)
return peer.Encode(id)
}
if s, err := peer.ToCid(id).StringOfBase(enc.baseEnc.Encoding()); err != nil {
panic(err)

View File

@@ -22,7 +22,7 @@ import (
"github.com/ipfs/go-ipfs-config"
coreiface "github.com/ipfs/interface-go-ipfs-core"
"github.com/ipfs/interface-go-ipfs-core/tests"
ci "github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/crypto"
peer "github.com/libp2p/go-libp2p-core/peer"
"github.com/libp2p/go-libp2p/p2p/net/mock"
)
@@ -40,7 +40,7 @@ func (NodeProvider) MakeAPISwarm(ctx context.Context, fullIdentity bool, n int)
for i := 0; i < n; i++ {
var ident config.Identity
if fullIdentity {
sk, pk, err := ci.GenerateKeyPair(ci.RSA, 2048)
sk, pk, err := crypto.GenerateKeyPair(crypto.RSA, 2048)
if err != nil {
return nil, err
}
@@ -50,7 +50,7 @@ func (NodeProvider) MakeAPISwarm(ctx context.Context, fullIdentity bool, n int)
return nil, err
}
kbytes, err := sk.Bytes()
kbytes, err := crypto.MarshalPrivateKey(sk)
if err != nil {
return nil, err
}

View File

@@ -15,7 +15,7 @@ import (
ds "github.com/ipfs/go-datastore"
dsync "github.com/ipfs/go-datastore/sync"
cfg "github.com/ipfs/go-ipfs-config"
ci "github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/crypto"
peer "github.com/libp2p/go-libp2p-core/peer"
)
@@ -124,7 +124,7 @@ func (cfg *BuildCfg) options(ctx context.Context) (fx.Option, *cfg.Config) {
func defaultRepo(dstore repo.Datastore) (repo.Repo, error) {
c := cfg.Config{}
priv, pub, err := ci.GenerateKeyPairWithReader(ci.RSA, 2048, rand.Reader)
priv, pub, err := crypto.GenerateKeyPairWithReader(crypto.RSA, 2048, rand.Reader)
if err != nil {
return nil, err
}
@@ -134,7 +134,7 @@ func defaultRepo(dstore repo.Datastore) (repo.Repo, error) {
return nil, err
}
privkeyb, err := priv.Bytes()
privkeyb, err := crypto.MarshalPrivateKey(priv)
if err != nil {
return nil, err
}