shared

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthTokenWriteable

func AuthTokenWriteable(authCfg gh.AuthConfig, hostname string) (string, bool)

func GetCurrentLogin

func GetCurrentLogin(httpClient httpClient, hostname, authToken string) (string, error)

GetCurrentLogin returns the username from a Bitbucket token (which is in username:app_password format).

func GetScopes

func GetScopes(httpClient httpClient, hostname, authToken string) (string, error)

GetScopes performs a GitHub API request and returns the value of the X-Oauth-Scopes header.

func HasMinimumScopes

func HasMinimumScopes(httpClient httpClient, hostname, authToken string) error

HasMinimumScopes performs a GitHub API request and returns an error if the token used in the request lacks the minimum required scopes for performing API operations with gh.

func HeaderHasMinimumScopes

func HeaderHasMinimumScopes(scopesHeader string) error

HeaderHasMinimumScopes parses the comma separated scopesHeader string and returns an error if it lacks the minimum required scopes for performing API operations with gh.

func Login

func Login(opts *LoginOptions) error

Login performs the Bitbucket login flow using App Passwords. App Passwords are Bitbucket's equivalent of GitHub PATs.

Types

type GitCredentialFlow

type GitCredentialFlow struct {
	Prompter Prompt

	HelperConfig HelperConfig
	Updater      *gitcredentials.Updater
	// contains filtered or unexported fields
}

func (*GitCredentialFlow) Prompt

func (flow *GitCredentialFlow) Prompt(hostname string) error

func (*GitCredentialFlow) Scopes

func (flow *GitCredentialFlow) Scopes() []string

func (*GitCredentialFlow) Setup

func (flow *GitCredentialFlow) Setup(hostname, username, authToken string) error

func (*GitCredentialFlow) ShouldSetup

func (flow *GitCredentialFlow) ShouldSetup() bool

type HelperConfig

type HelperConfig interface {
	ConfigureOurs(hostname string) error
	ConfiguredHelper(hostname string) (gitcredentials.Helper, error)
}

type LoginOptions

type LoginOptions struct {
	IO             *iostreams.IOStreams
	Config         iconfig
	HTTPClient     *http.Client
	Hostname       string
	Interactive    bool
	GitProtocol    string
	Prompter       Prompt
	CredentialFlow *GitCredentialFlow
	SecureStorage  bool
}

type MissingScopesError

type MissingScopesError struct {
	MissingScopes []string
}

func (MissingScopesError) Error

func (e MissingScopesError) Error() string

type Prompt

type Prompt interface {
	Select(string, string, []string) (int, error)
	Confirm(string, bool) (bool, error)
	InputHostname() (string, error)
	AuthToken() (string, error)
	Input(string, string) (string, error)
	Password(string) (string, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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