Reopenning fix for keystore field name change to align with EIP2335 (#12530)

* adding changes

* fixing deepsource
This commit is contained in:
james-prysm
2023-06-14 15:48:30 -05:00
committed by GitHub
parent 3e17dbb532
commit d15122fae2
12 changed files with 95 additions and 58 deletions

View File

@@ -15,7 +15,7 @@ import (
// ExtractKeystores retrieves the secret keys for specified public keys
// in the function input, encrypts them using the specified password,
// and returns their respective EIP-2335 keystores.
func (_ *Keymanager) ExtractKeystores(
func (*Keymanager) ExtractKeystores(
_ context.Context, publicKeys []bls.PublicKey, password string,
) ([]*keymanager.Keystore, error) {
lock.Lock()
@@ -44,11 +44,11 @@ func (_ *Keymanager) ExtractKeystores(
return nil, err
}
keystores[i] = &keymanager.Keystore{
Crypto: cryptoFields,
ID: id.String(),
Pubkey: fmt.Sprintf("%x", pubKeyBytes),
Version: encryptor.Version(),
Name: encryptor.Name(),
Crypto: cryptoFields,
ID: id.String(),
Pubkey: fmt.Sprintf("%x", pubKeyBytes),
Version: encryptor.Version(),
Description: encryptor.Name(),
}
}
return keystores, nil

View File

@@ -31,11 +31,11 @@ func createRandomKeystore(t testing.TB, password string) *keymanager.Keystore {
cryptoFields, err := encryptor.Encrypt(validatingKey.Marshal(), password)
require.NoError(t, err)
return &keymanager.Keystore{
Crypto: cryptoFields,
Pubkey: fmt.Sprintf("%x", pubKey),
ID: id.String(),
Version: encryptor.Version(),
Name: encryptor.Name(),
Crypto: cryptoFields,
Pubkey: fmt.Sprintf("%x", pubKey),
ID: id.String(),
Version: encryptor.Version(),
Description: encryptor.Name(),
}
}

View File

@@ -83,12 +83,13 @@ type AccountLister interface {
// Keystore json file representation as a Go struct.
type Keystore struct {
Crypto map[string]interface{} `json:"crypto"`
ID string `json:"uuid"`
Pubkey string `json:"pubkey"`
Version uint `json:"version"`
Name string `json:"name"`
Path string `json:"path"`
Crypto map[string]interface{} `json:"crypto"`
ID string `json:"uuid"`
Pubkey string `json:"pubkey"`
Version uint `json:"version"`
Description string `json:"description"`
Name string `json:"name,omitempty"` // field deprecated in favor of description, EIP2335
Path string `json:"path"`
}
// Kind defines an enum for either local, derived, or remote-signing