github.com/yggdrasil-network/yggdrasil-go@v0.5.6/src/config/config_test.go (about)

     1  package config
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestConfig_Keys(t *testing.T) {
     8  	/*
     9  		var nodeConfig NodeConfig
    10  		nodeConfig.NewKeys()
    11  
    12  		publicKey1, err := hex.DecodeString(nodeConfig.PublicKey)
    13  
    14  		if err != nil {
    15  			t.Fatal("can not decode generated public key")
    16  		}
    17  
    18  		if len(publicKey1) == 0 {
    19  			t.Fatal("empty public key generated")
    20  		}
    21  
    22  		privateKey1, err := hex.DecodeString(nodeConfig.PrivateKey)
    23  
    24  		if err != nil {
    25  			t.Fatal("can not decode generated private key")
    26  		}
    27  
    28  		if len(privateKey1) == 0 {
    29  			t.Fatal("empty private key generated")
    30  		}
    31  
    32  		nodeConfig.NewKeys()
    33  
    34  		publicKey2, err := hex.DecodeString(nodeConfig.PublicKey)
    35  
    36  		if err != nil {
    37  			t.Fatal("can not decode generated public key")
    38  		}
    39  
    40  		if bytes.Equal(publicKey2, publicKey1) {
    41  			t.Fatal("same public key generated")
    42  		}
    43  
    44  		privateKey2, err := hex.DecodeString(nodeConfig.PrivateKey)
    45  
    46  		if err != nil {
    47  			t.Fatal("can not decode generated private key")
    48  		}
    49  
    50  		if bytes.Equal(privateKey2, privateKey1) {
    51  			t.Fatal("same private key generated")
    52  		}
    53  	*/
    54  }