diff --git a/controllers/node_grpc.go b/controllers/node_grpc.go index d9dddc99..e34b8097 100644 --- a/controllers/node_grpc.go +++ b/controllers/node_grpc.go @@ -83,11 +83,11 @@ func (s *NodeServiceServer) CreateNode(ctx context.Context, req *nodepb.Object) return nil, keyErr } - fmt.Printf("appending key to node: %v \n", key) + fmt.Printf("appending key to node: %v \n", key.PublicKey) node.TrafficKeys = models.TrafficKeys{ Mine: node.TrafficKeys.Mine, - Server: key, + Server: key.PublicKey, } fmt.Printf("finished created node: %v \n", node) diff --git a/logic/traffic.go b/logic/traffic.go index ac187bf3..f5dd8ce8 100644 --- a/logic/traffic.go +++ b/logic/traffic.go @@ -7,16 +7,16 @@ import ( ) // RetrieveTrafficKey - retrieves public key based on node -func RetrieveTrafficKey() (rsa.PublicKey, error) { +func RetrieveTrafficKey() (rsa.PrivateKey, error) { var telRecord, err = fetchTelemetryRecord() if err != nil { - return rsa.PublicKey{}, err + return rsa.PrivateKey{}, err } var key = rsa.PrivateKey{} if err = gob.NewDecoder(&telRecord.TrafficKey).Decode(&key); err != nil { - return rsa.PublicKey{}, err + return rsa.PrivateKey{}, err } fmt.Printf("retrieved key: %v \n", key.PublicKey) - return key.PublicKey, nil + return key, nil }