Skip to content

Commit 83c55b8

Browse files
Do not save private keys in asset store
1 parent 8caccf7 commit 83c55b8

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

pkg/asset/agent/gencrypto/authconfig.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717

1818
// AuthConfig is an asset that generates ECDSA public/private keys, JWT token.
1919
type AuthConfig struct {
20-
PublicKey, PrivateKey, Token string
20+
PublicKey, Token string
2121
}
2222

2323
var _ asset.Asset = (*AuthConfig)(nil)
@@ -49,10 +49,8 @@ func (a *AuthConfig) Generate(dependencies asset.Parents) error {
4949
return err
5050
}
5151
// Encode to Base64 (Standard encoding)
52-
encodedPrivateKeyPEM := base64.StdEncoding.EncodeToString([]byte(PrivateKey))
5352
encodedPubKeyPEM := base64.StdEncoding.EncodeToString([]byte(PublicKey))
5453

55-
a.PrivateKey = encodedPrivateKeyPEM
5654
a.PublicKey = encodedPubKeyPEM
5755

5856
token, err := localJWTForKey(infraEnvID.ID, PrivateKey)

pkg/asset/agent/gencrypto/authconfig_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func TestAuthConfig_Generate(t *testing.T) {
1414
name string
1515
}{
1616
{
17-
name: "generate-public-private-keys",
17+
name: "generate-public-key-and-token",
1818
},
1919
}
2020
for _, tc := range cases {
@@ -27,7 +27,6 @@ func TestAuthConfig_Generate(t *testing.T) {
2727

2828
assert.NoError(t, err)
2929

30-
assert.NotEmpty(t, authConfigAsset.PrivateKey)
3130
assert.NotEmpty(t, authConfigAsset.PublicKey)
3231
assert.NotEmpty(t, authConfigAsset.Token)
3332
})

0 commit comments

Comments
 (0)