From 073a3ec416ec1b0d350d7e7f9b2bcb9087d685df Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 29 Oct 2021 13:53:45 -0700 Subject: [PATCH] types/key: correct ShortString representation of DiscoPublic. Signed-off-by: David Anderson --- types/key/disco.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/types/key/disco.go b/types/key/disco.go index 08d975922..04f3e2e82 100644 --- a/types/key/disco.go +++ b/types/key/disco.go @@ -6,6 +6,7 @@ package key import ( "crypto/subtle" + "fmt" "go4.org/mem" "golang.org/x/crypto/curve25519" @@ -92,10 +93,12 @@ func (k DiscoPublic) IsZero() bool { } // ShortString returns the Tailscale conventional debug representation -// of a public key: the first five base64 digits of the key, in square -// brackets. +// of a disco key. func (k DiscoPublic) ShortString() string { - return debug32(k.k) + if k.IsZero() { + return "" + } + return fmt.Sprintf("d:%x", k.k[:8]) } // AppendTo appends k, serialized as a 32-byte binary value, to