fix parse token, return out in cmdexec run

This commit is contained in:
Pavel Sviderski
2024-09-06 15:52:27 +10:00
parent cfa2105684
commit f49e91b41f
2 changed files with 5 additions and 8 deletions
+2 -2
View File
@@ -29,8 +29,8 @@ func NewToken(publicKey secret.Secret, endpoints []netip.AddrPort) Token {
// ParseToken decodes a machine token from the given string.
func ParseToken(s string) (Token, error) {
if strings.HasPrefix(s, TokenPrefix) {
return Token{}, fmt.Errorf("invalid token prefix")
if !strings.HasPrefix(s, TokenPrefix) {
return Token{}, fmt.Errorf("invalid token prefix: %s", s)
}
decoded, err := base64.StdEncoding.DecodeString(s[len(TokenPrefix):])
if err != nil {