From cb4bb63030d09afe7ee78fd49613b86709fdc006 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 4 Feb 2020 18:03:31 +0100 Subject: uapi: allow unsetting device private key with /dev/null --- device/noise-types.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'device/noise-types.go') diff --git a/device/noise-types.go b/device/noise-types.go index 6b1f16f..a1976ff 100644 --- a/device/noise-types.go +++ b/device/noise-types.go @@ -52,6 +52,15 @@ func (key *NoisePrivateKey) FromHex(src string) (err error) { return } +func (key *NoisePrivateKey) FromMaybeZeroHex(src string) (err error) { + err = loadExactHex(key[:], src) + if key.IsZero() { + return + } + key.clamp() + return +} + func (key NoisePrivateKey) ToHex() string { return hex.EncodeToString(key[:]) } -- cgit v1.2.3