GET STARTED
Welcome to the Proof of Humanity SDK Documentation! This guide serves as an introduction to the core concepts of the SDK. In this documentation, we'll walk you through the fundamental features and functionalities that constitute the backbone of the Proof of Humanity SDK. During your exploration of this guide, you will gain proficiency in a variety of essential concepts that are pivotal to your success as a developer within our ecosystem. These concepts will equip you with the skills necessary to create robust and innovative applications that leverage the World Coin Human Protocol, Humangram, proof of Humanity biometrics dapp, and Human Ledger Signer functionalities.
- Holistic Development
- Tailoring Components
- Interconnected Functionalities
- Seamless Integration
- Dynamic UI Element
You will learn how to utilize our SDK for
Before you can make requests to the Protocol API, you will need to grab your API key from your dashboard. You find it under Settings » API.
Installations
The library "poh-validators-react" offers React components designed for the seamless integration of Proof of Humanity's validation mechanisms. To install, simply execute the provided code snippet
# To Install the package
npm install poh-validators-react --save
or
yarn add poh-validators-react
Choose your Validator
Choose a Protocol with Proof of Humanity SDK! Explore the individual sections dedicated to each protocol, where you'll find code samples. You'll discover how easy it is to customize your application's functionality to match your vision.
# Install the WorldCoin Human Protocol Validator
import { WorldcoinValidator } from 'poh-validators';
Import To Client
Once you've selected your desired protocol within our SDK, you're all set to initiate your inaugural interaction with React as shown below.
import React, { useState } from 'react';
import { useProofOfHumanity } from 'poh-react';
Props
For the BiometricsValidator component:
Prop | Required/Optional | Description | Default Value |
---|---|---|---|
app_id | Required | The ID of your application. | N/A |
onProof | Required | Callback function when a proof is received or an error occurs. | N/A |
url | Required | The API URL for the validator. | N/A |
For the HumangramValidator component:
Prop | Required/Optional | Description | Default Value |
---|---|---|---|
onProof | Required | Callback function when a proof is received or an error occurs. | N/A |
websocket | Required | The websocket URL for the validator. | N/A |
Contract
To Utilize our Validator-Signed Proof for Contract Function Access, implement the handleProof callback function using this template:
const handleProof = async ({ proof, error }) => {
if (proof && contract) {
console.log("Received proof:", proof);
try {
const tx = await contract.sampleFunction(proof);
const receipt = await tx.wait();
console.log("Transaction receipt:", receipt);
} catch (err) {
console.error("Error during contract interaction:", err);
}
}
if (error) {
console.error("Error:", error);
}
}
Click on poh-contracts for details.
Coming Soon!
Support for more Validators coming soon. You will have the capability to enable multiple human verification methods within your dApp.
import { BiometricsValidator, WorldcoinValidator, HumangramValidator} from 'poh-validators-react';
function MyApp() {
const handleProof = {}
return (
<div>
<BiometricsValidator app_id="[Your_APP_ID]" onProof={handleProof} url="[Your_URL]" />
<WorldcoinValidator data={[Your_Data]} app_id="[Your_APP_ID]" action="[Your_Action]" onVerify={handleVerify} />
<HumangramValidator />
</div>
);
}
Choose your Aim
Choose a Protocol with Proof of Humanity SDK! Explore the individual sections dedicated to each protocol, where you'll find code samples. You'll discover how easy it is to customize your application's functionality to match your vision.
# cURL is most likely already installed on your machine
curl --version
What's next?
Fantastic, you've successfully configured your Human protocol API and executed your inaugural API request. As you continue your journey with our SDK, we've compiled a collection of useful links that will serve as valuable resources while you delve deeper into the Protocol API: