UNOccccc ddddd
ccc npm install @worldcoin/idkit
// (If using Next.js - IDKitWidget must be run on client)
"use client"
import { IDKitWidget, VerificationLevel } from '@worldcoin/idkit'
// TODO: Calls your implemented server route
const verifyProof = async (proof) => {
throw new Error("TODO: verify proof server route")
};
// TODO: Functionality after verifying
const onSuccess = () => {
console.log("Success")
};
// ...
{({ open }) => (
)}
// example_verify.sol
function _exampleVerifyAndExecute(
address signal,
uint256 root,
uint256 nullifierHash,
uint256[8] calldata proof
) public {
// Check Uniqueness
if (nullifierHashes[nullifierHash]) revert InvalidNullifier();
// Verify User has a valid World ID
worldId.verifyProof(
root,
groupId, // set to "1" in the constructor
abi.encodePacked(signal).hashToField(),
nullifierHash,
externalNullifierHash,
proof
);
nullifierHashes[nullifierHash] = true;
// Finally, execute your logic here, knowing the user is verified
}
Note: This is just an example. Full implementation requires
deploying a smart contract and making a transaction
See an end to end example:
https://github.com/worldcoin/world-id-onchain-template
jjjj