Documentation
¶
Overview ¶
Package githubapp 提供 GitHub App 凭证能力:用 App 的 RSA 私钥签发 RS256 JWT(第一层凭证),以及用该 JWT 换取 installation access token(第二层 凭证,实际调 GitHub API 用)。独立成包是为了让 git-sync-core、git-ferry 等下游共享同一实现,删掉各自手写的重复代码。
Index ¶
Constants ¶
View Source
const DefaultAPIBase = "https://api.github.com"
DefaultAPIBase 是 GitHub 公有 API 地址;GitHub Enterprise Server 传各自 的域名(如 https://ghe.example.com/api/v3)。
Variables ¶
This section is empty.
Functions ¶
func FetchInstallationToken ¶
func FetchInstallationToken(ctx context.Context, apiBase string, appID, installationID int64, privateKeyPEM string) (string, error)
FetchInstallationToken 用 JWT 换 installation access token(有效期约 1h)。 apiBase 为空时取 DefaultAPIBase,尾部斜杠会被去掉。
请求走 transport.Client 而不是裸 http.Client,以复用平台统一的重试/日志/ 钩子链路;access_tokens 是不幂等的写操作,默认重试配置只允许"请求根本 没发出去"(DNS/dial 失败)级别的安全重试,不会重放已到达服务端的 POST。
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.