mirror of
https://github.com/pgsty/minio.git
synced 2026-07-19 04:00:25 +03:00
kes: remove unnecessary error conversion (#14459)
This commit removes some duplicate code that converts KES API errors. This code was added since KES `0.18.0` changed some exported API errors. However, the KES SDK handles this error conversion itself. Therefore, it is not necessary to duplicate this behavior in MinIO. See: https://github.com/minio/kes/blob/21555fa624420def4aa4766686baa553b692010a/error.go#L94 Signed-off-by: Andreas Auernhammer <hi@aead.dev>
This commit is contained in:
committed by
GitHub
parent
289fcbd08c
commit
b48f719b8e
@@ -22,7 +22,6 @@ import (
|
||||
"crypto/tls"
|
||||
"crypto/x509"
|
||||
"errors"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/minio/kes"
|
||||
@@ -141,10 +140,3 @@ func (c *kesClient) DecryptKey(keyID string, ciphertext []byte, ctx Context) ([]
|
||||
}
|
||||
return c.client.Decrypt(context.Background(), keyID, ciphertext, ctxBytes)
|
||||
}
|
||||
|
||||
// KeyExists returns if key exists on KMS based on the provided error type
|
||||
func KeyExists(err error) bool {
|
||||
// legacyKeyExists will be used to maintain compatibility with KES versions older than v0.18.0
|
||||
legacyKeyExists := kes.NewError(http.StatusBadRequest, "key does already exist")
|
||||
return errors.Is(err, kes.ErrKeyExists) || errors.Is(err, legacyKeyExists)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user