Documentation
¶
Overview ¶
Package githubapp provides repository-scoped GitHub App authentication.
Plane: shared
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrOwnerNotAllowed marks a repository owner outside the daemon allowlist. ErrOwnerNotAllowed = errors.New("GitHub owner is not allowed") // ErrInstallationNotFound marks a repository without an accessible App installation. ErrInstallationNotFound = errors.New("GitHub App installation was not found") )
Functions ¶
This section is empty.
Types ¶
type BrokerOption ¶
type BrokerOption func(*brokerOptions)
BrokerOption configures internal broker dependencies.
func WithAPIBaseURL ¶
func WithAPIBaseURL(baseURL string) BrokerOption
WithAPIBaseURL overrides GitHub's API URL for tests.
func WithHTTPTransport ¶
func WithHTTPTransport(transport http.RoundTripper) BrokerOption
WithHTTPTransport overrides the GitHub HTTP transport for tests.
type Config ¶
type Config struct {
AppID int64 `toml:"app_id"`
KeySource string `toml:"key_source"`
KeyRef string `toml:"key_ref"`
AllowedOwners []string `toml:"allowed_owners"`
}
Config is the validated GitHub App section of og.toml.
func (Config) RequireOwner ¶
RequireOwner rejects repositories outside the configured owner allowlist.
type CredentialBroker ¶
type CredentialBroker interface {
Token(ctx context.Context, owner, repo string, purpose Purpose) (string, error)
Status(ctx context.Context, owner, repo string) (InstallationStatus, error)
Invalidate(owner, repo string, purpose Purpose, failedToken string) error
}
CredentialBroker provides repository- and purpose-scoped App credentials.
func NewBroker ¶
func NewBroker(cfg Config, keySource KeySource, options ...BrokerOption) (CredentialBroker, error)
NewBroker builds a broker and validates the configured App private key.
type InstallationStatus ¶
type InstallationStatus struct {
AppID int64
InstallationID int64
Repository string
Permissions map[string]string
}
InstallationStatus is non-secret installation metadata for one repository.
type KeySource ¶
type KeySource interface {
PrivateKey() (*rsa.PrivateKey, error)
}
KeySource loads the App's private key without exposing its storage details.