verify

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: Apache-2.0 Imports: 12 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 holds what `truestamp verify --remote` uses beside this CLI's own verifier: AskRemoteCtx posts a proof file's bytes to the Truestamp service and gives the label of the report it answers with, which `verify --remote` prints beside its own report and never as a row of it or a reason code.

This CLI's own verifier, the verification of SPEC.md section 10.2 that `truestamp verify` runs, is internal/verifier; nothing here takes part in it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AskRemoteCtx added in v0.17.0

func AskRemoteCtx(ctx context.Context, data []byte, opts RemoteOptions) (string, error)

AskRemoteCtx asks the Truestamp service to verify the proof file whose bytes are data, and returns the label of the report it answers with. It posts data exactly as given, never parsed or re-encoded, as the body of

POST {APIURL}/proof/raw/verify[?offline=true][&expected_hash=...]

whose 200 is the service's report of SPEC.md section 10.5 (Verdict and report). Only a 200 whose report carries one of that section's labels is a verdict. Any other answer is an error: a 429 the *jsonapi.APIError of the rate limit, a refusal naming a `meta.code` a *RemoteRejectionError, and every other status an error naming the status and the body. The request, its one retry of a rate limit included, waits for the larger of opts.HTTPTimeout and 75 seconds, and no answer within that is an error.

Types

type RemoteOptions

type RemoteOptions struct {
	APIURL string
	// Team is the team ID, sent as the tenant header.
	Team string
	// Offline asks for a run that reads nothing, `offline=true`.
	Offline bool
	// ExpectedHash, when not nil, is sent exactly as given as
	// `expected_hash`, the caller's hash for EXPECTED_HASH.
	ExpectedHash *string
	// HTTPTimeout is the configured http_timeout. The request waits for
	// the larger of it and remoteFloor.
	HTTPTimeout time.Duration
}

RemoteOptions configures one request for the Truestamp service's verdict. The credential is applied by the process-wide auth.Authorizer; only the tenant scoping is carried here.

The service's verifier is no part of this CLI's own verification, which never depends on it; --remote is an explicit "ask Truestamp too".

type RemoteRejectionError added in v0.13.0

type RemoteRejectionError struct {
	StatusCode int
	Code       string
	Detail     string
}

RemoteRejectionError is the service's refusal of a request: an error whose `meta.code` names why, such as a proof file it refuses before any check. Code is that code and Detail the error's detail.

func (*RemoteRejectionError) Error added in v0.13.0

func (e *RemoteRejectionError) Error() string

Jump to

Keyboard shortcuts

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