Skip to content

Commit b4c105b

Browse files
committed
fix: remove some deprecated calls
1 parent 461f691 commit b4c105b

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

core/commands/keyencode/keyencode.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ func KeyEncoderFromString(formatLabel string) (KeyEncoder, error) {
2929

3030
func (enc KeyEncoder) FormatID(id peer.ID) string {
3131
if enc.baseEnc == nil {
32-
//nolint deprecated
33-
return peer.IDB58Encode(id)
32+
return peer.Encode(id)
3433
}
3534
if s, err := peer.ToCid(id).StringOfBase(enc.baseEnc.Encoding()); err != nil {
3635
panic(err)

core/coreapi/test/api_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"github.com/ipfs/go-ipfs-config"
2323
coreiface "github.com/ipfs/interface-go-ipfs-core"
2424
"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"
2626
peer "github.com/libp2p/go-libp2p-core/peer"
2727
"github.com/libp2p/go-libp2p/p2p/net/mock"
2828
)
@@ -40,7 +40,7 @@ func (NodeProvider) MakeAPISwarm(ctx context.Context, fullIdentity bool, n int)
4040
for i := 0; i < n; i++ {
4141
var ident config.Identity
4242
if fullIdentity {
43-
sk, pk, err := ci.GenerateKeyPair(ci.RSA, 2048)
43+
sk, pk, err := crypto.GenerateKeyPair(crypto.RSA, 2048)
4444
if err != nil {
4545
return nil, err
4646
}
@@ -50,7 +50,7 @@ func (NodeProvider) MakeAPISwarm(ctx context.Context, fullIdentity bool, n int)
5050
return nil, err
5151
}
5252

53-
kbytes, err := sk.Bytes()
53+
kbytes, err := crypto.MarshalPrivateKey(sk)
5454
if err != nil {
5555
return nil, err
5656
}

core/corehttp/logs.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func LogOption() ServeOption {
5050
w.WriteHeader(200)
5151
wnf, errs := newWriteErrNotifier(w)
5252
lwriter.WriterGroup.AddWriter(wnf)
53-
log.Event(n.Context(), "log API client connected") //nolint deprecated
53+
log.Info("log API client connected")
5454
<-errs
5555
})
5656
return mux, nil

core/node/builder.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
ds "github.com/ipfs/go-datastore"
1616
dsync "github.com/ipfs/go-datastore/sync"
1717
cfg "github.com/ipfs/go-ipfs-config"
18-
ci "github.com/libp2p/go-libp2p-core/crypto"
18+
"github.com/libp2p/go-libp2p-core/crypto"
1919
peer "github.com/libp2p/go-libp2p-core/peer"
2020
)
2121

@@ -124,7 +124,7 @@ func (cfg *BuildCfg) options(ctx context.Context) (fx.Option, *cfg.Config) {
124124

125125
func defaultRepo(dstore repo.Datastore) (repo.Repo, error) {
126126
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)
128128
if err != nil {
129129
return nil, err
130130
}
@@ -134,7 +134,7 @@ func defaultRepo(dstore repo.Datastore) (repo.Repo, error) {
134134
return nil, err
135135
}
136136

137-
privkeyb, err := priv.Bytes()
137+
privkeyb, err := crypto.MarshalPrivateKey(priv)
138138
if err != nil {
139139
return nil, err
140140
}

0 commit comments

Comments
 (0)