From a9f12f52f86384cf38ec166a0c7dba6ccb8fbc0d Mon Sep 17 00:00:00 2001 From: Aaron Lehmann Date: Mon, 20 Jul 2015 09:57:44 -0700 Subject: [PATCH] Implement missing functions in NotarySigner to fully satisfy CryptoService interface These missing functions aren't used, so they're not strictly necessary at this point. However, it's cleaner to fully implement the interface than to have functions that don't work with TODO comments. Signed-off-by: Aaron Lehmann --- signer/signer_trust.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/signer/signer_trust.go b/signer/signer_trust.go index e9fa39343d..7271fbb99e 100644 --- a/signer/signer_trust.go +++ b/signer/signer_trust.go @@ -1,7 +1,6 @@ package signer import ( - "errors" "net" "github.com/Sirupsen/logrus" @@ -75,12 +74,15 @@ func (trust *NotarySigner) Create(role string, algorithm data.KeyAlgorithm) (dat // RemoveKey deletes a key func (trust *NotarySigner) RemoveKey(keyid string) error { - //TODO(aaronl): Not implemented yet - return errors.New("DeleteKey not implemented in NotarySigner") + _, err := trust.kmClient.DeleteKey(context.Background(), &pb.KeyID{ID: keyid}) + return err } // GetKey retrieves a key func (trust *NotarySigner) GetKey(keyid string) data.PublicKey { - //TODO(aaronl): Not implemented yet - return nil + publicKey, err := trust.kmClient.GetKeyInfo(context.Background(), &pb.KeyID{ID: keyid}) + if err != nil { + return nil + } + return data.NewPublicKey(data.KeyAlgorithm(publicKey.KeyInfo.Algorithm.Algorithm), publicKey.PublicKey) }