-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from syndbg/aws-kms
Add AWS KMS asymmetric keypair support
- Loading branch information
Showing
10 changed files
with
462 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package provider | ||
|
||
import "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
|
||
// nolint:gochecknoinits | ||
func init() { | ||
// NOTE: Part of TF registry docs generation | ||
schema.DescriptionKind = schema.StringMarkdown | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package provider | ||
|
||
import "github.com/palantir/stacktrace" | ||
|
||
type MetaClient struct { | ||
payloadDeserializer PayloadDeserializer | ||
payloadDecrypter PayloadDecrypter | ||
} | ||
|
||
func (m *MetaClient) DecryptValue(encryptedValue string) (string, error) { | ||
deserializedValue, err := m.payloadDeserializer.Deserialize([]byte(encryptedValue)) | ||
if err != nil { | ||
return "", stacktrace.Propagate(err, "unable to serialize `value`") | ||
} | ||
|
||
decryptedValue, err := m.payloadDecrypter.Decrypt(deserializedValue) | ||
if err != nil { | ||
return "", stacktrace.Propagate(err, "unable to decrypt `value`") | ||
} | ||
|
||
plaintext := decryptedValue.Content.Plaintext | ||
|
||
return string(plaintext), nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package provider | ||
|
||
import "github.com/sumup-oss/vaulted/pkg/vaulted/payload" | ||
|
||
type PayloadDecrypter interface { | ||
Decrypt(encryptedPayload *payload.EncryptedPayload) (*payload.Payload, error) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package provider | ||
|
||
import "github.com/sumup-oss/vaulted/pkg/vaulted/payload" | ||
|
||
type PayloadDeserializer interface { | ||
Deserialize(encodedContent []byte) (*payload.EncryptedPayload, error) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.