diff --git a/api/default.go b/api/default.go index e426b16572a06d479aebea3bedd6c7bc38485890..ac3519ab9e9b76f3cb4bcf532a6a2bd2ae65118b 100644 --- a/api/default.go +++ b/api/default.go @@ -1,12 +1,3 @@ package api var DefaultListLimit = 30 - -// IsValidToken checks if a token provided is valid. -// The token string must be 26 characters in length and have the 'glpat-' -// prefix or just be 20 characters long to be recognized as a valid personal access token. -// token can be 64 characters to include oauth tokens -// TODO: check if token has minimum scopes required by glab -func IsValidToken(token string) bool { - return (len(token) == 26 && token[:6] == "glpat-") || len(token) == 20 || len(token) == 64 -} diff --git a/api/default_test.go b/api/default_test.go deleted file mode 100644 index d21d95e53afe3993bcaaad97676c77e4b5769380..0000000000000000000000000000000000000000 --- a/api/default_test.go +++ /dev/null @@ -1,37 +0,0 @@ -package api - -import "testing" - -func TestIsValidToken(t *testing.T) { - type args struct { - token string - } - tests := []struct { - name string - args args - want bool - }{ - { - name: "Token Is Valid", - args: args{token: "xxxxxxxxxxxxxxxxxxxx"}, - want: true, - }, - { - name: "Oauth token is valid", - args: args{token: "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}, - want: true, - }, - { - name: "Token Is inValid", - args: args{token: "123"}, - want: false, - }, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - if got := IsValidToken(tt.args.token); got != tt.want { - t.Errorf("IsValidToken() = %v, want %v", got, tt.want) - } - }) - } -} diff --git a/commands/auth/status/status.go b/commands/auth/status/status.go index 30e208399f70e23fb0cc3f222a26b44165f744f4..33af7bea8e6ac33df11d38bd5d1e8110b0996c11 100644 --- a/commands/auth/status/status.go +++ b/commands/auth/status/status.go @@ -124,9 +124,6 @@ func statusRun(opts *StatusOpts) error { tokenDisplay = token } addMsg("%s Token: %s", c.GreenCheck(), tokenDisplay) - if !api.IsValidToken(token) { - addMsg("%s Invalid token provided in configuration file.", c.WarnIcon()) - } } else { addMsg("%s No token provided in configuration file.", c.WarnIcon()) }