Skip to content

Commit

Permalink
Move from deprecated API
Browse files Browse the repository at this point in the history
Signed-off-by: John Kjell <[email protected]>
  • Loading branch information
jkjell committed Jun 11, 2024
1 parent 3e218c2 commit 2879409
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ go 1.21

require (
cloud.google.com/go/kms v1.15.9
github.com/aws/aws-sdk-go-v2 v1.27.2
github.com/aws/aws-sdk-go-v2/config v1.27.18
github.com/aws/aws-sdk-go-v2/service/kms v1.31.3
github.com/digitorus/pkcs7 v0.0.0-20230818184609-3a137a874352
Expand Down Expand Up @@ -41,6 +40,7 @@ require (
filippo.io/edwards25519 v1.1.0 // indirect
github.com/agnivade/levenshtein v1.1.1 // indirect
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/aws/aws-sdk-go-v2 v1.27.2 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.17.18 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.5 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.9 // indirect
Expand Down
20 changes: 9 additions & 11 deletions signer/kms/aws/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ import (
"strings"
"time"

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
akms "github.com/aws/aws-sdk-go-v2/service/kms"
"github.com/aws/aws-sdk-go-v2/service/kms/types"
"github.com/aws/aws-sdk-go/aws"
"github.com/in-toto/go-witness/cryptoutil"
"github.com/in-toto/go-witness/log"
"github.com/in-toto/go-witness/registry"
Expand Down Expand Up @@ -303,15 +303,6 @@ func (a *awsClient) setupClient(ctx context.Context, ksp *kms.KMSSignerProvider)
}

opts := []func(*config.LoadOptions) error{}
if a.endpoint != "" {
opts = append(opts, config.WithEndpointResolverWithOptions(
aws.EndpointResolverWithOptionsFunc(func(service, region string, options ...interface{}) (aws.Endpoint, error) {
return aws.Endpoint{
URL: "https://" + a.endpoint,
}, nil
}),
))
}

if a.options.insecureSkipVerify {
log.Warn("InsecureSkipVerify is enabled for AWS KMS attestor")
Expand Down Expand Up @@ -352,7 +343,14 @@ func (a *awsClient) setupClient(ctx context.Context, ksp *kms.KMSSignerProvider)
return fmt.Errorf("loading AWS config: %w", err)
}

a.client = akms.NewFromConfig(cfg)
if a.endpoint != "" {
a.client = akms.NewFromConfig(cfg, func(o *akms.Options) {
o.BaseEndpoint = aws.String("https://" + a.endpoint)
})
} else {
a.client = akms.NewFromConfig(cfg)
}

return
}

Expand Down

0 comments on commit 2879409

Please sign in to comment.