pavelon-verify-kyc
TypeScript icon, indicating that this package has built-in type declarations

0.2.1 • Public • Published

Pavelon Verify Kyc

The Enhanced SDK for Phone Number Verification and ID Verification is a JavaScript library that can be used with React and React Native applications. This library allows developers to easily integrate phone number verification and ID verification features into their applications.

Installation

To install the Enhanced SDK for Phone Number Verification and ID Verification, simply run the following command:
yarn add pavelon-verify-kyc

Usage

To use the Enhanced SDK for Phone Number Verification and ID Verification, import it into your JavaScript or TypeScript code and initialize it with your Auth Token, Private Key, App Id & domain Id key
import EnhancedKyc from 'pavelon-verify-kyc';

const enhanced = new EnhancedKyc({
  senderId: string  //required for otp verification
  authToken: string
  appId: string
  domainId: string
  otpLength: string
})

sendOtp()

The onSend() function is an asynchronous function that sends an OTP (One Time Password) to a specified phone number using the enhanced.sendOtp() method. It takes a phoneNumber parameter as its input, which is passed as the phone property to the enhanced.sendOtp() method.

  async function onSend() {
    try {
      const response = await enhanced.sendOtp({ phone: phone });
      
    // handle successful sent code here
      
      console.log(response);
      
    } catch (error) {
    
     //handle error here
     
      console.log(error);
    }
  }
  

verifyOtp()

The onVerify() function is an asynchronous function that verifies an OTP (One Time Password) for a specified phone number using the enhanced.verifyOtp() method. It takes a code parameter as its input, which is passed as the verifyCode property to the enhanced.verifyOtp() method.

  async function onVerify() {
    try {
      const response = await enhanced.verifyOtp({ verifyCode: code });
      
    // handle successful verification here
      
      console.log(response);
      
    } catch (error) {
    
     //handle error here
     
      console.log(error);
    }
  }
  

verification()

The verification() method is designed to support various types of identification verification, including passports, national IDs, SSNIT, driver's licenses, TIN, and digital address verification, it is intended to provide a consistent and scalable way to verify multiple types of identification. Depending on the specific use case, the verification process for each type of identification may have different requirements and validation steps. However, this method can be used as a general-purpose function for handling these requirements.

async function onIDVerify () {

  try {
    const response = await enhanced.verification({
      passport: {
        id: "AB123456",
        firstName: "John",
        lastName: "Doe",
        middleName: "",
        dob: "01/01/1980"
      }
    });
    
    // handle successful verification here
    
    console.log(response);
    
  } catch(error) {
  
    // handle errors here
    
    console.error(error);
  
  }
};

async function verification() {

  const formData = new FormData();
  formData.append("nameOnCard", string);
  formData.append("idNumber", string);
  formData.append("idPhoto", File);
  formData.append("userId", string);   //optional

  try {
    const response = await config.ghanaCard(formData);
    console.log(response);
  } catch (error) {
    console.log(error);
  }
}

Other verifications for verification() method

  //digital address verification
   digitalAddress: {
        digitalAddress: "",
      },



   //driver license verification
    driver_license: {
        id: "",
        fullName: "",
        dob: ""
    }


   //tin number verification
    tin: "",

    ssnit: {
        id: "",
        fullName: "",
        dob: ""
    },


   //passport verification
    passport: {
        id: "",
        firstName: "",
        lastName: "",
        middleName: "",
        dob: ""
    },


   //voter's id verification
    voter: {
        id: "",
        fullName: "",
    },

    




  };

License

This project is licensed under the terms of the MIT license.

Package Sidebar

Install

npm i pavelon-verify-kyc

Weekly Downloads

89

Version

0.2.1

License

MIT

Unpacked Size

45.9 kB

Total Files

24

Last publish

Collaborators

  • tagong40