Usage
The Reclaim Protocol Proofs are compatible with blockchain applications.
Import Reclaim Client
Initialize Reclaim Client
Add Public/Private headers
Headers are a standard part of any fetch request.
When a proof is created, it is created for what was the request and what was its corresponding response.
The request consists of headers and body.
A typical fetch request looks like so :
In this request, there might be sensitive information like api keys or username & password that should not be revealed as part of the proof.
For that purpose, you should construct two separate request objects publicOptions and privateOptions.
As the names suggest, public options will be revealed whereas private options will be redacted. We recommend keeping as little information in privateOptions as possible - to maintain the sanctity of the verification.
Example,
Reading the response
Troubleshooting : chunked responses
If the server returns chunked responses, you will need to decode the chunked response before parsing.
Example
You can use LLM x402 project as a sample reference, which verifies that the api response actually came from the correct LLM.
Advance Options
Using Response Match and Redactions
You can also use responseMatches and responseRedactions to match and redact the response. This is useful when you want to verify the response against a particular value and/or redact some part of the response.
Verify the proofs and transform proof for onchain
Verify the proofs
Install @reclaimprotocol/js-sdk
Import the Reclaim class from the js-sdk
Use Reclaim.verifySignedProof(proof)
You must send the proofObject and not the verifiedResponse to the verifier for them to be able to verify.
Transform proof for onchain
Transforms proof data into a format suitable for on-chain transactions, you need to use it before sending the proof to the blockchain.
Use Reclaim.transformForOnchain(proof) from the js-sdk to transform the proof for onchain.
Use TEE mode (Beta)
You can use our new architecture for better security and performance. You can learn more about this on this podcast or on this whitepaper
Add the useTee flag to your publicOptions