@cryptotaxi247 / kubo / commits / 2138798ea

fix: remove some deprecated calls

Steven Allen committed Jul 22, 2021 at 15:36 UTC 2138798ea54aaa1f8c74e43068edd55cd961dcd9
3 files changed +7 -8
core/commands/keyencode/keyencode.go
+1 -2
@@ -29,8 +29,7 @@ func KeyEncoderFromString(formatLabel string) (KeyEncoder, error) {
29
30 func (enc KeyEncoder) FormatID(id peer.ID) string {
31 if enc.baseEnc == nil {
32 - //nolint deprecated
33 - return peer.IDB58Encode(id)
32 + return peer.Encode(id)
33 }
34 if s, err := peer.ToCid(id).StringOfBase(enc.baseEnc.Encoding()); err != nil {
35 panic(err)
core/coreapi/test/api_test.go
+3 -3
@@ -22,7 +22,7 @@ import (
22 "github.com/ipfs/go-ipfs-config"
23 coreiface "github.com/ipfs/interface-go-ipfs-core"
24 "github.com/ipfs/interface-go-ipfs-core/tests"
25 - ci "github.com/libp2p/go-libp2p-core/crypto"
25 + "github.com/libp2p/go-libp2p-core/crypto"
26 peer "github.com/libp2p/go-libp2p-core/peer"
27 "github.com/libp2p/go-libp2p/p2p/net/mock"
28 )
@@ -40,7 +40,7 @@ func (NodeProvider) MakeAPISwarm(ctx context.Context, fullIdentity bool, n int)
40 for i := 0; i < n; i++ {
41 var ident config.Identity
42 if fullIdentity {
43 - sk, pk, err := ci.GenerateKeyPair(ci.RSA, 2048)
43 + sk, pk, err := crypto.GenerateKeyPair(crypto.RSA, 2048)
44 if err != nil {
45 return nil, err
46 }
@@ -50,7 +50,7 @@ func (NodeProvider) MakeAPISwarm(ctx context.Context, fullIdentity bool, n int)
50 return nil, err
51 }
52
53 - kbytes, err := sk.Bytes()
53 + kbytes, err := crypto.MarshalPrivateKey(sk)
54 if err != nil {
55 return nil, err
56 }
core/node/builder.go
+3 -3
@@ -15,7 +15,7 @@ import (
15 ds "github.com/ipfs/go-datastore"
16 dsync "github.com/ipfs/go-datastore/sync"
17 cfg "github.com/ipfs/go-ipfs-config"
18 - ci "github.com/libp2p/go-libp2p-core/crypto"
18 + "github.com/libp2p/go-libp2p-core/crypto"
19 peer "github.com/libp2p/go-libp2p-core/peer"
20 )
21
@@ -124,7 +124,7 @@ func (cfg *BuildCfg) options(ctx context.Context) (fx.Option, *cfg.Config) {
124
125 func defaultRepo(dstore repo.Datastore) (repo.Repo, error) {
126 c := cfg.Config{}
127 - priv, pub, err := ci.GenerateKeyPairWithReader(ci.RSA, 2048, rand.Reader)
127 + priv, pub, err := crypto.GenerateKeyPairWithReader(crypto.RSA, 2048, rand.Reader)
128 if err != nil {
129 return nil, err
130 }
@@ -134,7 +134,7 @@ func defaultRepo(dstore repo.Datastore) (repo.Repo, error) {
134 return nil, err
135 }
136
137 - privkeyb, err := priv.Bytes()
137 + privkeyb, err := crypto.MarshalPrivateKey(priv)
138 if err != nil {
139 return nil, err
140 }