package main import ( "fmt" "github.com/tsuru/tsuru/auth" ) func main() { token, err := auth.GenerateAuthToken("[email protected]", "password123") if err != nil { fmt.Println("Error generating token:", err) return } fmt.Println("Token:", token) }
package main import ( "fmt" "github.com/tsuru/tsuru/auth" ) func main() { token := "my-auth-token" if auth.ValidateAuthToken(token) { fmt.Println("Valid token!") } else { fmt.Println("Invalid token :(") } }In this example, we are using the ValidateAuthToken function from the Token package to validate an authentication token. The function takes one argument: the token to be validated. If the token is valid, the function returns true; otherwise, it returns false.