types/key: use tlpub: in error message (#13707)

Fixes tailscale/corp#19442

Signed-off-by: Erisa A <erisa@tailscale.com>
pull/13716/head
Erisa A 2 months ago committed by GitHub
parent cb10eddc26
commit c588c36233
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -1448,7 +1448,7 @@ func TestParseNLArgs(t *testing.T) {
name: "disablements not allowed",
input: []string{"disablement:" + strings.Repeat("02", 32)},
parseKeys: true,
wantErr: fmt.Errorf("parsing key 1: key hex string doesn't have expected type prefix nlpub:"),
wantErr: fmt.Errorf("parsing key 1: key hex string doesn't have expected type prefix tlpub:"),
},
{
name: "keys not allowed",

@ -131,10 +131,10 @@ func NLPublicFromEd25519Unsafe(public ed25519.PublicKey) NLPublic {
// is able to decode both the CLI form (tlpub:<hex>) & the
// regular form (nlpub:<hex>).
func (k *NLPublic) UnmarshalText(b []byte) error {
if mem.HasPrefix(mem.B(b), mem.S(nlPublicHexPrefixCLI)) {
return parseHex(k.k[:], mem.B(b), mem.S(nlPublicHexPrefixCLI))
if mem.HasPrefix(mem.B(b), mem.S(nlPublicHexPrefix)) {
return parseHex(k.k[:], mem.B(b), mem.S(nlPublicHexPrefix))
}
return parseHex(k.k[:], mem.B(b), mem.S(nlPublicHexPrefix))
return parseHex(k.k[:], mem.B(b), mem.S(nlPublicHexPrefixCLI))
}
// AppendText implements encoding.TextAppender.

Loading…
Cancel
Save