AadharJS is a library for decoding and validating Aadhar QR code data. It provides functions to decode QR code data into Aadhar information and validate mobile and email hashes.
To install the library, use npm or yarn:
npm install @xone-labs/aadharjs
# or
yarn add @xone-labs/aadharjsTo decode QR code data, use the decode function:
import { QR } from '@xone-labs/aadharjs';
const qrData = '...'; // QR code data as a string
const aadhar = QR.decode(qrData);
console.log(aadhar);To validate the mobile hash, use the validateMobileHash function:
import { QR } from '@xone-labs/aadharjs';
const isValid = await QR.validateMobileHash(aadhar, '1234567890');
console.log(isValid); // true or falseTo validate the email hash, use the validateEmailHash function:
import { QR } from '@xone-labs/aadharjs';
const isValid = await QR.validateEmailHash(aadhar, 'example@example.com');
console.log(isValid); // true or falseTo validate the Aadhar number or Virtual ID, use the validate function:
import { Validator } from '@xone-labs/aadharjs';
const isValid = Validator.validate('123456789012');
console.log(isValid); // true or falseThis project is licensed under the MIT License.