yggdrasil-go/src/config/config_test.go

55 lines
1.0 KiB
Go
Raw Normal View History

package config
import (
"testing"
)
func TestConfig_Keys(t *testing.T) {
2023-04-06 21:45:49 +01:00
/*
var nodeConfig NodeConfig
nodeConfig.NewKeys()
2023-04-06 21:45:49 +01:00
publicKey1, err := hex.DecodeString(nodeConfig.PublicKey)
2023-04-06 21:45:49 +01:00
if err != nil {
t.Fatal("can not decode generated public key")
}
2023-04-06 21:45:49 +01:00
if len(publicKey1) == 0 {
t.Fatal("empty public key generated")
}
2023-04-06 21:45:49 +01:00
privateKey1, err := hex.DecodeString(nodeConfig.PrivateKey)
2023-04-06 21:45:49 +01:00
if err != nil {
t.Fatal("can not decode generated private key")
}
2023-04-06 21:45:49 +01:00
if len(privateKey1) == 0 {
t.Fatal("empty private key generated")
}
2023-04-06 21:45:49 +01:00
nodeConfig.NewKeys()
2023-04-06 21:45:49 +01:00
publicKey2, err := hex.DecodeString(nodeConfig.PublicKey)
2023-04-06 21:45:49 +01:00
if err != nil {
t.Fatal("can not decode generated public key")
}
2023-04-06 21:45:49 +01:00
if bytes.Equal(publicKey2, publicKey1) {
t.Fatal("same public key generated")
}
2023-04-06 21:45:49 +01:00
privateKey2, err := hex.DecodeString(nodeConfig.PrivateKey)
2023-04-06 21:45:49 +01:00
if err != nil {
t.Fatal("can not decode generated private key")
}
2023-04-06 21:45:49 +01:00
if bytes.Equal(privateKey2, privateKey1) {
t.Fatal("same private key generated")
}
*/
}