Skip to content

Commit

Permalink
[kms] Add KeySpec and KeyUsage to key metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
dzbarsky committed Jul 30, 2023
1 parent 2bb49e8 commit c09d207
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
7 changes: 7 additions & 0 deletions services/kms/key/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
type metadata struct {
// Immutable
Id string
KeySpec string
Usage types.Usage
EncryptionAlgorithms []types.EncryptionAlgorithm
MacAlgorithms []string
Expand Down Expand Up @@ -75,6 +76,10 @@ func (k Key) Enabled() bool {
return k.metadata.Enabled
}

func (k Key) KeySpec() string {
return k.metadata.KeySpec
}

func (k Key) Usage() types.Usage {
return k.metadata.Usage
}
Expand Down Expand Up @@ -170,6 +175,7 @@ type Options struct {
PersistPath string
Usage types.Usage
Id string
KeySpec string
Description string
Tags map[string]string
}
Expand All @@ -179,6 +185,7 @@ func (o Options) makeKey() *Key {
persistPath: o.PersistPath,
metadata: metadata{
Id: o.Id,
KeySpec: o.KeySpec,
Usage: o.Usage,
Description: o.Description,
Tags: o.Tags,
Expand Down
5 changes: 4 additions & 1 deletion services/kms/kms.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ func (k *KMS) CreateKey(input CreateKeyInput) (*CreateKeyOutput, *awserrors.Erro
PersistPath: persistPath,
Usage: usage,
Id: keyId,
KeySpec: input.KeySpec,
Description: input.Description,
Tags: tags,
}
Expand Down Expand Up @@ -220,9 +221,11 @@ func (k *KMS) toAPI(key *key.Key) APIKeyMetadata {
Description: key.Description(),
Enabled: key.Enabled(),
EncryptionAlgorithms: key.EncryptionAlgorithms(),
KeyId: key.Id(),
KeySpec: key.KeySpec(),
KeyUsage: key.Usage(),
MacAlgorithms: key.MacAlgorithms(),
SigningAlgorithms: key.SigningAlgorithms(),
KeyId: key.Id(),
}
}

Expand Down
2 changes: 2 additions & 0 deletions services/kms/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ type APIKeyMetadata struct {
Enabled bool
EncryptionAlgorithms []types.EncryptionAlgorithm
KeyId string
KeySpec string
KeyUsage types.Usage
MacAlgorithms []string
SigningAlgorithms []types.SigningAlgorithm
}
Expand Down

0 comments on commit c09d207

Please sign in to comment.