githubauth

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultCipherSeed

func DefaultCipherSeed(dsn string) string

func NormalizeGitHubRepositoryURL

func NormalizeGitHubRepositoryURL(raw string) (string, bool)

func RedactToken

func RedactToken(raw string) string

Types

type ProbeState

type ProbeState string
const (
	ProbeStateMissing                 ProbeState = "missing"
	ProbeStateConfigured              ProbeState = "configured"
	ProbeStateProbing                 ProbeState = "probing"
	ProbeStateValid                   ProbeState = "valid"
	ProbeStateInsufficientPermissions ProbeState = "insufficient_permissions"
	ProbeStateRevoked                 ProbeState = "revoked"
	ProbeStateError                   ProbeState = "error"
)

func (ProbeState) IsValid

func (s ProbeState) IsValid() bool

type ProjectContext

type ProjectContext struct {
	ProjectID              uuid.UUID
	OrganizationID         uuid.UUID
	ProjectRepositoryURL   string
	OrganizationCredential *StoredCredential
	OrganizationProbe      *TokenProbe
	ProjectCredential      *StoredCredential
	ProjectProbe           *TokenProbe
}

func (ProjectContext) CredentialForScope

func (c ProjectContext) CredentialForScope(scope Scope) (*StoredCredential, *TokenProbe, error)

type RepoAccess

type RepoAccess string
const (
	RepoAccessNotChecked RepoAccess = "not_checked"
	RepoAccessGranted    RepoAccess = "granted"
	RepoAccessDenied     RepoAccess = "denied"
)

func (RepoAccess) IsValid

func (r RepoAccess) IsValid() bool

type RepositoryRef

type RepositoryRef struct {
	Owner string
	Name  string
}

func ParseGitHubRepositoryURL

func ParseGitHubRepositoryURL(raw string) (RepositoryRef, bool)

func (RepositoryRef) String

func (r RepositoryRef) String() string

type ResolvedCredential

type ResolvedCredential struct {
	Scope        Scope
	Source       Source
	Token        string
	TokenPreview string
	Probe        TokenProbe
}

func ResolveProjectCredential

func ResolveProjectCredential(context ProjectContext, decrypt func(StoredCredential) (string, error)) (ResolvedCredential, error)

type Scope

type Scope string
const (
	ScopeOrganization Scope = "organization"
	ScopeProject      Scope = "project"
)

func (Scope) IsValid

func (s Scope) IsValid() bool

type Source

type Source string
const (
	SourceDeviceFlow  Source = "device_flow"
	SourceGHCLIImport Source = "gh_cli_import"
	SourceManualPaste Source = "manual_paste"
)

func (Source) IsValid

func (s Source) IsValid() bool

type StoredCredential

type StoredCredential struct {
	Algorithm    string    `json:"algorithm"`
	TokenPreview string    `json:"token_preview"`
	Nonce        string    `json:"nonce"`
	Ciphertext   string    `json:"ciphertext"`
	Source       Source    `json:"source"`
	UpdatedAt    time.Time `json:"updated_at"`
}

type TokenProbe

type TokenProbe struct {
	State       ProbeState `json:"state"`
	Configured  bool       `json:"configured"`
	Valid       bool       `json:"valid"`
	Login       string     `json:"login,omitempty"`
	Permissions []string   `json:"permissions"`
	RepoAccess  RepoAccess `json:"repo_access"`
	CheckedAt   *time.Time `json:"checked_at,omitempty"`
	LastError   string     `json:"last_error,omitempty"`
}

func ConfiguredProbe

func ConfiguredProbe() TokenProbe

func MissingProbe

func MissingProbe() TokenProbe

func NormalizeProbe

func NormalizeProbe(raw *TokenProbe, configured bool) TokenProbe

Jump to

Keyboard shortcuts

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