sign

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 9 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 sign signs published OCI artifacts: keylessly (ambient OIDC — the CI workflow's identity — through Fulcio, with a public transparency log entry) or with a cloud KMS key (gcpkms://, awskms://, azurekms://). Signatures are stored as sigstore bundles attached via the OCI referrers API — never legacy .sig tags — the format policy engines' bundle rules and modern consumers verify.

Signing shells out to the cosign binary (>= v3) with a generated sigstore signing config, the only service channel that is not deprecated; KMS URI schemes are whatever that cosign build supports. A signer for tests can point at a local cosign keypair instead.

Ensurer is the verify-then-sign step mirror sync and build share: a reference that already verifies under the resolved signing config is left alone, so publishing stays idempotent across re-runs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArtifactSigner added in v0.12.0

type ArtifactSigner interface {
	Sign(ctx context.Context, ref string, recursive bool) error
}

ArtifactSigner signs one OCI artifact reference. *Signer satisfies it; tests inject key-file or recording signers.

type Ensurer added in v0.12.0

type Ensurer struct {
	// Verify checks one signature subject (the cosign-backed verifier in
	// production; key-based in tests).
	Verify func(context.Context, verify.Subject) error
	// NewSigner builds a signer for a resolved signing config.
	NewSigner func(*spec.Signing) (ArtifactSigner, error)
}

Ensurer is the verify-then-sign step every publisher runs after a push: a reference already carrying a valid signature for the resolved signing config is left alone, anything else is signed. Both seams are required.

func (Ensurer) Ensure added in v0.12.0

func (e Ensurer) Ensure(ctx context.Context, ref string, signing *spec.Signing, recursive bool) (bool, error)

Ensure signs ref unless it already carries a valid signature under signing, reporting whether a signature was created. recursive also signs a manifest list's children.

func (Ensurer) Sign added in v0.12.0

func (e Ensurer) Sign(ctx context.Context, ref string, signing *spec.Signing, recursive bool) error

Sign signs ref under signing unconditionally — for callers that already ran Valid themselves (to narrate, or to stop short on a dry run).

func (Ensurer) Valid added in v0.12.0

func (e Ensurer) Valid(ctx context.Context, ref string, signing *spec.Signing) bool

Valid reports whether ref (a digest reference) already carries a valid signature under signing.

type Signer

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

Signer signs OCI artifacts per one resolved signing config by shelling out to the cosign binary. KMS URI schemes (awskms:// gcpkms:// azurekms:// hashivault://) are whatever the installed cosign build supports — upstream release binaries include all of them.

func New

func New(signing *spec.Signing, runner ToolRunner) (*Signer, error)

New builds a signer for a resolved signing config.

func NewWithKeyFile

func NewWithKeyFile(keyPath string, password []byte, runner ToolRunner) *Signer

NewWithKeyFile builds a test signer over a local cosign keypair, offline (no transparency log, plain-HTTP registries allowed).

func (*Signer) Sign

func (s *Signer) Sign(ctx context.Context, ref string, recursive bool) error

Sign signs ref (a digest reference), attaching the signature as a sigstore bundle via the OCI referrers API. recursive also signs a manifest list's children.

type ToolRunner added in v0.11.0

type ToolRunner interface {
	// Run executes name with args and extra environment, returning stdout.
	Run(ctx context.Context, name string, args, env []string) (stdout []byte, err error)
	// Look reports whether the binary is available.
	Look(name string) bool
}

ToolRunner executes the cosign binary; a seam so tests can can its invocations. scan.ExecRunner satisfies it.

Jump to

Keyboard shortcuts

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