All three SDKs now send X-Attesto-Sdk (attesto-<lang>/<version>) and X-Attesto-Protocol (ATTESTO-PROOFSTREAM-001/0.1-alpha) on every request. A new backend ProtocolVersionMiddleware logs both headers (operators can see the SDK/protocol mix in traffic) and, when the protocol header is present on a /v2 request and names a different protocol identifier or major version, answers 426 Upgrade Required with a structured body (error/supported/received/hint). Absent or unparseable headers change nothing — old clients and curl stay fully compatible (test-asserted, including /v1 never being handshake-gated). SDKs surface the 426 as a typed error: Python AttestoProtocolMismatch, TypeScript AttestoProtocolMismatch, Go IsProtocolMismatch(err) over *APIError (Go-idiomatic). Tests cover the mismatch rules, the 426 mapping, and that the handshake headers are actually sent. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
12 lines
413 B
Go
12 lines
413 B
Go
package attesto
|
|
|
|
const (
|
|
SDKVersion = "0.2.0"
|
|
DefaultBaseURL = "https://verify.attesto.eu"
|
|
ProofstreamProtocol = "ATTESTO-PROOFSTREAM-001"
|
|
ProtocolVersionAlpha = "0.1-alpha"
|
|
// ProtocolHandshake is sent as X-Attesto-Protocol on every request; the
|
|
// backend answers 426 when it speaks a different protocol generation.
|
|
ProtocolHandshake = ProofstreamProtocol + "/" + ProtocolVersionAlpha
|
|
)
|