useVerifyPopup

A custom React hook to launch a verification popup for address-based verifications.

Usage

import { useVerifyPopup } from "authento-react";

export const MyComponent = () => {
  const { verifyBasic, status } = useVerifyPopup({
    domainName: "YOUR_DOMAIN_NAME",
    messageText: 
      "Sign this message to prove your ownership of this address and " +
      "proceed with the identity verification process."
  });

  return (
    <div>
      <button onClick={verifyBasic}>Verify</button>
      {status === "pending" && <p>Pending user signature</p>}
      {status === "success" && <p>Signature generated successfully</p>}
      {status === "error" && <p>Failed to generate signature</p>}
    </div>
  );
};

An active wallet connection is required for the verify method to function properly. You can learn more about wallet connections here.

Configuration

The useVerifyPopup hook accepts a configuration object with the following properties:

  • domainName (required): Your domain name registered with Authento. Please contact us if you are unsure of its value.

  • messageText (required): The text of the verification message. Unless otherwise communicated, this should be set to

    Sign this message to prove your ownership of this address and proceed with the identity verification process.
  • authentoUrl (optional): The URL of the Authento website (default: "https://app.authento.io"). For testing, this should be set to "https://demo-app.authento.io".

  • userType (optional): Preset user type (either "INDIVIDUAL" or "CORPORATE"). New users will be prompted to choose their own user type if this is unset.

Return Value

The useVerifyPopup hook returns an object with the following properties:

  • verifyBasic: A function that initiates the basic verification process. When this function is called, the hook will open a popup window for the user to complete the verification process.

  • verifyPoa: A function that initiates the proof of address verification process. When this function is called, the hook will open a popup window for the user to complete the verification process.

  • status: The current status of the signature generation process, which can be one of the following values: "unstarted", "pending", "success", or "error".

Last updated