From 2b79c5b96480b70f8bcaada9419244aa46974cda Mon Sep 17 00:00:00 2001 From: chris-j-h Date: Wed, 10 Jul 2019 15:42:14 +0100 Subject: [PATCH] Change hashicorpSecretData(require addr and key to be stored separately) --- accounts/vault/hashicorp_config.go | 25 ++++++++++++------------- accounts/vault/vault_wallet_test.go | 4 ++-- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/accounts/vault/hashicorp_config.go b/accounts/vault/hashicorp_config.go index 900aaef70..fdee00941 100644 --- a/accounts/vault/hashicorp_config.go +++ b/accounts/vault/hashicorp_config.go @@ -1,24 +1,23 @@ package vault type hashicorpWalletConfig struct { - Client hashicorpClientConfig + Client hashicorpClientConfig Secrets []hashicorpSecretData } type hashicorpClientConfig struct { - Url string `toml:",omitempty"` - Approle string `toml:",omitempty"` - CaCert string `toml:",omitempty"` - ClientCert string `toml:",omitempty"` - ClientKey string `toml:",omitempty"` - UseSecretCache bool `toml:",omitempty"` + Url string `toml:",omitempty"` + Approle string `toml:",omitempty"` + CaCert string `toml:",omitempty"` + ClientCert string `toml:",omitempty"` + ClientKey string `toml:",omitempty"` + StorePrivateKeys bool `toml:",omitempty"` } type hashicorpSecretData struct { - Name string `toml:",omitempty"` - SecretEngine string `toml:",omitempty"` - Version int `toml:",omitempty"` - AccountID string `toml:",omitempty"` - KeyID string `toml:",omitempty"` + AddressSecret string `toml:",omitempty"` + PrivateKeySecret string `toml:",omitempty"` + AddressSecretVersion int `toml:",omitempty"` + PrivateKeySecretVersion int `toml:",omitempty"` + SecretEngine string `toml:",omitempty"` } - diff --git a/accounts/vault/vault_wallet_test.go b/accounts/vault/vault_wallet_test.go index cc557b015..a8009c3af 100644 --- a/accounts/vault/vault_wallet_test.go +++ b/accounts/vault/vault_wallet_test.go @@ -465,7 +465,7 @@ func TestVaultWallet_Open_Hashicorp_ErrAuthenticatingClient(t *testing.T) { } } -// Note: This is an integration test, as such the scope of the test is large, covering the VaultBackend, VaultWallet and HashicorpService +// Note: This is an integration test, as such the scope of the test is large. It covers the VaultBackend, vaultWallet and hashicorpService func TestVaultWallet_Open_Hashicorp_SendsEventToBackendSubscribers(t *testing.T) { if err := os.Setenv(api.EnvVaultToken, "mytoken"); err != nil { t.Fatal(err) @@ -514,7 +514,7 @@ func TestVaultWallet_Close_Hashicorp_ReturnsStateToBeforeOpen(t *testing.T) { config := hashicorpWalletConfig{ Client: hashicorpClientConfig{Url: "http://url:1"}, - Secrets: []hashicorpSecretData{{Name: "secret1"}}, + Secrets: []hashicorpSecretData{{AddressSecret: "addr1"}}, } w, err := newHashicorpWallet(config, &event.Feed{})