ghsecret

package
v0.11.4 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 8 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 ghsecret turns credential Secrets referenced by Forge and Integration resources into GitHub clients. One Secret shape serves both kinds: a PAT under "token" (dev), or a GitHub App under "appID" + "privateKey" (production), with "webhookSecret" carrying the receiver HMAC secret where relevant and "proxyUsername" + "proxyPassword" carrying the forward proxy's basic-auth credentials when the resource sets spec.proxy. Apps are memoized per Secret resourceVersion so rotation transparently rebuilds while steady state costs nothing.

Index

Constants

View Source
const (
	// KeyToken is a PAT — the dev fallback; production uses App auth.
	KeyToken = "token"
	// KeyAppID is the GitHub App ID (decimal string).
	KeyAppID = "appID"
	// KeyPrivateKey is the App's PEM-encoded RSA private key.
	KeyPrivateKey = "privateKey"
	// KeyWebhookSecret is the receiver HMAC secret.
	KeyWebhookSecret = "webhookSecret"
	// KeyProxyUsername is the forward proxy's basic-auth username.
	KeyProxyUsername = "proxyUsername"
	// KeyProxyPassword is the forward proxy's basic-auth password.
	KeyProxyPassword = "proxyPassword"
)

Secret keys.

Variables

This section is empty.

Functions

func ProxyURL added in v0.11.2

func ProxyURL(secret *corev1.Secret, rawURL string) (string, error)

ProxyURL composes the effective proxy URL: the resource's spec proxy URL with the secret's basic-auth credentials attached, when present. The CRD pattern rejects userinfo in the spec URL, so credentials never live anywhere but the Secret. rawURL "" means no proxy and returns "".

func Token

func Token(secret *corev1.Secret) (string, bool)

Token returns the PAT held in the secret, if any.

Types

type Apps

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

Apps memoizes ghclient.App instances per credential Secret.

func NewApps

func NewApps() *Apps

NewApps builds an empty memo.

func (*Apps) FromSecret

func (a *Apps) FromSecret(secret *corev1.Secret, baseURL, proxy string) (*ghclient.App, error)

FromSecret builds (or returns the memoized) App from the secret's appID/privateKey keys. baseURL points at GHES; empty means github.com. proxy is the referencing resource's raw spec proxy URL ("" = none); its basic-auth credentials are read from the secret's proxy keys.

func (*Apps) Validate

func (a *Apps) Validate(secret *corev1.Secret, baseURL, proxy string) error

Validate checks the secret is usable: a non-empty PAT or a parseable App credential, with a parseable composed proxy URL either way.

Jump to

Keyboard shortcuts

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