receipts.verify
Check a receipt's signature and that its digest is the digest of its bytes.
Details
- Endpoint
- POST /v1/receipts/verify
- Credits
- 1
- Rate class
- Light. Counts against your light requests per second.
Pass a receipt id, or the receipt object with its signature (as tx.receipt returned it). Checks the ed25519 signature against tide's published key (or `public_key`), recomputes the receipt id, and checks that the digest is the blake2b digest of the bytes in the receipt. You can do the same offline: see https://tide.ad/docs/receipts.
Parameters
| Name | Type | Description |
|---|---|---|
| id | string | Receipt id. |
| receipt | object or string | The receipt (or the whole tx.receipt answer). |
| signature | object | The signature object. |
| public_key | string | A public key (base64) to check against instead of tide's. |
Request
Send your key in the x-api-key header, or leave it out to use the keyless tier.
curl
curl -X POST "https://api.tide.ad/v1/receipts/verify" \
-H "x-api-key: YOUR_API_KEY" \
-H "content-type: application/json" \
-d '{
"id": "8e56072be767fadb73a18169d8dcfc3c"
}'TypeScript
const res = await fetch("https://api.tide.ad/v1/receipts/verify", {
method: "POST",
headers: {
"x-api-key": process.env.TIDE_API_KEY!,
"content-type": "application/json",
},
body: JSON.stringify({
"id": "8e56072be767fadb73a18169d8dcfc3c"
}),
});
const data = await res.json();Response
JSON
{
"valid": true,
"signature_valid": true,
"signed_by_tide": true,
"digest_matches_bytes": true,
"id": "8e56072be767fadb73a18169d8dcfc3c",
"text": "Signed by tide's attestation key, and the digest is the blake2b digest of the bytes in the receipt.",
"digest": "CRDtuCsNNkMdAZmrfRhPNuNjztCwmpWhcrn3EwBqJGn3",
"verdict": "pass",
"url": "https://tide.ad/proof/8e56072be767fadb73a18169d8dcfc3c"
}