mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 14:15:06 +03:00
Fix Public/PrivateKey configuration type mismatch
Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
This commit is contained in:
parent
c9472add87
commit
780763eaf8
1 changed files with 9 additions and 0 deletions
|
@ -322,6 +322,15 @@ func ReadConfig(conf []byte) *NodeConfig {
|
|||
}
|
||||
}
|
||||
}
|
||||
// Ensure PublicKey and PrivateKey are KeyBytes
|
||||
if privatekey, ok := dat["PrivateKey"]; ok {
|
||||
if privstr, err := hex.DecodeString(privatekey.(string)); err == nil {
|
||||
priv := ed25519.PrivateKey(privstr)
|
||||
pub := priv.Public().(ed25519.PublicKey)
|
||||
dat["PrivateKey"] = KeyBytes(priv[:])
|
||||
dat["PublicKey"] = KeyBytes(pub[:])
|
||||
}
|
||||
}
|
||||
// Sanitise the config
|
||||
confJson, err := json.Marshal(dat)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue