secrets

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package secrets resolves the GitHub token. A missing token is never fatal: GitHub-dependent features degrade to "unknown" rather than failing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KeychainHint

func KeychainHint(service string) string

KeychainHint returns the command that stores a token, for error messages and `flow doctor`.

Types

type Resolver

type Resolver struct {
	Runner flowexec.Runner
	// Getenv is os.Getenv in production; tests substitute their own.
	Getenv func(string) string
	// KeychainService is the macOS keychain service name to query.
	KeychainService string
	// ConfigToken is github.token from the config file.
	ConfigToken string
}

Resolver finds a GitHub token.

func (*Resolver) Token

func (r *Resolver) Token(ctx context.Context) (string, Source)

Token returns the first token found and where it came from.

type Source

type Source string

Source names where a token came from, for `flow doctor`. The token value itself is never logged or displayed.

const (
	SourceNone        Source = "none"
	SourceGitHubToken Source = "$GITHUB_TOKEN"
	SourceGHToken     Source = "$GH_TOKEN"
	SourceConfig      Source = "config github.token"
	SourceKeychain    Source = "macOS keychain"
)

The token resolution order, first hit wins. These are the names of the sources, never the values found in them.

Jump to

Keyboard shortcuts

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