forgeapp

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MIT Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package forgeapp is the gitcred.Credential of a GitHub App installation. It signs a JWT with the key of the app, exchanges it for an installation token, and keeps the token until shortly before it expires.

Index

Constants

View Source
const (
	// DefaultAPI is the API base URL when the configuration names none.
	DefaultAPI = "https://api.github.com"
	Username   = "x-access-token"
)

Variables

This section is empty.

Functions

func ReadKey

func ReadKey(path string) (*rsa.PrivateKey, error)

Types

type App

type App struct {
	AppID          int64
	InstallationID int64
	KeyFile        string
}

App is a GitHub App installation that supplies the credential.

type Clock

type Clock interface{ Now() time.Time }

Clock tells the time, so a test can move it.

type Source

type Source struct {
	// contains filtered or unexported fields
}

Source exchanges an app JWT for an installation token and caches the token until shortly before it expires.

func New

func New(app App, api, dir string, clock Clock) *Source

func (*Source) Use

func (a *Source) Use(ctx context.Context) (gitremote.Cred, func(), error)

Use writes a token to a file in the directory of the source and returns it as the password of the user x-access-token.

Jump to

Keyboard shortcuts

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