mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 12:57:18 +00:00
9b008522b8
* make demo default * make minimal config a flag * lint * initialize config at the start * gaz * make main method cleaner * remove interop.go * fix test * lint * gaz * Update validator/accounts/interop.go Co-Authored-By: terence tsao <terence@prysmaticlabs.com> * fix docker build * fix docker build
35 lines
816 B
Go
35 lines
816 B
Go
package accounts
|
|
|
|
import (
|
|
"encoding/json"
|
|
"io"
|
|
"io/ioutil"
|
|
)
|
|
|
|
type unencryptedKeysContainer struct {
|
|
Keys []*unencryptedKeys `json:"keys"`
|
|
}
|
|
|
|
type unencryptedKeys struct {
|
|
ValidatorKey []byte `json:"validator_key"`
|
|
WithdrawalKey []byte `json:"withdrawal_key"`
|
|
}
|
|
|
|
func parseUnencryptedKeysFile(r io.Reader) ([][]byte, [][]byte, error) {
|
|
encoded, err := ioutil.ReadAll(r)
|
|
if err != nil {
|
|
return nil, nil, err
|
|
}
|
|
var ctnr *unencryptedKeysContainer
|
|
if err := json.Unmarshal(encoded, &ctnr); err != nil {
|
|
return nil, nil, err
|
|
}
|
|
validatorKeys := make([][]byte, 0)
|
|
withdrawalKeys := make([][]byte, 0)
|
|
for _, item := range ctnr.Keys {
|
|
validatorKeys = append(validatorKeys, item.ValidatorKey)
|
|
withdrawalKeys = append(withdrawalKeys, item.WithdrawalKey)
|
|
}
|
|
return validatorKeys, withdrawalKeys, nil
|
|
}
|