verify

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: Apache-2.0 Imports: 22 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 verify is the fifth pipeline stage: it checks keys with read-only, registry-declared requests through netx and sets status, status_reason and verify_evidence. It never calls a generation, revoke or rotate endpoint.

Index

Constants

View Source
const (
	// ReasonSuppressed: the finding is suppressed, so it is not verified.
	ReasonSuppressed = "suppressed"
	// ReasonVerificationOff: verification is not available or turned off.
	ReasonVerificationOff = "verification_off"
	// ReasonUnpaired: the primary part of a multi-part credential was found without
	// its partners, so it cannot be verified.
	ReasonUnpaired = "unpaired"
	// ReasonNoVerifySpec: the provider or pattern has no verify block.
	ReasonNoVerifySpec = "no_verify_spec"
	// ReasonUnexpectedResponse: the response status matched neither live_when nor
	// dead_when, or the request could not be built from the registry block.
	ReasonUnexpectedResponse = "unexpected_response"
	// ReasonRedirect: the provider answered with a redirect, which is never followed.
	ReasonRedirect = "redirect"
	// ReasonTimeout: the call did not finish within the verify timeout.
	ReasonTimeout = "timeout"
	// ReasonNetworkError: any other transport failure.
	ReasonNetworkError = "network_error"
	// ReasonRateLimited: the provider kept answering 429 after every retry.
	ReasonRateLimited = "rate_limited"
)

Status reasons set by the verify adapters.

View Source
const Live = "live"

Live is the name of the adapter that verifies keys with read-only calls.

View Source
const Off = "off"

Off is the name of the adapter used while verification is off.

Variables

This section is empty.

Functions

func Describe

func Describe(p registry.Provider) (host, note string, ok bool)

Describe returns the host and a short note that tell a reader how the provider's keys are checked, for Report providers.<id>.verify_host and verify_note. It uses the provider verify block, else the first pattern block, and reports ok false for a provider without one. A templated host is shown with a "*" label (for example "*.openai.azure.com"). The note is "read-only <METHOD> call to <host> (<words of the last URL path segment>)".

func Register

func Register(name string, f Factory)

Register adds a verify adapter. Adapters call it from init().

Types

type Factory

type Factory func(Options) (Verifier, error)

Factory builds a Verifier.

func Lookup

func Lookup(name string) (Factory, bool)

Lookup returns the verify adapter registered under name.

type Options

type Options struct {
	// Registry supplies the verify blocks (nil: the embedded registry).
	Registry *registry.Registry
	// Network configures the netx client of purpose verify (proxy, CA bundle and the
	// DialAddrs test hook). Its Timeout is replaced by Timeout.
	Network netx.Config
	// AllowHosts are extra allowlist entries; entries that are not valid netx host
	// patterns are skipped. Requests are still built only from the registry.
	AllowHosts []string
	// Timeout bounds one verify call (default 10s).
	Timeout time.Duration
	// MaxConcurrency caps concurrent verify calls (default 8).
	MaxConcurrency int
	// Clock replaces time.Now for rate limiting and SigV4 signing (tests).
	Clock func() time.Time
	// Sleeper replaces the context-aware sleep used by backoff and rate limiting
	// (tests). It returns the context error when ctx ends first.
	Sleeper func(ctx context.Context, d time.Duration) error
}

Options configures a verifier. The zero value is valid for the off adapter; the live adapter needs only Registry (nil means the embedded snapshot).

type Verifier

type Verifier interface {
	Verify(ctx context.Context, c candidate.Candidate) model.Finding
}

Verifier is the verify stage interface. Verify turns a Candidate into a Finding: it drops the key and sets only the status fields (Status, StatusReason, Verified and VerifyEvidence). Suppressed candidates are never verified (AD-8).

Jump to

Keyboard shortcuts

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