common

package
v3.81.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2024 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllGistsForUser

func GetAllGistsForUser(client *gh.Client) ([]*gh.Gist, error)

func GetAllReposForUser

func GetAllReposForUser(client *gh.Client) ([]*gh.Repository, error)

func PrintGists

func PrintGists(gists []*gh.Gist, showAll bool)

func PrintGitHubRepos

func PrintGitHubRepos(repos []*gh.Repository)

Types

type Permission

type Permission int

type SecretInfo

type SecretInfo struct {
	Metadata *TokenMetadata
	Repos    []*gh.Repository
	Gists    []*gh.Gist
	// AccessibleRepos, RepoAccessMap, and UserAccessMap are only set if
	// the token has fine-grained access.
	AccessibleRepos []*gh.Repository
	RepoAccessMap   any
	UserAccessMap   any
}

type TokenMetadata

type TokenMetadata struct {
	Type        TokenType
	FineGrained bool
	User        *gh.User
	Expiration  time.Time
	OauthScopes []analyzers.Permission
}

func GetTokenMetadata

func GetTokenMetadata(token string, client *gh.Client) (*TokenMetadata, error)

GetTokenMetadata gets the username, expiration date, and x-oauth-scopes headers for a given token by sending a GET request to the /user endpoint Returns a response object for usage in the checkFineGrained function

type TokenType added in v3.81.6

type TokenType string
const (
	TokenTypeFineGrainedPAT TokenType = "Fine-Grained GitHub Personal Access Token"
	TokenTypeClassicPAT     TokenType = "Classic GitHub Personal Access Token"
	TokenTypeUserToServer   TokenType = "GitHub User-to-Server Token"
	TokenTypeGitHubToken    TokenType = "GitHub Token"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL