mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-25 19:15:34 +00:00
types/key: use tlpub: in error message (#13707)
Fixes tailscale/corp#19442 Signed-off-by: Erisa A <erisa@tailscale.com>
This commit is contained in:
parent
cb10eddc26
commit
c588c36233
@ -1448,7 +1448,7 @@ func TestParseNLArgs(t *testing.T) {
|
|||||||
name: "disablements not allowed",
|
name: "disablements not allowed",
|
||||||
input: []string{"disablement:" + strings.Repeat("02", 32)},
|
input: []string{"disablement:" + strings.Repeat("02", 32)},
|
||||||
parseKeys: true,
|
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",
|
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
|
// is able to decode both the CLI form (tlpub:<hex>) & the
|
||||||
// regular form (nlpub:<hex>).
|
// regular form (nlpub:<hex>).
|
||||||
func (k *NLPublic) UnmarshalText(b []byte) error {
|
func (k *NLPublic) UnmarshalText(b []byte) error {
|
||||||
if mem.HasPrefix(mem.B(b), mem.S(nlPublicHexPrefixCLI)) {
|
if mem.HasPrefix(mem.B(b), mem.S(nlPublicHexPrefix)) {
|
||||||
return parseHex(k.k[:], mem.B(b), mem.S(nlPublicHexPrefixCLI))
|
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.
|
// AppendText implements encoding.TextAppender.
|
||||||
|
Loading…
Reference in New Issue
Block a user