Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
skynet2 committed Dec 13, 2024
1 parent e8dc28c commit 3f480c0
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions pkg/kms/aws/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,12 @@ func (s *Service) Decrypt(cipher, _, _ []byte, kh interface{}) ([]byte, error) {
s.metrics.DecryptCount()
}

keyID, err := s.getKeyID(kh.(string))
khStr, ok := kh.(string)
if !ok {
return nil, fmt.Errorf("key handle is not a string")
}

keyID, err := s.getKeyID(khStr)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -192,7 +197,12 @@ func (s *Service) Encrypt(
s.metrics.EncryptCount()
}

keyID, err := s.getKeyID(kh.(string))
khStr, ok := kh.(string)
if !ok {
return nil, nil, fmt.Errorf("key handle is not a string")
}

keyID, err := s.getKeyID(khStr)
if err != nil {
return nil, nil, err
}
Expand Down Expand Up @@ -225,7 +235,12 @@ func (s *Service) Sign(msg []byte, kh interface{}) ([]byte, error) { //nolint: f
s.metrics.SignCount()
}

keyID, err := s.getKeyID(kh.(string))
khStr, ok := kh.(string)
if !ok {
return nil, fmt.Errorf("key handle is not a string")
}

keyID, err := s.getKeyID(khStr)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 3f480c0

Please sign in to comment.