Documentation
¶
Overview ¶
Package shared contains shared provider implementations. Largely stored in this package to avoid circular dependencies.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EnvProvider ¶
type EnvProvider struct { // EnvVars is a list of environment variables to check for a token. EnvVars []EnvVar }
EnvProvider implements the [token.Provider] interface using the environment variables to retrieve a token.
func (*EnvProvider) Token ¶
func (p *EnvProvider) Token() (*Token, error)
Token returns a valid token or an error if no token is found.
type EnvVar ¶
type EnvVar struct { // Name is the name of the environment variable. Name string // Type is an optional field that denotes what type of token this. Type string }
EnvVar is a struct that represents an environment variable that can contain a VCS token.
type Provider ¶
type Provider interface { // Token returns a valid token or an error if no token is found. Token() (*Token, error) }
Provider is an interface for VCS providers to implement to provide a token from a user's machine.
type Token ¶
type Token struct { // FetchedAt is the time that the token was fetched at. This does not // need to be set by providers as it is set by the [token.Fetch] // function. FetchedAt time.Time // Value is the token value. Value string // Source is the source of the token, this is set depending on the // provider that provided the token (e.g., `gh` for the Github CLI). Source string // Type is the type of the token, this is set depending on the // provider that provided the token. Type string }
Token is a VCS token that can be used for API access.
Do not use the 'shared.Token' type, instead use [token.Token] which is an alias to this type.
func (*Token) IsUnauthenticated ¶ added in v0.1.2
IsUnauthenticated returns true if the token is empty.