From 2f94d579ba452391c839e4505edb2c775c2e8ceb Mon Sep 17 00:00:00 2001 From: Minh-Nghia Nguyen Date: Wed, 30 Sep 2026 10:38:12 +0100 Subject: [PATCH] feat: add common error for cryptographically failed key import Signed-off-by: Minh-Nghia Nguyen --- pkg/plugin/keystore/errors/errors.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/plugin/keystore/errors/errors.go b/pkg/plugin/keystore/errors/errors.go index 875a4f5..a2f5aae 100644 --- a/pkg/plugin/keystore/errors/errors.go +++ b/pkg/plugin/keystore/errors/errors.go @@ -37,7 +37,13 @@ var ( StatusKeyNotFound = status.New( codes.NotFound, "key not found in the keystore provider") + // StatusKeyGenericErr indicates a generic error occurred while trying to get the key from the keystore provider. StatusKeyGenericErr = status.New(codes.Unknown, "failed to get key") + + // StatusImportKeyMaterialFailed indicates that the import of key material failed cryptographically, typically + // due to invalid or incorrectly wrapped key material. + StatusImportKeyMaterialFailed = status.New( + codes.InvalidArgument, "key material decryption failed: invalid or incorrectly wrapped key material") ) // NewGrpcErrorWithDetails creates a gRPC error with the given status and metadata mapping.