testcred

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: MIT Imports: 4 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 testcred hands tests the tokens, passwords and passphrases they need, generated when the test binary runs rather than written in the source.

A secret scanner cannot tell a test value from a real one and does not try: it matches on shape (a ghp_ prefix, a long mixed string) and on name (any literal under something called password, secret or token). Each such literal is an incident somebody has to open and close by hand. A value that only exists at run time gives the scanner nothing to read.

Values are memoised per purpose, so every assertion in one run sees the same value for the same purpose, and distinct purposes get distinct values. Name each purpose with one plain lowercase word: a scanner reads a compound string in that position as the secret itself.

Only tests import this package, so it is never linked into the binary.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Secret

func Secret(purpose string) string

Secret returns an opaque value for purpose: 32 lowercase hex characters, the same for the whole run.

func Token

func Token(prefix, purpose string) string

Token returns Secret(purpose) behind a provider prefix, e.g. Token("ghp", "ci") is "ghp_<hex>", for code that recognises a token by its prefix.

Types

This section is empty.

Jump to

Keyboard shortcuts

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