{"modulePath":"github.com/bborbe/maintainer/lib","version":"v0.39.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package githubapp\n\n## Functions\n\n```go\nfunc MintIAT(ctx context.Context, cfg Config) (string, error)\n```\nMintIAT returns a current installation access token as a plain string (e.g. \"ghs\\_...\") suitable for use as a bearer credential in subprocess env (GH\\_TOKEN), \\`gh auth setup-git\\`, or any other caller that needs the raw token rather than an authenticated http.Client.\n\nThe returned token is valid for up to 1 hour from GitHub's perspective. Callers that need long-lived authentication should use NewClient instead; callers that need to refresh a one-shot string token should call MintIAT again — the underlying ghinstallation/v2 transport caches across calls.\n\nReturns an error if the config is invalid or the IAT exchange fails.\n\n```go\nfunc NewClient(ctx context.Context, cfg Config) (*http.Client, error)\n```\nNewClient returns an \\*http.Client whose RoundTripper authenticates every outgoing request as the given App installation using a cached IAT.\n\nThe first call mints a JWT, exchanges it for an IAT, and caches the IAT for ~50 minutes; subsequent calls reuse the cached IAT and refresh it transparently before expiry.\n\nReturns an error if the config is invalid (both PEM and PEMPath set, or neither set; AppID or InstallationID zero) or if the PEM cannot be parsed.\n\n## Types\n\n```go\ntype Config struct {\n\tAppID          int64\n\tInstallationID int64\n\tPEM            []byte // PEM content; mutually exclusive with PEMPath\n\tPEMPath        string // path to PEM file; mutually exclusive with PEM\n\tBaseURL        string // API base URL (defaults to https://api.github.com); used for testing with httptest\n}\n```\nConfig carries the inputs needed to authenticate as a GitHub App installation.\n\nAppID and InstallationID are public values (visible in the App settings page and the installation URL respectively) and are safe to commit. PEM (or PEMPath) is the long-lived secret and MUST come from a Kubernetes Secret mount, never from a checked-in file.\n\nExactly one of PEM or PEMPath must be non-empty; passing both is a configuration error.\n\n","path":"github.com/bborbe/maintainer/lib/githubapp","name":"githubapp","synopsis":"","isRedistributable":true}
