eVerify.authenticate with the client ID and client secret, then pass the returned bearer token through auth.12345import { createClient } from "egov.js"; const client = createClient({ baseUrl: "https://hackathon-everify-api.e.gov.ph", });
eVerify.authenticatePOST /api/auth exchanges the client ID and client secret for an eVerify bearer token.12345678910import { eVerify } from "egov.js"; const authentication = await eVerify.authenticate({ client, body: { client_id: process.env.EVERIFY_CLIENT_ID!, client_secret: process.env.EVERIFY_CLIENT_SECRET!, }, throwOnError: true, });
eVerify.verifyPersonalInformationPOST /api/query compares supplied identity fields and a face-liveness session against the provider's identity record.12345678910111213import { eVerify } from "egov.js"; const identity = await eVerify.verifyPersonalInformation({ client, auth: authentication.data.access_token, body: { birth_date: "1990-01-15", face_liveness_session_id: livenessSessionId, first_name: "Juan", last_name: "Dela Cruz", }, throwOnError: true, });
eVerify.checkQrPOST /api/query/qr/check decodes a National ID QR value and returns its profile data and QR type.12345678import { eVerify } from "egov.js"; const qrProfile = await eVerify.checkQr({ client, auth: authentication.data.access_token, body: { value: nationalIdQrValue }, throwOnError: true, });
eVerify.verifyQrPOST /api/query/qr verifies a National ID QR value together with a face-liveness session identifier.1234567891011import { eVerify } from "egov.js"; const qrVerification = await eVerify.verifyQr({ client, auth: authentication.data.access_token, body: { face_liveness_session_id: livenessSessionId, value: nationalIdQrValue, }, throwOnError: true, });