catalogueapp

package
v1.63.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package catalogueapp is what creating a catalogue App leaves behind: the App's record, and its key.

One Secret holds every catalogue App, each under its catalogue id. An installed App is three keys — `<id>.github_app_id`, `<id>.github_app_installation_id`, `<id>.github_app_private_key` — beside its record, `<id>.record.json`, so a deployment can copy one App anywhere (into a secret manager with an External Secrets PushSecret, for one) by naming keys, without reshaping a document, and a restore of the Secret alone brings every App back.

An App created and not yet installed keeps its key under another name, `<id>.pending_private_key`, so the three keys never exist without an installation: a copy made in between never hands anybody an App that cannot mint a token.

The service reads the key to ask GitHub what the App and its installation hold now, and to uninstall it on Disconnect. A token exchange reads it by id, with the installation beside it.

Index

Constants

View Source
const (
	AppIDProperty          = "github_app_id"
	InstallationIDProperty = "github_app_installation_id"
	PrivateKeyProperty     = "github_app_private_key"
	RecordProperty         = "record.json"
	// PendingKeyProperty holds the key of an App not installed yet.
	PendingKeyProperty = "pending_private_key"
)

The property names of one App.

View Source
const Version = 1

Version is the record version this build writes and reads.

Variables

View Source
var ErrVersion = errors.New("catalogueapp: unsupported record version")

ErrVersion is a record of a version this build does not read.

Functions

func Encode

func Encode(r Record, privateKey string) (map[string][]byte, error)

Encode writes one App: its record, and its three properties once it is installed, or its pending key until then. Keys lists every key an App can have, so a writer removes those first.

func Key

func Key(id, property string) string

Key is the key one property of one App is kept under: `renovate.github_app_id`.

func Keys

func Keys(id string) []string

Keys are every key one App can be kept under.

func OfRecordKey

func OfRecordKey(key string) (string, bool)

OfRecordKey reads the id back out of a record key.

func PrivateKeyOf

func PrivateKeyOf(data map[string][]byte, id string) (string, bool)

PrivateKeyOf reads one App's key from the Secret's data, installed or pending.

func RecordKey

func RecordKey(id string) string

RecordKey is the key one App's record is kept under.

func SecretName

func SecretName(release string) string

SecretName is the object holding every catalogue App.

Types

type Record

type Record struct {
	Version int    `json:"version"`
	ID      string `json:"id"`
	Org     string `json:"org"`
	AppID   int64  `json:"app_id"`
	AppSlug string `json:"app_slug"`
	// InstallationID is zero between Create and Install.
	InstallationID int64     `json:"installation_id,omitempty"`
	HTMLURL        string    `json:"html_url,omitempty"`
	ConnectedAt    time.Time `json:"connected_at"`
	ConnectedBy    string    `json:"connected_by"`
}

Record is one catalogue App, as the console shows it. Never the key.

func DecodeRecord

func DecodeRecord(raw []byte) (Record, error)

DecodeRecord reads a record.

func (Record) Installed

func (r Record) Installed() bool

Installed reports whether a token can be minted for it yet.

Jump to

Keyboard shortcuts

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