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
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
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