Commit 1c2377b0 authored by Bas Westerbaan's avatar Bas Westerbaan

Properly read powKey

parent dcd3ffc5
......@@ -65,7 +65,7 @@ type Conf struct {
Ed25519PowDifficulty *uint32 `yaml:"ed25519PowDifficulty"`
// Key to generate Proof of Work nonces with
PowKey []byte `yaml:"powKey"`
PowKey yamlBinary `yaml:"powKey"`
// Interval between changing the proof of work nonces
PowWindow time.Duration `yaml:"powWindow"`
......@@ -89,6 +89,21 @@ type AlgPkPair struct {
PublicKey []byte
}
type yamlBinary []byte
func (yb *yamlBinary) UnmarshalText(buf []byte) error {
buf, err := base64.StdEncoding.DecodeString(string(buf))
if err != nil {
return err
}
*yb = buf
return nil
}
func (yb yamlBinary) MarshalText() ([]byte, error) {
return []byte(base64.StdEncoding.EncodeToString(yb)), nil
}
func (pair *AlgPkPair) UnmarshalText(buf []byte) error {
var err error
bits := strings.SplitN(string(buf), "-", 2)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment