|
|
|
@ -70,6 +70,24 @@ func encodeKeyJSON(s string) ([]byte, error) {
|
|
|
|
|
return out, nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// MarshalYAML encodes the key for YAML, omiting empty.
|
|
|
|
|
func (key PrivateKey) MarshalYAML() (any, error) { |
|
|
|
|
return encodeKeyYAML(key.String()) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// MarshalYAML encodes the key for YAML, omiting empty.
|
|
|
|
|
func (pub PublicKey) MarshalYAML() (any, error) { |
|
|
|
|
return encodeKeyYAML(pub.String()) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func encodeKeyYAML(s string) (any, error) { |
|
|
|
|
if s == "" { |
|
|
|
|
return nil, nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return s, nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// IsZero tells if the key hasn't been set
|
|
|
|
|
func (key PrivateKey) IsZero() bool { |
|
|
|
|
var zero PrivateKey |
|
|
|
|