mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-26 11:03:34 +00:00
fix parse token, return out in cmdexec run
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user