Usage
NodeJS SDK for Reclaim Protocol
Quickstart
We will be creating two endpoints
- Start Verification
- Process Verification
Recommended flow
The two endpoints are one journey. Here's the shape end-to-end:
- Backend — create the request.
ReclaimProofRequest.init(...)→ configure (callback, context) → export the whole config withtoJsonString()and send it to your frontend. - Frontend — launch verification. Import request with
ReclaimProofRequest.fromJsonString(...), thentriggerReclaimFlow()(auto-picks extension/portal/app) if you want verifications from your website. If your frontend is a native mobile app, using an in-app SDK, feed the same JSON config to itsstartVerificationFromJsoninstead. - Receive results — pick one:
- On the client via
startSession({ onSuccess, onError })— simplest, good for demos. - On your backend via
setAppCallbackUrl(...)— recommended for production, since proofs must be verified server-side anyway. This must be done before sending request to frontend.
- On the client via
- Backend — verify.
verifyProof(proofs, ...)→ run your business logic.
Import the library
Part 1: Start Verification Endpoint
Init
- You can get the
RECLAIMPROTOCOL_APP_IDandRECLAIMPROTOCOL_APP_SECRETusing this guide - The
PROVIDER_IDis the proof you want the user to generate. You can see all the available providers here. If you are just testing the flow, you can use the provider idff4d7afe-4b78-4795-9429-d20df2deaad7.
Success Callback
This is the endpoint to which the proofs will be submitted after the verification - this is where you will process the verification. We will define this endpoint in the next section.
[!TIP] Recommended for production. Once
setAppCallbackUrlis set, proofs are delivered directly to your backend, so you can verify them server-side without trusting the client. When a callback URL is set, the frontendonSuccessfires with an empty array[](the proofs went to your backend, not the browser). Notify the frontend of completion over WebSocket/SSE/polling once your backend has received and verified the proofs. You can also setsetCancelCallbackUrl(...)to be told when the user cancels.
Set Context
You can set context to the proof request that helps identify the request when you receive it back in the callback once the proof is generated.
address: this is usually a unique identifier for the user. This could be an email address, a wallet address, or just a session id generated on your system. Set the variable you'd need to identify the user in the callback endpoint, when the proof is sent to your backend.message: this is an open field where you can add any other information that you want passed around from the build request to the callback endpoint. You can stringify jsons here for convenience.
Both context address and context message are tamper resistant. Even if the user tries to edit one byte, the proof verification will fail.
Open verification
After configuring your verification request in ReclaimProofRequest object on your NodeJs backend, you can export entire config as a JSON string and send it to your frontend.
This can be used to create a ReclaimProofRequest using same SDK on frontend where you can trigger a web-based verification or you can use this config to start an in-app verification journey using our in-app SDK.
Option A: Web Frontend Web verification journey
To continue on web frontend, with @reclaimprotocol/js-sdk in your frontend dependencies, you have to import reclaim's proof request json string to make ReclaimProofRequest on frontend
In SDK, ReclaimProofRequest provides a triggerReclaimFlow() method that automatically handles the verification process for web-based verification across different platforms and devices. This method intelligently chooses the best verification method based on the user's environment.
How to use triggerReclaimFlow()
The triggerReclaimFlow() method supports two verification modes via verificationMode:
'portal'(default): Opens a new reclaim web page for remote browser verification. Opens reclaim web page in a new tab by default, or embeds reclaim web page in an iframe whentargetis provided.'app': Opens Reclaim's Verifier app to do verification on client mobile device.
The method returns a FlowHandle that lets you close the flow programmatically:
- Portal flow (default) — opens in new tab
- Embedded — portal loads inside a DOM element as an iframe
- Verifier app flow
[!TIP] Strongly recommended: If you are NOT using portals or in app sdk, enable
canUseDeferredDeepLinksFlowwhen starting verification on the web frontend. Using this prefers the use of deferred deep links. This will be enabled by default in future updates.
Receiving proofs on the client
For simple cases you can receive the generated proofs directly in the browser by calling startSession(). It launches the flow and polls until proofs are generated (or an error occurs):
You can also pass richer options when creating the request on init, for example:
[!TIP] Receiving proofs on the client is convenient, but for production you should route proofs to your backend with
setAppCallbackUrl(...)and verify them there. See Success Callback.
Option B: In App Verification Flow
If you have an app, you can integrate one of reclaim's in-app SDK for embedding reclaim's entire verification experience in your native app.
This is available for Android, iOS, React Native, Flutter & Capacitor. To learn more, go to InApp Integration docs.
You can reuse the same toJsonString() config produced on your backend: pass it to the in-app SDK's startVerificationFromJson to launch the native verification experience — no need to re-build the request on the client.
You can follow start verification documentation for each platform to learn more about integrating with them. For example, React Native.
Store the Provider Version
- Store
(providerId, providerVersion)corresponding to this user's uuid that you stored inaddress. You will need this providerVersion
More options
Part 2: Process Verification endpoint
Be sure to expose this endpoint over the public internet. If testing locally, use Ngrok
Replay protection
verifyProof is stateless — it confirms a proof is cryptographically valid, but it cannot know whether you've seen that proof before or whether it belongs to a session you actually started. For any flow where replay or tampering matters, the caller is responsible for:
- Match the session — verify the proof's
sessionId(from the parsedcontext, see Continue Business Logic) matches a session your backend initiated for this user. - Reject duplicates — persist accepted
sessionIds and refuse a proof whosesessionIdyou've already accepted. - Require hardware attestation — pass
teeAttestation: { appSecret }toverifyProof(see Verify TEE Attestation) so tampered or replayed proofs fail verification.
Verify Proofs
The easiest way is to use getProviderVersion() which returns the provider ID and exact version used in the session — pass it directly as the config:
Or, by manually providing the provider details:
Or, with a known hash:
You can get the provider version:
- [ Recommended ] Storing the provider version when initiating the verification.
- You can also hardcode the expected provider version by picking the latest version from the developer tool.
Continue Business Logic
context.address&context.message: Same asaddressandmessageset in Set Context. Use this to map user to verification.extractedParameters: JSON object of all the data that has been extracted and verified. You can see the structure of each provider's response in the Provider Explorer.
For a full, field-by-field reference of the verifyProof result and the raw proof object (including claimData, the parsed context, signatures, witnesses and TEE attestation), see the Anatomy of messages data dictionary.