IDB58Decode -> Decode Allow Non-RSA keys to be decoded by the HTTP client
IDB58Decode -> Decode Allow Non-RSA keys to be decoded by the HTTP client This commit was moved from ipfs/go-ipfs-http-client@b0549d86231d69a933b0e4b771c350cf1bf5c27b
Will Scott committed
May 3, 2020 at 12:04 UTC
d9004a9061070263dcc01976334836acb9493530
3 files changed
+11
-11
client/httpapi/key.go
+6
-6
@@ -4,7 +4,7 @@ import (
4
"context"
5
"errors"
6
7
- "github.com/ipfs/interface-go-ipfs-core"
7
+ iface "github.com/ipfs/interface-go-ipfs-core"
8
caopts "github.com/ipfs/interface-go-ipfs-core/options"
9
"github.com/ipfs/interface-go-ipfs-core/path"
10
"github.com/libp2p/go-libp2p-core/peer"
@@ -45,7 +45,7 @@ func (api *KeyAPI) Generate(ctx context.Context, name string, opts ...caopts.Key
45
if err != nil {
46
return nil, err
47
}
48
- out.pid, err = peer.IDB58Decode(out.Id)
48
+ out.pid, err = peer.Decode(out.Id)
49
return &out, err
50
}
51
@@ -69,7 +69,7 @@ func (api *KeyAPI) Rename(ctx context.Context, oldName string, newName string, o
69
}
70
71
id := &keyOutput{JName: out.Now, Id: out.Id}
72
- id.pid, err = peer.IDB58Decode(id.Id)
72
+ id.pid, err = peer.Decode(id.Id)
73
return id, out.Overwrite, err
74
}
75
@@ -82,7 +82,7 @@ func (api *KeyAPI) List(ctx context.Context) ([]iface.Key, error) {
82
res := make([]iface.Key, len(out.Keys))
83
for i, k := range out.Keys {
84
var err error
85
- k.pid, err = peer.IDB58Decode(k.Id)
85
+ k.pid, err = peer.Decode(k.Id)
86
if err != nil {
87
return nil, err
88
}
@@ -100,7 +100,7 @@ func (api *KeyAPI) Self(ctx context.Context) (iface.Key, error) {
100
101
var err error
102
out := keyOutput{JName: "self", Id: id.ID}
103
- out.pid, err = peer.IDB58Decode(out.Id)
103
+ out.pid, err = peer.Decode(out.Id)
104
return &out, err
105
}
106
@@ -114,7 +114,7 @@ func (api *KeyAPI) Remove(ctx context.Context, name string) (iface.Key, error) {
114
}
115
116
var err error
117
- out.Keys[0].pid, err = peer.IDB58Decode(out.Keys[0].Id)
117
+ out.Keys[0].pid, err = peer.Decode(out.Keys[0].Id)
118
return &out.Keys[0], err
119
}
120
client/httpapi/pubsub.go
+2
-2
@@ -6,7 +6,7 @@ import (
6
"encoding/json"
7
"io"
8
9
- "github.com/ipfs/interface-go-ipfs-core"
9
+ iface "github.com/ipfs/interface-go-ipfs-core"
10
caopts "github.com/ipfs/interface-go-ipfs-core/options"
11
"github.com/libp2p/go-libp2p-core/peer"
12
)
@@ -41,7 +41,7 @@ func (api *PubsubAPI) Peers(ctx context.Context, opts ...caopts.PubSubPeersOptio
41
42
res := make([]peer.ID, len(out.Strings))
43
for i, sid := range out.Strings {
44
- id, err := peer.IDB58Decode(sid)
44
+ id, err := peer.Decode(sid)
45
if err != nil {
46
return nil, err
47
}
client/httpapi/swarm.go
+3
-3
@@ -4,7 +4,7 @@ import (
4
"context"
5
"time"
6
7
- "github.com/ipfs/interface-go-ipfs-core"
7
+ iface "github.com/ipfs/interface-go-ipfs-core"
8
"github.com/libp2p/go-libp2p-core/network"
9
"github.com/libp2p/go-libp2p-core/peer"
10
"github.com/libp2p/go-libp2p-core/protocol"
@@ -91,7 +91,7 @@ func (api *SwarmAPI) Peers(ctx context.Context) ([]iface.ConnectionInfo, error)
91
direction: conn.Direction,
92
}
93
94
- out.peer, err = peer.IDB58Decode(conn.Peer)
94
+ out.peer, err = peer.Decode(conn.Peer)
95
if err != nil {
96
return nil, err
97
}
@@ -131,7 +131,7 @@ func (api *SwarmAPI) KnownAddrs(ctx context.Context) (map[peer.ID][]multiaddr.Mu
131
addrs[i] = a
132
}
133
134
- pid, err := peer.IDB58Decode(spid)
134
+ pid, err := peer.Decode(spid)
135
if err != nil {
136
return nil, err
137
}