Skip to content

Commit

Permalink
fix: aws kms (#1814)
Browse files Browse the repository at this point in the history
  • Loading branch information
skynet2 authored Dec 4, 2024
1 parent e63d8b2 commit 620e4db
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
4 changes: 2 additions & 2 deletions pkg/storage/awsecret/arieskmsstore/aries_kms_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ func (s *Store) Put(keysetID string, key []byte) error {
return err
}

_, err = s.client.PutSecretValue(context.Background(), &secretsmanager.PutSecretValueInput{
SecretId: lo.ToPtr(s.GetPath(keysetID)),
_, err = s.client.CreateSecret(context.Background(), &secretsmanager.CreateSecretInput{
Name: lo.ToPtr(s.GetPath(keysetID)),
SecretBinary: data,
SecretString: nil,
})
Expand Down
10 changes: 5 additions & 5 deletions pkg/storage/awsecret/arieskmsstore/aries_kms_store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ func TestPut(t *testing.T) {
prefix,
)

cl.EXPECT().PutSecretValue(gomock.Any(), gomock.Any()).
cl.EXPECT().CreateSecret(gomock.Any(), gomock.Any()).
DoAndReturn(func(
ctx context.Context,
input *secretsmanager.PutSecretValueInput,
input *secretsmanager.CreateSecretInput,
f ...func(*secretsmanager.Options),
) (*secretsmanager.PutSecretValueOutput, error) {
assert.EqualValues(t, prefix+"someId", *input.SecretId)
) (*secretsmanager.CreateSecretOutput, error) {
assert.EqualValues(t, prefix+"someId", *input.Name)

var parsed arieskmsstore.DataWrapper
if err := json.Unmarshal(input.SecretBinary, &parsed); err != nil {
Expand All @@ -37,7 +37,7 @@ func TestPut(t *testing.T) {

assert.EqualValues(t, []byte{0x1, 0x2}, parsed.Bin)

return &secretsmanager.PutSecretValueOutput{}, nil
return &secretsmanager.CreateSecretOutput{}, nil
})

assert.NoError(t, store.Put("someId", []byte{0x1, 0x2}))
Expand Down
7 changes: 4 additions & 3 deletions pkg/storage/awsecret/arieskmsstore/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@ import (
)

type Client interface {
PutSecretValue(
CreateSecret(
ctx context.Context,
params *secretsmanager.PutSecretValueInput,
params *secretsmanager.CreateSecretInput,
optFns ...func(*secretsmanager.Options),
) (*secretsmanager.PutSecretValueOutput, error)
) (*secretsmanager.CreateSecretOutput, error)

GetSecretValue(
ctx context.Context,
params *secretsmanager.GetSecretValueInput,
optFns ...func(*secretsmanager.Options),
) (*secretsmanager.GetSecretValueOutput, error)

DeleteSecret(
ctx context.Context,
params *secretsmanager.DeleteSecretInput,
Expand Down

0 comments on commit 620e4db

Please sign in to comment.