✨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
Ionic SDK

Usage

Reclaim Protocol's Capacitor SDK

To use Reclaim InApp Sdk in your project, follow these steps:

  1. Import the @reclaimprotocol/inapp-capacitor-sdk package in your project file.
import { ReclaimVerification } from '@reclaimprotocol/inapp-capacitor-sdk';
  1. Initialize the ReclaimVerification class to create an instance.
const reclaimVerification = new ReclaimVerification();
  1. Start the verification flow by providing the app id, secret and provider id.
const verificationResult = await reclaimVerification.startVerification({
    appId: config.RECLAIM_APP_ID ?? '',
    secret: config.RECLAIM_APP_SECRET ?? '',
    providerId: providerId,
});

The returned result is a [ReclaimVerification.Response] object. This object contains a response that has proofs, exception, and the sessionId if the verification is successful.

Exception Handling

If the verification ends with an exception, the exception is thrown as a [ReclaimVerification.ReclaimVerificationException] object.

Following is an example of how to handle the exception using [error.type]:

try {
  // ... start verification
} catch (error) {
  if (error instanceof ReclaimVerification.ReclaimVerificationException) {
    switch (error.type) {
      case ReclaimVerification.ExceptionType.Cancelled:
        Snackbar.show({
          text: 'Verification cancelled',
          duration: Snackbar.LENGTH_LONG,
        });
        break;
      case ReclaimVerification.ExceptionType.Dismissed:
        Snackbar.show({
          text: 'Verification dismissed',
          duration: Snackbar.LENGTH_LONG,
        });
        break;
      case ReclaimVerification.ExceptionType.SessionExpired:
        Snackbar.show({
          text: 'Verification session expired',
          duration: Snackbar.LENGTH_LONG,
        });
        break;
      case ReclaimVerification.ExceptionType.Failed:
      default:
        Snackbar.show({
          text: 'Verification failed',
          duration: Snackbar.LENGTH_LONG,
        });
    }
  } else {
    Snackbar.show({
      text: error instanceof Error ? error.message : 'An unknown verification error occurred',
      duration: Snackbar.LENGTH_LONG,
    });
  }
}

This error also contains sessionId, reason, and innerError that can be used to get more details about the occurred error.

error.sessionId
error.reason
error.innerError

Migration

  • Migration steps for 0.3.1
  • Migration steps for 0.3.0
  • Migration steps for 0.2.1

Example

Advanced Usage

For more usage options see Advance Options guide

On this page