✨Works out of the box guarantee. If you face any issue at all, hit us up on Telegram and we will write the integration for you.
logoReclaim Protocol Docs
Javascript SDK

Preparing the proof request

Create a request for a proof generation on the backend

Quickstart

This is the simplest version of creating a proof request.

Import the library

import { ReclaimProofRequest } from '@reclaimprotocol/js-sdk';

Setup a request on the backend

const reclaimProofRequest = await ReclaimProofRequest.init(
    'APP_ID',
    'APP_SECRET',
    'PROVIDER_ID'
)

Send back the proof request object to the frontend

const proofRequestObject = reclaimProofRequest.toJsonString();

Sample implementation in Next.js

import { NextResponse } from 'next/server';
import { ReclaimProofRequest } from '@reclaimprotocol/js-sdk';
 
export async function GET(request) {
  let providerId = 'example';
 
  // add logic to choose provider id here based on request
 
  // Initialize SDK with server-side environment variables (secure)
  const reclaimProofRequest = await ReclaimProofRequest.init(
      process.env.RECLAIM_APP_ID,
      process.env.RECLAIM_APP_SECRET,
      providerId,
  );
 
  // Convert to JSON string (safe for frontend)
  const proofRequestObject = reclaimProofRequest.toJsonString();
 
  return NextResponse.json({
      success: true,
      proofRequest: proofRequestObject
  });
}

Advance Options

Forcing Remote Browser use

Remote Browser use is available only for users on a premium enterprise plan. Please contact support for more details.

proofRequestOptions = {
    ..., //other options, if any
    useAppClip: false,
    customSharePageUrl: 'CONTACT_SUPPORT_FOR_URL'
}
const proofRequest = await ReclaimProofRequest.init(appId, appSecret, providerId, proofRequestOptions);

See reference implementation

Set Context

You can set context to the proof request that helps identify the request when you receive it back in the callback.

reclaimProofRequest.setContext('address', 'message')
  • address : this is usually a unique identifier for the user. This could be an email address, a wallet address, or just a session id
  • 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.

Set Parameters

If you already know what the value of the extracted parameter is supposed to be, you can set that using setParams. For example, if you know that the user's name before hand - and you want them to prove something from a website and you need the name to match exactly, you should use set the name in the params.

If the extracted parameter doesn't match the set parameter, the proof generation will fail.

reclaimProofRequest.setParams({ 
    name : "John Doe"
})

Set Callback

reclaimProofRequest.setAppCallbackUrl(url, useJson)

Set a backend callback URL where Reclaim Protocol will POST proofs directly after verification. This enables secure backend proof processing without relying on frontend to upload the proof.

If useJson is set to true, it will send the proof as a raw JSON. Else, the POST body will contain the Proof JSON urlencoded.

On this page