Web SDK
This guide provides advanced options for the Reclaim Protocol SDK across multiple platforms. These options allow you to customize and enhance your integration for specific use cases.
Advanced Options
Reclaim SDKs provide a lot of flexibility to customize the verification process.
init()
The init
method allows you to pass additional options to customize the SDK's behavior.
useAppClip
(Default:true
): This option enables the use of AppClip/Instant App for mobile users. Only should be set totrue
when building mobile apps.log
(Default:false
): When set totrue
, enables detailed logging for debugging purposes.useBrowserExtension
(Default:true
): This option enables the use of reclaim browser extension for desktop users. When extension is not installed, the SDK will fallback to QR code flow.extensionID
(Default:reclaim-extension
): Unique extension identifier if using a custom reclaim browser extension.
setAppCallbackUrl()
The setAppCallbackUrl
method allows you to specify a custom API endpoint where verification credentials(proofs) will be sent upon successful generation.
Parameters for setAppCallbackUrl
:
URL
: The URL of the API endpoint where proofs will be sent.jsonProofResponse
(Optional) (Default:false
): When set tofalse
, the proof is returned as a url encoded message in the response. When set totrue
, the proof is returned as a JSON object in the response.
This is the recommended way to receive proofs directly on your endpoint. Make sure to use proper middleware to parse the proof object in the response. Eg. express.text({ type: '*/*', limit: '50mb' })
in express.js.
setRedirectUrl()
The setRedirectUrl
method allows you to specify a custom URL where users will be redirected after the successful verification process.
Exporting and Importing SDK Configuration
The SDK provides methods to export and import the entire configuration as a JSON string. This allows you to use the same verification session across different platforms with all our SDKs.
verifyProof()
The SDK provides a method to verify the verification credentials(proofs) to ensure their authenticity. This is particularly useful when receiving proofs in your backend.
addContext()
Use the addContext
method to include any additional information in your verification credentials(proofs). This information will be included in the proof object under the context
field.
contextId
: Unique hex address identifier (string)Context message
: Additional information to be included in the proof object (string)
The contextId must be a valid hex address (starting with '0x' and containing only 0-9 and a-f).
setParams()
The setParams
method lets you define specific conditions for proof generation, enabling selective triggering for verification sessions.
Proof generation will fail if the specified parameters are not present on the provider website.
isBrowserExtensionAvailable()
The isBrowserExtensionAvailable
method checks if any Reclaim browser extension is installed on the user's device.
setModalOptions()
You can use setModalOptions
method to customize the modal appearance and behavior of the QR code modal popup (appears on desktop when browser extension is not installed).
This is applicable only when using triggerReclaimFlow
method.
Modal Options:
title
: Custom title for the modal dialogdescription
: Custom description text shown to usersdarkTheme
(Default:false
): Boolean to enable dark theme stylingextensionUrl
: Custom URL to install/download the browser extension
Options to get various Session Details
The SDK provides methods to fetch additional details about the verification session.
getRequestUrl()
The getRequestUrl
method returns the URL to start the verification session.
getSessionId()
The getSessionId
method returns the unique identifier for the verification session.
getStatusUrl()
The getStatusUrl
method returns the URL to check the status of the verification session. You can use this URL to poll the status of the verification session.
getAppCallbackUrl()
The getAppCallbackUrl
method returns the URL where the verification credentials(proofs) will be sent upon successful generation.
Understanding the Proof Structure
When using any Reclaim SDK (JavaScript, React Native, Flutter), a proof is generated and returned upon successful verification. This proof contains several key components that provide detailed information about the verification process. Below is a generic structure of a proof: