@cryptotaxi247 / kubo / commits / c692e73f3

go-ipfs-config: fix: remove deprecated calls

And rename imports.

Steven Allen committed Jul 22, 2021 at 15:54 UTC c692e73f3f9c27d43414923acff972b65df07361
1 file changed +7 -7
config/init.go
+7 -7
@@ -8,8 +8,8 @@ import (
8 "time"
9
10 "github.com/ipfs/interface-go-ipfs-core/options"
11 - ci "github.com/libp2p/go-libp2p-core/crypto"
12 - peer "github.com/libp2p/go-libp2p-core/peer"
11 + "github.com/libp2p/go-libp2p-core/crypto"
12 + "github.com/libp2p/go-libp2p-core/peer"
13 )
14
15 func Init(out io.Writer, nBitsForKeypair int) (*Config, error) {
@@ -191,8 +191,8 @@ func CreateIdentity(out io.Writer, opts []options.KeyGenerateOption) (Identity,
191 return ident, err
192 }
193
194 - var sk ci.PrivKey
195 - var pk ci.PubKey
194 + var sk crypto.PrivKey
195 + var pk crypto.PubKey
196
197 switch settings.Algorithm {
198 case "rsa":
@@ -202,7 +202,7 @@ func CreateIdentity(out io.Writer, opts []options.KeyGenerateOption) (Identity,
202
203 fmt.Fprintf(out, "generating %d-bit RSA keypair...", settings.Size)
204
205 - priv, pub, err := ci.GenerateKeyPair(ci.RSA, settings.Size)
205 + priv, pub, err := crypto.GenerateKeyPair(crypto.RSA, settings.Size)
206 if err != nil {
207 return ident, err
208 }
@@ -214,7 +214,7 @@ func CreateIdentity(out io.Writer, opts []options.KeyGenerateOption) (Identity,
214 return ident, fmt.Errorf("number of key bits does not apply when using ed25519 keys")
215 }
216 fmt.Fprintf(out, "generating ED25519 keypair...")
217 - priv, pub, err := ci.GenerateEd25519Key(rand.Reader)
217 + priv, pub, err := crypto.GenerateEd25519Key(rand.Reader)
218 if err != nil {
219 return ident, err
220 }
@@ -228,7 +228,7 @@ func CreateIdentity(out io.Writer, opts []options.KeyGenerateOption) (Identity,
228
229 // currently storing key unencrypted. in the future we need to encrypt it.
230 // TODO(security)
231 - skbytes, err := sk.Bytes()
231 + skbytes, err := crypto.MarshalPrivateKey(sk)
232 if err != nil {
233 return ident, err
234 }