JWT signature and claims verification

$0.005 USDC per call · Developer and security · POST /api/v1/jwt-verify · Id jwt-verify

Verifies a JWS-compact JWT: signature over `base64url(header).base64url(payload)` with Web Crypto under the exact algorithm in the token's `alg` header (HS256/384/512, RS256/384/512, PS256/384/512, ES256/384/512, EdDSA). Refuses 'none' unconditionally and rejects any alg not in the caller's allowedAlgorithms. Validates exp/nbf with a configurable clock-skew tolerance (default 60s), iss equality, and aud membership. Keys are supplied as a raw HMAC secret, a PEM SubjectPublicKeyInfo, or a JWK — no key fetching (no JWKS over the network).

What you get

A JWT library that trusts the token's own alg is the classic confused-deputy bug. This is the small reference that only trusts the caller's allow-list.

Call it

Send the JSON body below to https://agents.writerslogic.com/api/v1/jwt-verify. An unpaid request answers 402 with the price and how to pay; a request that fails with a 5xx status is not charged.

curl -i -X POST https://agents.writerslogic.com/api/v1/jwt-verify \
  -H 'content-type: application/json' \
  -d '{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0IiwiaWF0IjoxNzAwMDAwMDAwfQ.sig","key":{"kind":"hmac-secret","value":"your-256-bit-secret"},"allowedAlgorithms":["HS256"]}'

Input

FieldTypeRequiredDescription
tokenstring; length 0..16000yesThe JWS-compact JWT: three base64url parts joined by '.'.
keyobjectyes
allowedAlgorithmsarray<string>; max 20 itemsyesAlgorithms the caller accepts; verification fails if the header's alg is not here.
issuerstring; length 0..200noRequire payload.iss to equal this.
audiencestring; length 0..200noRequire payload.aud to include this.
toleranceSecondsintegernoClock-skew tolerance for exp/nbf. Default 60s.
nowIsostring; length 0..40noOverride 'now' for deterministic tests.

Example request body

{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0IiwiaWF0IjoxNzAwMDAwMDAwfQ.sig",
  "key": {
    "kind": "hmac-secret",
    "value": "your-256-bit-secret"
  },
  "allowedAlgorithms": [
    "HS256"
  ]
}

Result

The response is { "data": ..., "_provenance": ... }. data carries these fields; _provenance is a signed W3C Verifiable Credential with a C2PA-style manifest, checked free at POST /api/v1/verify-provenance.

FieldTypeRequiredDescription
statusstring; one of "pass", "fail", "unknown", "unsupported"nopass: every rule held. fail: a rule was violated (see witnesses). unknown: the input lacks the evidence to decide. unsupported: outside what this engine covers. Missing evidence is never a pass.
validbooleanno
headerobjectno
payloadobjectno
algorithmstringno
expiresAtstringno
notBeforestringno
witnessesarray<object>no
versionsobjectnoEvery semantic dependency of this answer (engine, tables and their as-of dates, tokenizer, calendar, rounding profile).
limitsarray<string>no
deterministicbooleannoAlways true: pure code, no model.

Pay and connect

Available through: x402 (USDC on Base), MCP. MCP clients reach it through the code-preflight-kit package.

Machine-readable