SDK reference · Verifiers

go.provenanceauth.com/verify (Go)

go.provenanceauth.com/verify (Go) in the Verifiers: 47 methods. Offline token checks for Go, with no API key, and the embed mint calls for your server.

Methods

AgentSignatureTagOf

provenanceverify.AgentSignatureTagOf(tag string) (AgentSignatureTag, bool)

AgentSignatureTagOf returns the tag entry a signature's tag names, and false for an unrecognized tag.

ParseSignatureParams

provenanceverify.ParseSignatureParams(base string) SignatureParams

ParseSignatureParams reads the parameters from a signature base's last line ("@signature-params": (...);created=…) or from a bare inner list.

CheckNetworkSignatureParams

provenanceverify.CheckNetworkSignatureParams(p SignatureParams, now int64) string

CheckNetworkSignatureParams returns the failing network rule as a reason, or "" when the parameters pass.

VerifyAgentSignature

provenanceverify.VerifyAgentSignature(base, signature []byte, alg string, jwk map[string]any) (bool, string)

VerifyAgentSignature checks the signature bytes over the base against a JWK (kty OKP/Ed25519 or RSA).

SignatureBytes

provenanceverify.SignatureBytes(header, label string) ([]byte, error)

SignatureBytes reads the bytes of one labelled member of a Signature header (sig1=:<base64>:).

Ap2Hash

provenanceverify.Ap2Hash(value string) string

Ap2Hash is base64url(SHA-256(value)): how AP2 and SD-JWT hash disclosures, presentations and Checkout JWTs.

VerifyAp2UserMandate

provenanceverify.VerifyAp2UserMandate(serialized string, issuers []Ap2Issuer, expected Ap2Expected, opts Ap2Options) Ap2Result

VerifyAp2UserMandate verifies an AP2 v0.2 mandate SD-JWT, or a delegate chain, against your issuers and cart.

VerifyAuthorityProof

provenanceverify.VerifyAuthorityProof(token string, jwks JWKS, expect AuthorityProofExpect, now int64, holder *MandateHolder) AuthorityProofResult

VerifyAuthorityProof checks an authority proof offline: signature (the issuer's JWKS), expiry, expect and the holder's key.

VerifyAuthorityProofOnline

provenanceverify.VerifyAuthorityProofOnline(token string, jwks JWKS, expect AuthorityProofExpect, now int64, holder *MandateHolder, status AuthorityProofStatus) AuthorityProofResult

VerifyAuthorityProofOnline is VerifyAuthorityProof after the online status check: only "active" holds; "used", "revoked" and "expired" fail, and an empty or unknown status is status_unavailable (a failed call never passes).

FetchAuthorityProofStatus

provenanceverify.FetchAuthorityProofStatus(apiBase, jti string) (AuthorityProofStatus, error)

FetchAuthorityProofStatus calls GET {apiBase}/v1/public/authority_proofs/{jti}/status.

CheckoutBinding

provenanceverify.CheckoutBinding(order map[string]any) (map[string]any, error)

CheckoutBinding normalizes a merchant's order record into the exact object a cart-bound intent token's payload_hash covers (a port of checkoutBinding in @provenanceauth/rails/checkout): binding v1, the rich cart (v2: variants, pictures, adjustments, fulfillment, return policy) and 's v3, the merchant's declared MCC and country (merchant.mcc, four digits; merchant.country, the ISO 3166-1 numeric code) and each line's service_period (start and end, a date or a date-time with an offset, kept exactly as given).

CheckoutBindingHash

provenanceverify.CheckoutBindingHash(order map[string]any) (string, error)

CheckoutBindingHash is the payload_hash a token bound to this order carries: sha256 (hex) of the canonical JSON of CheckoutBinding(order).

OfferHash

provenanceverify.OfferHash(payload map[string]any) (string, error)

OfferHash is sha256 (hex) of the offer payload's canonical JSON.

VerifyOffer

provenanceverify.VerifyOffer(offer string, keys []SellerKey, now int64, buyerAgentID string) OfferResult

VerifyOffer verifies a signed offer against the seller's registered keys (never a key inside the offer): the header, the key's status, the Ed25519 signature, expiry (now: unix seconds, 0 = wall clock), and aud when buyerAgentID is set.

VerifyDealAcceptance

provenanceverify.VerifyDealAcceptance(token string, offer any, jwks JWKS, seller string, rev *DealRevocations, now int64) AcceptanceResult

VerifyDealAcceptance is the seller's offline check of a buyer's acceptance token: our ES256 signature against the JWKS, expiry, deal.offer_hash equal to the offer's hash, the seller being the offer's issuer (or seller when set), aud, the revocations passed, and every person the offer (or the buyer) required having approved with the method, tier and terms asked for.

VerifyCounterparty

provenanceverify.VerifyCounterparty(apiBase, kid string) (map[string]any, error)

VerifyCounterparty calls GET /v1/public/counterparties/check?kid=… (keyless) and caches the answer for 5 minutes.

VerifyProfile

provenanceverify.VerifyProfile(profile map[string]any, jwks JWKS, now int64) string

VerifyProfile checks a decoded profile against a JWKS: the signature, its expiry, its subject and the body hash.

VerifySellerAgent

provenanceverify.VerifySellerAgent(profile map[string]any, agentID, kid string, jwks JWKS, origin string, now int64) SellerAgentResult

VerifySellerAgent is the impostor check: agentID sells for this business and signs with kid, according to the business's signed profile.

Discovery.Middleware

provenanceverify.Discovery.Middleware(next http.Handler) http.Handler

Middleware wraps next: http.ListenAndServe(":8080", (&Discovery{}).Middleware(mux)).

Embed.CreateToken

provenanceverify.Embed.CreateToken(ctx context.Context, p EmbedTokenParams) (EmbedToken, error)

CreateToken calls POST /v1/embed/tokens: a session of up to 15 minutes for one widget and one object.

provenanceverify.Embed.CreateLink(ctx context.Context, p EmbedLinkParams) (EmbedLink, error)

CreateLink calls POST /v1/embed/links: a link to the hosted page for a capture result, a checkout result or the request composer.

HolderThumbprint

provenanceverify.HolderThumbprint(crv, kty, x, y string) string

HolderThumbprint is the RFC 7638 SHA-256 thumbprint of a P-256 key, over {"crv","kty","x","y"}, base64url.

AccessTokenHash

provenanceverify.AccessTokenHash(token string) string

AccessTokenHash is ath: the base64url SHA-256 of the token a proof rides with.

HTUOf

provenanceverify.HTUOf(u string) string

HTUOf drops the query and the fragment.

HolderJWKProblem

provenanceverify.HolderJWKProblem(v any) string

HolderJWKProblem returns what is wrong with a holder key, or "" for a P-256 public JWK.

CheckHolderProof

provenanceverify.CheckHolderProof(proof string, in HolderProofCheck) HolderProofResult

CheckHolderProof checks a DPoP proof: shape, typ, ES256, the key in its header, the signature by that key, htm, htu, iat within the window, ath and nonce.

NeedFits

provenanceverify.NeedFits(a *MandateAuthority, need *MandateNeed) string

NeedFits returns the first limit need breaks, or "".

VerifyMandate

provenanceverify.VerifyMandate(token string, jwks JWKS, need *MandateNeed, now int64) MandateResult

VerifyMandate checks another agent's mandate token offline (now: unix seconds, 0 = wall clock).

VerifyMandateHolder

provenanceverify.VerifyMandateHolder(token string, jwks JWKS, need *MandateNeed, now int64, holder *MandateHolder) MandateResult

VerifyMandateHolder is VerifyMandate with who presented the grant (nil: nobody proved a key).

VerifyMandateOnline

provenanceverify.VerifyMandateOnline(token string, jwks JWKS, need *MandateNeed, now int64, holder *MandateHolder, status MandateStatus) MandateResult

VerifyMandateOnline is VerifyMandateHolder after an online status check: status is what FetchMandateStatus read for the grant (a failed call is status_unavailable, never this).

FetchMandateStatus

provenanceverify.FetchMandateStatus(apiBase, mandateID string) (MandateStatus, error)

FetchMandateStatus calls GET {apiBase}/v1/public/grants/{id}/status.

ParseSFDictionary

provenanceverify.ParseSFDictionary(s string) ([]SFDictEntry, error)

ParseSFDictionary parses an RFC 8941 dictionary.

ParseSFItem

provenanceverify.ParseSFItem(s string) (SFItem, error)

ParseSFItem parses an RFC 8941 item.

SerializeSFInnerList

provenanceverify.SerializeSFInnerList(l SFInnerList) string

SerializeSFInnerList serializes an inner list with its parameters.

RequestHeaders.Get

provenanceverify.RequestHeaders.Get(name string) (string, bool)

Get returns the combined value of a field, and false when the request doesn't carry it.

AuthorityOf

provenanceverify.AuthorityOf(u *url.URL) string

AuthorityOf is the @authority value: the lowercased host, with the port only when it isn't the scheme's default.

ComponentValue

provenanceverify.ComponentValue(method string, u *url.URL, rawURL string, headers RequestHeaders, c SFItem) (string, error)

ComponentValue derives one covered component's value from the request.

ParseSignatureInput

provenanceverify.ParseSignatureInput(header, label string) (SignatureInput, error)

ParseSignatureInput reads the member labelled label from a Signature-Input header (the first member when label is empty).

BuildSignatureBase

provenanceverify.BuildSignatureBase(method, rawURL string, headers RequestHeaders, covered SFInnerList) (string, error)

BuildSignatureBase builds the RFC 9421 signature base for the covered components, from the request.

VerifyRequestSignature

provenanceverify.VerifyRequestSignature(method, rawURL string, headers RequestHeaders, label string, jwk map[string]any, now int64) AgentSignatureCheck

VerifyRequestSignature builds the signature base from the request itself and checks the labelled signature against a JWK: the tag, the networks' parameter rules for a network tag, and the signature bytes.

VerifyTraceManifest

provenanceverify.VerifyTraceManifest(token string, jwks JWKS, graph any) TraceManifestResult

VerifyTraceManifest verifies a trace manifest (ES256 JWS, typ provenance-trace+jwt) against a JWKS, and, when graph is non-nil (a decoded JSON value), whether it matches the manifest's graph_hash or public_graph_hash.

UcpHashedCheckout

provenanceverify.UcpHashedCheckout(checkout map[string]any) map[string]any

UcpHashedCheckout is the checkout minus UcpHashExcluded (the members checkout_hash covers).

UcpCheckoutHash

provenanceverify.UcpCheckoutHash(checkout map[string]any) (string, error)

UcpCheckoutHash is checkout_hash: SHA-256 hex of the JCS form of the checkout minus UcpHashExcluded.

UcpBindingPayload

provenanceverify.UcpBindingPayload(checkout map[string]any, payee string) (map[string]any, error)

UcpBindingPayload is the object an intent token's payload_hash binds for this checkout.

UcpBindingHash

provenanceverify.UcpBindingHash(checkout map[string]any, payee string) (string, error)

UcpBindingHash is the payload_hash an intent token carries for this checkout.

VerifyIntentToken

provenanceverify.VerifyIntentToken(token string, jwks JWKS, now int64) Result

VerifyIntentToken verifies an ES256 intent token against a JWKS (authenticity + expiry only).

FetchJWKS

provenanceverify.FetchJWKS(baseURL string) (JWKS, error)

FetchJWKS fetches the issuer's JWKS document.

Was this page helpful? Send us feedback

LLM? Read llms.txt.