From 98f2b391de8ae147347ba5aa822fd71db3045b94 Mon Sep 17 00:00:00 2001
From: Gospodin Bodurov <gospodin@bodurov.net>
Date: Tue, 21 May 2019 20:40:26 +0300
Subject: [PATCH] Fix bug

---
 handler/handler.go | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/handler/handler.go b/handler/handler.go
index d338421..7bb3e9e 100644
--- a/handler/handler.go
+++ b/handler/handler.go
@@ -27,7 +27,6 @@ import (
 	"code.vereign.com/code/viam-apis/versions"
 	"github.com/golang/protobuf/proto"
 
-	"code.vereign.com/code/key-storage-agent/config"
 	keyutils "code.vereign.com/code/key-storage-agent/utils"
 	"code.vereign.com/code/viam-apis/authentication"
 	"code.vereign.com/code/viam-apis/key-storage-agent/api"
@@ -229,15 +228,12 @@ func (s *KeyStorageServerImpl) ReserveKeyUUID(ctx context.Context, in *api.Reser
 }
 
 func (s *KeyStorageServerImpl) GetKeyId(ctx context.Context, in *api.GetKeyIdByKeyRequest) (*api.GetKeyIdByKeyResponse, error) {
-	viamAuth := &authentication.Authentication{
-		Uuid:    config.SystemAuth.Uuid,
-		Session: config.SystemAuth.Session,
-	}
-
-	entitiesMagamentClient := keyutils.CreateEntitiesManagementClient(viamAuth)
+	auth := s.CreateAuthentication(ctx)
+	//in.PublicKey
+	entitiesMagamentClient := keyutils.CreateEntitiesManagementClient(auth)
 	defer entitiesMagamentClient.CloseClient()
 
-	dataStorageClient := keyutils.CreateDataStorageClient(viamAuth)
+	dataStorageClient := keyutils.CreateDataStorageClient(auth)
 	defer dataStorageClient.CloseClient()
 
 	keyIdResponse := &api.GetKeyIdByKeyResponse{}
-- 
GitLab