# 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](https://provenanceauth.com/docs/sdks/verify/go/agent-signature-tag-of.md)

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

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

### [ParseSignatureParams](https://provenanceauth.com/docs/sdks/verify/go/parse-signature-params.md)

```ts
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](https://provenanceauth.com/docs/sdks/verify/go/check-network-signature-params.md)

```ts
provenanceverify.CheckNetworkSignatureParams(p SignatureParams, now int64) string
```

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

### [VerifyAgentSignature](https://provenanceauth.com/docs/sdks/verify/go/verify-agent-signature.md)

```ts
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](https://provenanceauth.com/docs/sdks/verify/go/signature-bytes.md)

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

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

### [Ap2Hash](https://provenanceauth.com/docs/sdks/verify/go/ap2-hash.md)

```ts
provenanceverify.Ap2Hash(value string) string
```

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

### [VerifyAp2UserMandate](https://provenanceauth.com/docs/sdks/verify/go/verify-ap2-user-mandate.md)

```ts
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](https://provenanceauth.com/docs/sdks/verify/go/verify-authority-proof.md)

```ts
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](https://provenanceauth.com/docs/sdks/verify/go/verify-authority-proof-online.md)

```ts
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](https://provenanceauth.com/docs/sdks/verify/go/fetch-authority-proof-status.md)

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

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

### [CheckoutBinding](https://provenanceauth.com/docs/sdks/verify/go/checkout-binding.md)

```ts
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](https://provenanceauth.com/docs/sdks/verify/go/checkout-binding-hash.md)

```ts
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](https://provenanceauth.com/docs/sdks/verify/go/offer-hash.md)

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

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

### [VerifyOffer](https://provenanceauth.com/docs/sdks/verify/go/verify-offer.md)

```ts
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](https://provenanceauth.com/docs/sdks/verify/go/verify-deal-acceptance.md)

```ts
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](https://provenanceauth.com/docs/sdks/verify/go/verify-counterparty.md)

```ts
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](https://provenanceauth.com/docs/sdks/verify/go/verify-profile.md)

```ts
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](https://provenanceauth.com/docs/sdks/verify/go/verify-seller-agent.md)

```ts
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](https://provenanceauth.com/docs/sdks/verify/go/discovery-middleware.md)

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

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

### [Embed.CreateToken](https://provenanceauth.com/docs/sdks/verify/go/embed-create-token.md)

```ts
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.

### [Embed.CreateLink](https://provenanceauth.com/docs/sdks/verify/go/embed-create-link.md)

```ts
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](https://provenanceauth.com/docs/sdks/verify/go/holder-thumbprint.md)

```ts
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](https://provenanceauth.com/docs/sdks/verify/go/access-token-hash.md)

```ts
provenanceverify.AccessTokenHash(token string) string
```

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

### [HTUOf](https://provenanceauth.com/docs/sdks/verify/go/htuof.md)

```ts
provenanceverify.HTUOf(u string) string
```

HTUOf drops the query and the fragment.

### [HolderJWKProblem](https://provenanceauth.com/docs/sdks/verify/go/holder-jwkproblem.md)

```ts
provenanceverify.HolderJWKProblem(v any) string
```

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

### [CheckHolderProof](https://provenanceauth.com/docs/sdks/verify/go/check-holder-proof.md)

```ts
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](https://provenanceauth.com/docs/sdks/verify/go/need-fits.md)

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

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

### [VerifyMandate](https://provenanceauth.com/docs/sdks/verify/go/verify-mandate.md)

```ts
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](https://provenanceauth.com/docs/sdks/verify/go/verify-mandate-holder.md)

```ts
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](https://provenanceauth.com/docs/sdks/verify/go/verify-mandate-online.md)

```ts
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](https://provenanceauth.com/docs/sdks/verify/go/fetch-mandate-status.md)

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

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

### [ParseSFDictionary](https://provenanceauth.com/docs/sdks/verify/go/parse-sfdictionary.md)

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

ParseSFDictionary parses an RFC 8941 dictionary.

### [ParseSFItem](https://provenanceauth.com/docs/sdks/verify/go/parse-sfitem.md)

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

ParseSFItem parses an RFC 8941 item.

### [SerializeSFInnerList](https://provenanceauth.com/docs/sdks/verify/go/serialize-sfinner-list.md)

```ts
provenanceverify.SerializeSFInnerList(l SFInnerList) string
```

SerializeSFInnerList serializes an inner list with its parameters.

### [RequestHeaders.Get](https://provenanceauth.com/docs/sdks/verify/go/request-headers-get.md)

```ts
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](https://provenanceauth.com/docs/sdks/verify/go/authority-of.md)

```ts
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](https://provenanceauth.com/docs/sdks/verify/go/component-value.md)

```ts
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](https://provenanceauth.com/docs/sdks/verify/go/parse-signature-input.md)

```ts
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](https://provenanceauth.com/docs/sdks/verify/go/build-signature-base.md)

```ts
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](https://provenanceauth.com/docs/sdks/verify/go/verify-request-signature.md)

```ts
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](https://provenanceauth.com/docs/sdks/verify/go/verify-trace-manifest.md)

```ts
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](https://provenanceauth.com/docs/sdks/verify/go/ucp-hashed-checkout.md)

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

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

### [UcpCheckoutHash](https://provenanceauth.com/docs/sdks/verify/go/ucp-checkout-hash.md)

```ts
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](https://provenanceauth.com/docs/sdks/verify/go/ucp-binding-payload.md)

```ts
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](https://provenanceauth.com/docs/sdks/verify/go/ucp-binding-hash.md)

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

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

### [VerifyIntentToken](https://provenanceauth.com/docs/sdks/verify/go/verify-intent-token.md)

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

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

### [FetchJWKS](https://provenanceauth.com/docs/sdks/verify/go/fetch-jwks.md)

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

FetchJWKS fetches the issuer's JWKS document.
