Skip to content
/ idkit-js Public
forked from worldcoin/idkit-js

Javascript toolkit to interact with the World ID protocol. Building the Identity SDK.

License

Notifications You must be signed in to change notification settings

WDCA/idkit-js

 
 

Repository files navigation

World ID logo

IDKit JS

IDKit JS is the new toolkit to interact with the World ID protocol. IDKit can instantly add sybil resistance to your apps by:

  • Receive a signal someone is a unique human (through the Worldcoin orb).
  • Receive a signal someone has a unique phone number (for less sensitive operations).

IDKit and the World ID protocol is fully privacy preserving.

🚀 Getting started

Integration is very straightforward. Follow the relevant steps below.

yarn add idkit
# or
npm install idkit

Lens x Worldcoin

If you're integrating IDKit with a Lens app, check out the Lens-specific docs here.

React & Next.js apps

If your app is built on React, using the React widget is by far the easiest approach.

import { IDKitWidget } from "@worldcoin/idkit";

<IDKitWidget actionId="get_this_from_the_dev_portal" signal="my_signal" handleVerify={verifyProof}>
  {({ open }) => (
    {/* You can render whatever you want here, and call open() to open the widget */}
    <button onClick={open}>Click me</button>
  )}
</IDKitWidget>

Alternatively, you can render the component without children (on your layout, for example) and use the useIDKit hook to open it programmatically.

import { useIDKit } from "@worldcoin/idkit";

const { open, setOpen } = useIDKit({
	signal: "my_signal",
	handleVerify: verifyProof,
	actionId: "get_this_from_the_dev_portal",
	walletConnectProjectId: "get_this_from_walletconnect_portal",
});

Generic JS Apps

If your app doesn't have a framework or doesn't use React, continue here.

  1. Initialize IDKit (please refer to the docs for further customization details).
IDKit.init({
	signal: "my_signal",
	handleVerify: verifyProof,
	actionId: "get_this_from_the_dev_portal",
	walletConnectProjectId: "get_this_from_walletconnect_portal",
});
  1. Then, open the widget and await the proof (you can do this in response to a button click, for example).
button.addEventListener("click", async () => {
	IDKit.open();
});

🔒 Verifying the IDKit response

IDKit exposes the handleVerify option for your app to perform additional verification on the returned response, often a call to an API that ensures the proof is valid.

Warning Make sure you verify the proof, and that you don't do it client-side!

Optionally, IDKit also provides an onSuccess option, which you can use if your app needs to execute some code after verification succeeds.

🧑‍💻 Development & Testing

If you want to develop or contribute to this project, please refer to the development instructions in the idkit README.

About World ID

World ID is the privacy-first identity protocol that brings global proof of personhood to the internet. More on World ID in the announcement blog post.

World ID lets you seamlessly integrate authentication into your app that verifies accounts belong to real persons through Sign in with Worldcoin. For additional flexibility and cases where you need extreme privacy, Anonymous Actions lets you verify users in a way that cannot be tracked across verifications.

Follow the Quick Start guide for the easiest way to get started.

📄 Documentation

All the technical docs for the Wordcoin SDK, World ID Protocol, examples, guides can be found at https://docs.worldcoin.org/

About

Javascript toolkit to interact with the World ID protocol. Building the Identity SDK.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 82.0%
  • JavaScript 11.4%
  • HTML 3.6%
  • CSS 3.0%