Skip to content

Commit

Permalink
wip new pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
sgmiller committed Jan 9, 2025
1 parent 0b764cf commit 4f66df1
Show file tree
Hide file tree
Showing 33 changed files with 76 additions and 25 deletions.
2 changes: 1 addition & 1 deletion wrappers/aead/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module github.com/hashicorp/go-kms-wrapping/wrappers/aead/v2

go 1.20

require github.com/hashicorp/go-kms-wrapping/v2 v2.0.10-0.20250106200727-2dc6748a944a
require github.com/hashicorp/go-kms-wrapping/v2 v2.0.17-0.20250109190849-0b764cfa6e4a

require (
github.com/davecgh/go-spew v1.1.1 // indirect
Expand Down
2 changes: 2 additions & 0 deletions wrappers/aead/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ github.com/hashicorp/go-kms-wrapping/v2 v2.0.10-0.20250106200727-2dc6748a944a h1
github.com/hashicorp/go-kms-wrapping/v2 v2.0.10-0.20250106200727-2dc6748a944a/go.mod h1:OZAsxUt8R4Qf7jKFc2NkIIRZ1bxILssfP4rj0Qj8Rg8=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.14 h1:1ZuhfnZgRnLK8S0KovJkoTCRIQId5pv3sDR7pG5VQBw=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.14/go.mod h1:0dWtzl2ilqKpavgM3id/kFK9L3tjo6fS4OhbVPSYpnQ=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.17-0.20250109190849-0b764cfa6e4a h1:vVp114QnwA3n6mGQcL1uio5CrAfej63Bn1qJ3sHPNRU=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.17-0.20250109190849-0b764cfa6e4a/go.mod h1:OZAsxUt8R4Qf7jKFc2NkIIRZ1bxILssfP4rj0Qj8Rg8=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7 h1:UpiO20jno/eV1eVZcxqWnUohyKRe1g8FPV/xH1s/2qs=
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7/go.mod h1:QmrqtbKuxxSWTN3ETMPuB+VtEiBJ/A9XhoYGv8E1uD8=
Expand Down
2 changes: 1 addition & 1 deletion wrappers/alicloudkms/alicloudkms.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (k *Wrapper) SetConfig(_ context.Context, opt ...wrapping.Option) (*wrappin
case os.Getenv(EnvVaultAliCloudKmsSealKeyId) != "" && !opts.Options.WithDisallowEnvVars:
k.keyId = os.Getenv(EnvVaultAliCloudKmsSealKeyId)
case opts.WithKeyId != "":
k.keyId = wrapping.QuietParsePath(opts.WithKeyId)
k.keyId = opts.WithKeyId
default:
return nil, fmt.Errorf("key id not found (env or config) for alicloud kms wrapper configuration")
}
Expand Down
2 changes: 1 addition & 1 deletion wrappers/alicloudkms/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.20

require (
github.com/aliyun/alibaba-cloud-sdk-go v1.61.1499
github.com/hashicorp/go-kms-wrapping/v2 v2.0.10-0.20250106200727-2dc6748a944a
github.com/hashicorp/go-kms-wrapping/v2 v2.0.17-0.20250109190849-0b764cfa6e4a
)

require (
Expand Down
2 changes: 2 additions & 0 deletions wrappers/alicloudkms/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ github.com/hashicorp/go-kms-wrapping/v2 v2.0.10-0.20250106200727-2dc6748a944a h1
github.com/hashicorp/go-kms-wrapping/v2 v2.0.10-0.20250106200727-2dc6748a944a/go.mod h1:OZAsxUt8R4Qf7jKFc2NkIIRZ1bxILssfP4rj0Qj8Rg8=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.14 h1:1ZuhfnZgRnLK8S0KovJkoTCRIQId5pv3sDR7pG5VQBw=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.14/go.mod h1:0dWtzl2ilqKpavgM3id/kFK9L3tjo6fS4OhbVPSYpnQ=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.17-0.20250109190849-0b764cfa6e4a h1:vVp114QnwA3n6mGQcL1uio5CrAfej63Bn1qJ3sHPNRU=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.17-0.20250109190849-0b764cfa6e4a/go.mod h1:OZAsxUt8R4Qf7jKFc2NkIIRZ1bxILssfP4rj0Qj8Rg8=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7 h1:UpiO20jno/eV1eVZcxqWnUohyKRe1g8FPV/xH1s/2qs=
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7/go.mod h1:QmrqtbKuxxSWTN3ETMPuB+VtEiBJ/A9XhoYGv8E1uD8=
Expand Down
4 changes: 4 additions & 0 deletions wrappers/alicloudkms/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ func getOpts(opt ...wrapping.Option) (*options, error) {
}
}

if err := wrapping.ParsePaths(&opts.withAccessSecret, &opts.withSecretKey, &opts.withAccessKey); err != nil {
return nil, err
}

return &opts, nil
}

Expand Down
8 changes: 4 additions & 4 deletions wrappers/awskms/awskms.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (k *Wrapper) SetConfig(_ context.Context, opt ...wrapping.Option) (*wrappin
case os.Getenv(EnvVaultAwsKmsSealKeyId) != "" && !opts.withDisallowEnvVars:
k.keyId = os.Getenv(EnvVaultAwsKmsSealKeyId)
case opts.WithKeyId != "":
k.keyId = wrapping.QuietParsePath(opts.WithKeyId)
k.keyId = opts.WithKeyId
case k.keyNotRequired:
// key not required to set config
default:
Expand All @@ -109,9 +109,9 @@ func (k *Wrapper) SetConfig(_ context.Context, opt ...wrapping.Option) (*wrappin
}

// Check and set AWS access key, secret key, and session token
k.accessKey = wrapping.QuietParsePath(opts.withAccessKey)
k.secretKey = wrapping.QuietParsePath(opts.withSecretKey)
k.sessionToken = wrapping.QuietParsePath(opts.withSessionToken)
k.accessKey = opts.withAccessKey
k.secretKey = opts.withSecretKey
k.sessionToken = opts.withSessionToken
k.sharedCredsFilename = opts.withSharedCredsFilename
k.sharedCredsProfile = opts.withSharedCredsProfile
k.webIdentityTokenFile = opts.withWebIdentityTokenFile
Expand Down
2 changes: 1 addition & 1 deletion wrappers/awskms/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/aws/aws-sdk-go v1.55.5
github.com/hashicorp/go-cleanhttp v0.5.2
github.com/hashicorp/go-hclog v1.5.0
github.com/hashicorp/go-kms-wrapping/v2 v2.0.10-0.20250106200727-2dc6748a944a
github.com/hashicorp/go-kms-wrapping/v2 v2.0.17-0.20250109190849-0b764cfa6e4a
github.com/hashicorp/go-secure-stdlib/awsutil v0.1.6
github.com/stretchr/testify v1.8.4
)
Expand Down
6 changes: 5 additions & 1 deletion wrappers/awskms/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func getOpts(opt ...wrapping.Option) (*options, error) {
case "endpoint":
opts.withEndpoint = v
case "access_key":
opts.withAccessKey = wrapping.QuietParsePath(v)
opts.withAccessKey = v
case "secret_key":
opts.withSecretKey = v
case "session_token":
Expand Down Expand Up @@ -95,6 +95,10 @@ func getOpts(opt ...wrapping.Option) (*options, error) {
}
}

if err := wrapping.ParsePaths(&opts.withAccessKey, &opts.withSecretKey, &opts.withSessionToken); err != nil {
return nil, err
}

return &opts, nil
}

Expand Down
4 changes: 2 additions & 2 deletions wrappers/azurekeyvault/azurekeyvault.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,14 @@ func (v *Wrapper) SetConfig(ctx context.Context, opt ...wrapping.Option) (*wrapp
case os.Getenv("AZURE_CLIENT_ID") != "" && !opts.withDisallowEnvVars:
v.clientID = os.Getenv("AZURE_CLIENT_ID")
case opts.withClientId != "":
v.clientID = wrapping.QuietParsePath(opts.withClientId)
v.clientID = opts.withClientId
}

switch {
case os.Getenv("AZURE_CLIENT_SECRET") != "" && !opts.withDisallowEnvVars:
v.clientSecret = os.Getenv("AZURE_CLIENT_SECRET")
case opts.withClientSecret != "":
v.clientSecret = wrapping.QuietParsePath(opts.withClientSecret)
v.clientSecret = opts.withClientSecret
}

var envName string
Expand Down
2 changes: 1 addition & 1 deletion wrappers/azurekeyvault/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/Azure/go-autorest/autorest v0.11.29
github.com/Azure/go-autorest/autorest/to v0.4.0
github.com/hashicorp/go-hclog v1.5.0
github.com/hashicorp/go-kms-wrapping/v2 v2.0.10-0.20250106200727-2dc6748a944a
github.com/hashicorp/go-kms-wrapping/v2 v2.0.17-0.20250109190849-0b764cfa6e4a
github.com/stretchr/testify v1.9.0
golang.org/x/net v0.26.0
)
Expand Down
2 changes: 2 additions & 0 deletions wrappers/azurekeyvault/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ github.com/hashicorp/go-kms-wrapping/v2 v2.0.10-0.20250106200727-2dc6748a944a h1
github.com/hashicorp/go-kms-wrapping/v2 v2.0.10-0.20250106200727-2dc6748a944a/go.mod h1:OZAsxUt8R4Qf7jKFc2NkIIRZ1bxILssfP4rj0Qj8Rg8=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.14 h1:1ZuhfnZgRnLK8S0KovJkoTCRIQId5pv3sDR7pG5VQBw=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.14/go.mod h1:0dWtzl2ilqKpavgM3id/kFK9L3tjo6fS4OhbVPSYpnQ=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.17-0.20250109190849-0b764cfa6e4a h1:vVp114QnwA3n6mGQcL1uio5CrAfej63Bn1qJ3sHPNRU=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.17-0.20250109190849-0b764cfa6e4a/go.mod h1:OZAsxUt8R4Qf7jKFc2NkIIRZ1bxILssfP4rj0Qj8Rg8=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7 h1:UpiO20jno/eV1eVZcxqWnUohyKRe1g8FPV/xH1s/2qs=
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7/go.mod h1:QmrqtbKuxxSWTN3ETMPuB+VtEiBJ/A9XhoYGv8E1uD8=
Expand Down
4 changes: 4 additions & 0 deletions wrappers/azurekeyvault/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ func getOpts(opt ...wrapping.Option) (*options, error) {
}
}

if err := wrapping.ParsePaths(&opts.withClientId, &opts.withClientSecret, &opts.withTenantId); err != nil {
return nil, err
}

return &opts, nil
}

Expand Down
2 changes: 1 addition & 1 deletion wrappers/gcpckms/gcpckms.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func (s *Wrapper) SetConfig(_ context.Context, opt ...wrapping.Option) (*wrappin
case os.Getenv(EnvVaultGcpCkmsSealCryptoKey) != "" && !opts.Options.WithDisallowEnvVars:
s.cryptoKey = os.Getenv(EnvVaultGcpCkmsSealCryptoKey)
case opts.withCryptoKey != "":
s.cryptoKey = wrapping.QuietParsePath(opts.withCryptoKey)
s.cryptoKey = opts.withCryptoKey
case s.keyNotRequired:
// key not required to set config
default:
Expand Down
2 changes: 1 addition & 1 deletion wrappers/gcpckms/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.20

require (
cloud.google.com/go/kms v1.10.1
github.com/hashicorp/go-kms-wrapping/v2 v2.0.10-0.20250106200727-2dc6748a944a
github.com/hashicorp/go-kms-wrapping/v2 v2.0.17-0.20250109190849-0b764cfa6e4a
golang.org/x/net v0.23.0
google.golang.org/api v0.114.0
)
Expand Down
2 changes: 2 additions & 0 deletions wrappers/gcpckms/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ github.com/hashicorp/go-kms-wrapping/v2 v2.0.10-0.20250106200727-2dc6748a944a h1
github.com/hashicorp/go-kms-wrapping/v2 v2.0.10-0.20250106200727-2dc6748a944a/go.mod h1:OZAsxUt8R4Qf7jKFc2NkIIRZ1bxILssfP4rj0Qj8Rg8=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.14 h1:1ZuhfnZgRnLK8S0KovJkoTCRIQId5pv3sDR7pG5VQBw=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.14/go.mod h1:0dWtzl2ilqKpavgM3id/kFK9L3tjo6fS4OhbVPSYpnQ=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.17-0.20250109190849-0b764cfa6e4a h1:vVp114QnwA3n6mGQcL1uio5CrAfej63Bn1qJ3sHPNRU=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.17-0.20250109190849-0b764cfa6e4a/go.mod h1:OZAsxUt8R4Qf7jKFc2NkIIRZ1bxILssfP4rj0Qj8Rg8=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7 h1:UpiO20jno/eV1eVZcxqWnUohyKRe1g8FPV/xH1s/2qs=
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7/go.mod h1:QmrqtbKuxxSWTN3ETMPuB+VtEiBJ/A9XhoYGv8E1uD8=
Expand Down
6 changes: 6 additions & 0 deletions wrappers/gcpckms/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func getOpts(opt ...wrapping.Option) (*options, error) {
}
}

if err := wrapping.ParsePaths(&opts.withClientId, &opts.withClientSecret
// Parse the global options
var err error
opts.Options, err = wrapping.GetOpts(wrappingOptions...)
Expand Down Expand Up @@ -78,6 +79,11 @@ func getOpts(opt ...wrapping.Option) (*options, error) {
}
}

if err := wrapping.ParsePaths(&opts.withCredentials); err != nil {
return nil, err
}


return &opts, nil
}

Expand Down
2 changes: 1 addition & 1 deletion wrappers/huaweicloudkms/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.20

require (
github.com/hashicorp/go-cleanhttp v0.5.2
github.com/hashicorp/go-kms-wrapping/v2 v2.0.10-0.20250106200727-2dc6748a944a
github.com/hashicorp/go-kms-wrapping/v2 v2.0.17-0.20250109190849-0b764cfa6e4a
github.com/huaweicloud/golangsdk v0.0.0-20210831081626-d823fe11ceba
)

Expand Down
2 changes: 2 additions & 0 deletions wrappers/huaweicloudkms/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ github.com/hashicorp/go-kms-wrapping/v2 v2.0.10-0.20250106200727-2dc6748a944a h1
github.com/hashicorp/go-kms-wrapping/v2 v2.0.10-0.20250106200727-2dc6748a944a/go.mod h1:OZAsxUt8R4Qf7jKFc2NkIIRZ1bxILssfP4rj0Qj8Rg8=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.14 h1:1ZuhfnZgRnLK8S0KovJkoTCRIQId5pv3sDR7pG5VQBw=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.14/go.mod h1:0dWtzl2ilqKpavgM3id/kFK9L3tjo6fS4OhbVPSYpnQ=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.17-0.20250109190849-0b764cfa6e4a h1:vVp114QnwA3n6mGQcL1uio5CrAfej63Bn1qJ3sHPNRU=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.17-0.20250109190849-0b764cfa6e4a/go.mod h1:OZAsxUt8R4Qf7jKFc2NkIIRZ1bxILssfP4rj0Qj8Rg8=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7 h1:UpiO20jno/eV1eVZcxqWnUohyKRe1g8FPV/xH1s/2qs=
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7/go.mod h1:QmrqtbKuxxSWTN3ETMPuB+VtEiBJ/A9XhoYGv8E1uD8=
Expand Down
2 changes: 1 addition & 1 deletion wrappers/huaweicloudkms/huaweicloudkms.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (k *Wrapper) SetConfig(_ context.Context, opt ...wrapping.Option) (*wrappin
keyId, err := getConfig(
"kms_key_id",
os.Getenv(EnvHuaweiCloudKmsWrapperKeyId),
wrapping.QuietParsePath(opts.WithKeyId))
opts.WithKeyId)
if err != nil {
return nil, err
}
Expand Down
4 changes: 4 additions & 0 deletions wrappers/huaweicloudkms/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ func getOpts(opt ...wrapping.Option) (*options, error) {
}
}

if err := wrapping.ParsePaths(&opts.withSecretKey, &opts.withAccessKey); err != nil {
return nil, err
}

return &opts, nil
}

Expand Down
2 changes: 1 addition & 1 deletion wrappers/ocikms/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/hashicorp/go-kms-wrapping/wrappers/ocikms/v2
go 1.20

require (
github.com/hashicorp/go-kms-wrapping/v2 v2.0.10-0.20250106200727-2dc6748a944a
github.com/hashicorp/go-kms-wrapping/v2 v2.0.17-0.20250109190849-0b764cfa6e4a
github.com/oracle/oci-go-sdk/v60 v60.0.0
golang.org/x/net v0.23.0
)
Expand Down
2 changes: 2 additions & 0 deletions wrappers/ocikms/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ github.com/hashicorp/go-kms-wrapping/v2 v2.0.10-0.20250106200727-2dc6748a944a h1
github.com/hashicorp/go-kms-wrapping/v2 v2.0.10-0.20250106200727-2dc6748a944a/go.mod h1:OZAsxUt8R4Qf7jKFc2NkIIRZ1bxILssfP4rj0Qj8Rg8=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.14 h1:1ZuhfnZgRnLK8S0KovJkoTCRIQId5pv3sDR7pG5VQBw=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.14/go.mod h1:0dWtzl2ilqKpavgM3id/kFK9L3tjo6fS4OhbVPSYpnQ=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.17-0.20250109190849-0b764cfa6e4a h1:vVp114QnwA3n6mGQcL1uio5CrAfej63Bn1qJ3sHPNRU=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.17-0.20250109190849-0b764cfa6e4a/go.mod h1:OZAsxUt8R4Qf7jKFc2NkIIRZ1bxILssfP4rj0Qj8Rg8=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7 h1:UpiO20jno/eV1eVZcxqWnUohyKRe1g8FPV/xH1s/2qs=
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7/go.mod h1:QmrqtbKuxxSWTN3ETMPuB+VtEiBJ/A9XhoYGv8E1uD8=
Expand Down
2 changes: 1 addition & 1 deletion wrappers/ocikms/ocikms.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func (k *Wrapper) SetConfig(_ context.Context, opt ...wrapping.Option) (*wrappin
case os.Getenv(EnvVaultOciKmsSealKeyId) != "" && !opts.Options.WithDisallowEnvVars:
k.keyId = os.Getenv(EnvVaultOciKmsSealKeyId)
case opts.WithKeyId != "":
k.keyId = wrapping.QuietParsePath(opts.WithKeyId)
k.keyId = opts.WithKeyId
default:
return nil, fmt.Errorf("'%s' not found for OCI KMS seal configuration", KmsConfigKeyId)
}
Expand Down
5 changes: 5 additions & 0 deletions wrappers/ocikms/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ func getOpts(opt ...wrapping.Option) (*options, error) {
}
}

if err := wrapping.ParsePaths(&opts.); err != nil {
return nil, err
}


return &opts, nil
}

Expand Down
2 changes: 1 addition & 1 deletion wrappers/tencentcloudkms/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/hashicorp/go-kms-wrapping/wrappers/tencentcloudkms/v2
go 1.20

require (
github.com/hashicorp/go-kms-wrapping/v2 v2.0.10-0.20250106200727-2dc6748a944a
github.com/hashicorp/go-kms-wrapping/v2 v2.0.17-0.20250109190849-0b764cfa6e4a
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.604
github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/kms v1.0.604
)
Expand Down
2 changes: 2 additions & 0 deletions wrappers/tencentcloudkms/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ github.com/hashicorp/go-kms-wrapping/v2 v2.0.10-0.20250106200727-2dc6748a944a h1
github.com/hashicorp/go-kms-wrapping/v2 v2.0.10-0.20250106200727-2dc6748a944a/go.mod h1:OZAsxUt8R4Qf7jKFc2NkIIRZ1bxILssfP4rj0Qj8Rg8=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.14 h1:1ZuhfnZgRnLK8S0KovJkoTCRIQId5pv3sDR7pG5VQBw=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.14/go.mod h1:0dWtzl2ilqKpavgM3id/kFK9L3tjo6fS4OhbVPSYpnQ=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.17-0.20250109190849-0b764cfa6e4a h1:vVp114QnwA3n6mGQcL1uio5CrAfej63Bn1qJ3sHPNRU=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.17-0.20250109190849-0b764cfa6e4a/go.mod h1:OZAsxUt8R4Qf7jKFc2NkIIRZ1bxILssfP4rj0Qj8Rg8=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7 h1:UpiO20jno/eV1eVZcxqWnUohyKRe1g8FPV/xH1s/2qs=
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.7/go.mod h1:QmrqtbKuxxSWTN3ETMPuB+VtEiBJ/A9XhoYGv8E1uD8=
Expand Down
4 changes: 4 additions & 0 deletions wrappers/tencentcloudkms/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ func getOpts(opt ...wrapping.Option) (*options, error) {
}
}

if err := wrapping.ParsePaths(&opts.withSecretKey, &opts.withAccessKey, &opts.withSessionToken); err != nil {
return nil, err
}

return &opts, nil
}

Expand Down
8 changes: 4 additions & 4 deletions wrappers/tencentcloudkms/tencentcloudkms.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func (k *Wrapper) SetConfig(_ context.Context, opt ...wrapping.Option) (*wrappin
case os.Getenv(PROVIDER_KMS_KEY_ID) != "":
k.keyId = os.Getenv(PROVIDER_KMS_KEY_ID)
case opts.WithKeyId != "":
k.keyId = wrapping.QuietParsePath(opts.WithKeyId)
k.keyId = opts.WithKeyId
default:
return nil, fmt.Errorf("'key_id' not found for TencentCloud kms wrapper configuration")
}
Expand All @@ -82,7 +82,7 @@ func (k *Wrapper) SetConfig(_ context.Context, opt ...wrapping.Option) (*wrappin
case os.Getenv(PROVIDER_SECRET_ID) != "":
k.accessKey = os.Getenv(PROVIDER_SECRET_ID)
case opts.withAccessKey != "":
k.accessKey = wrapping.QuietParsePath(opts.withAccessKey)
k.accessKey = opts.withAccessKey
default:
return nil, fmt.Errorf("'access_key' not found for TencentCloud KMS wrapper configuration")
}
Expand All @@ -91,7 +91,7 @@ func (k *Wrapper) SetConfig(_ context.Context, opt ...wrapping.Option) (*wrappin
case os.Getenv(PROVIDER_SECRET_KEY) != "":
k.secretKey = os.Getenv(PROVIDER_SECRET_KEY)
case opts.withSecretKey != "":
k.secretKey = wrapping.QuietParsePath(opts.withSecretKey)
k.secretKey = opts.withSecretKey
default:
return nil, fmt.Errorf("'secret_key' not found for TencentCloud KMS wrapper configuration")
}
Expand All @@ -100,7 +100,7 @@ func (k *Wrapper) SetConfig(_ context.Context, opt ...wrapping.Option) (*wrappin
case os.Getenv(PROVIDER_SECURITY_TOKEN) != "":
k.sessionToken = os.Getenv(PROVIDER_SECURITY_TOKEN)
case opts.withSessionToken != "":
k.sessionToken = wrapping.QuietParsePath(opts.withSessionToken)
k.sessionToken = opts.withSessionToken
}

if k.client == nil {
Expand Down
2 changes: 1 addition & 1 deletion wrappers/transit/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.20

require (
github.com/hashicorp/go-hclog v1.6.3
github.com/hashicorp/go-kms-wrapping/v2 v2.0.10-0.20250106200727-2dc6748a944a
github.com/hashicorp/go-kms-wrapping/v2 v2.0.17-0.20250109190849-0b764cfa6e4a
github.com/hashicorp/vault/api v1.10.0
github.com/stretchr/testify v1.8.4
)
Expand Down
2 changes: 2 additions & 0 deletions wrappers/transit/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ github.com/hashicorp/go-kms-wrapping/v2 v2.0.10-0.20250106200727-2dc6748a944a h1
github.com/hashicorp/go-kms-wrapping/v2 v2.0.10-0.20250106200727-2dc6748a944a/go.mod h1:OZAsxUt8R4Qf7jKFc2NkIIRZ1bxILssfP4rj0Qj8Rg8=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.14 h1:1ZuhfnZgRnLK8S0KovJkoTCRIQId5pv3sDR7pG5VQBw=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.14/go.mod h1:0dWtzl2ilqKpavgM3id/kFK9L3tjo6fS4OhbVPSYpnQ=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.17-0.20250109190849-0b764cfa6e4a h1:vVp114QnwA3n6mGQcL1uio5CrAfej63Bn1qJ3sHPNRU=
github.com/hashicorp/go-kms-wrapping/v2 v2.0.17-0.20250109190849-0b764cfa6e4a/go.mod h1:OZAsxUt8R4Qf7jKFc2NkIIRZ1bxILssfP4rj0Qj8Rg8=
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
Expand Down
4 changes: 4 additions & 0 deletions wrappers/transit/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ func getOpts(opt ...wrapping.Option) (*options, error) {
}
}

if err := wrapping.ParsePaths(&opts.withToken); err != nil {
return nil, err
}

return &opts, nil
}

Expand Down
2 changes: 1 addition & 1 deletion wrappers/transit/transit_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func newTransitClient(logger hclog.Logger, opts *options) (*TransitClient, *wrap
return nil, nil, err
}
if opts.withToken != "" {
apiClient.SetToken(wrapping.QuietParsePath(opts.withToken))
apiClient.SetToken(opts.withToken)
}
if namespace != "" {
apiClient.SetNamespace(namespace)
Expand Down

0 comments on commit 4f66df1

Please sign in to comment.