mirror of
https://github.com/libp2p/go-libp2p-core.git
synced 2025-04-28 17:10:14 +08:00
The docs seem to lie
The docs seem to lie about what these methods do. This is the naive solution since it's my first day looking at go but would it be possible to get these methods to marshal to public or private key correctly by passing a type to them?
This commit is contained in:
parent
b74f60b9cc
commit
dd55087854
@ -349,12 +349,12 @@ func MarshalPrivateKey(k PrivKey) ([]byte, error) {
|
||||
return proto.Marshal(pbmes)
|
||||
}
|
||||
|
||||
// ConfigDecodeKey decodes from b64 (for config file), and unmarshals.
|
||||
// ConfigDecodeKey decodes from b64 (for config file) to a byte array that can be unmarshalled.
|
||||
func ConfigDecodeKey(b string) ([]byte, error) {
|
||||
return base64.StdEncoding.DecodeString(b)
|
||||
}
|
||||
|
||||
// ConfigEncodeKey encodes to b64 (for config file), and marshals.
|
||||
// ConfigEncodeKey encodes a marshalled key to b64 (for config file).
|
||||
func ConfigEncodeKey(b []byte) string {
|
||||
return base64.StdEncoding.EncodeToString(b)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user