From 56e765daac7037b13de0d87158fa982380e11165 Mon Sep 17 00:00:00 2001 From: Stas Dmytryshyn Date: Wed, 4 Dec 2024 18:00:29 +0100 Subject: [PATCH] fix: kms no key (#1815) * fix: secret status code * fix: cast --- pkg/storage/awsecret/arieskmsstore/aries_kms_store.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/storage/awsecret/arieskmsstore/aries_kms_store.go b/pkg/storage/awsecret/arieskmsstore/aries_kms_store.go index 1819eb09d..7b8cee2b7 100644 --- a/pkg/storage/awsecret/arieskmsstore/aries_kms_store.go +++ b/pkg/storage/awsecret/arieskmsstore/aries_kms_store.go @@ -9,10 +9,13 @@ package arieskmsstore import ( "context" "encoding/json" + "errors" "path" "github.com/aws/aws-sdk-go-v2/service/secretsmanager" + "github.com/aws/aws-sdk-go-v2/service/secretsmanager/types" "github.com/samber/lo" + "github.com/trustbloc/kms-go/kms" "github.com/trustbloc/logutil-go/pkg/log" "github.com/trustbloc/vcs/internal/logfields" @@ -70,6 +73,12 @@ func (s *Store) Get(keysetID string) ([]byte, error) { out, err := s.client.GetSecretValue(context.Background(), &secretsmanager.GetSecretValueInput{ SecretId: lo.ToPtr(s.GetPath(keysetID)), }) + + var smErr *types.ResourceNotFoundException + if errors.As(err, &smErr) { + return nil, kms.ErrKeyNotFound + } + if err != nil { return nil, err }