Skip to content

Repository files navigation

@dentity/ens-client

A combination of Dentity and ENS domains to verify basic information for ENS domain owners.


Install

npm i @dentity/ens-client

Getting started

The simplest example is to get all verifcations shared by Dentity users with their ENS domain. You can easily get all those verifications by initially add to their ENS domain.

import{EnsPublicClient,createEnsPublicClient}from'@ensdomains/ensjs';import{CredentialTemplate,EnsDentityClient}from'@dentity/ens-client';import{http}from'viem';import{mainnet}from'viem/chains';constclient=createEnsPublicClient({chain: mainnet,// Configure your faucet url heretransport: http(''),})asEnsPublicClient;EnsDentityClient.initialize(clientasany,'alice.eth').then((ensClient)=>{// Get ethereum address of this ENS domain constaddress=ensClient.getEthAddress();console.log('ENS Address:',address);// Get all Dentity verifications of this ENS domainconstverifications=ensClient.getVerifications();console.log('verifications:',verifications);});

Currently Dentity is supporting sharing a number of verification types for ENS domain. You can specifically get any verification by passing in a specific credential template. You can then verify the correctness of that verification.

import{EnsPublicClient,createEnsPublicClient}from'@ensdomains/ensjs';import{CredentialTemplate,DentityEnsClient}from'@dentity/ens-client';import{http}from'viem';import{mainnet}from'viem/chains';constclient=createEnsPublicClient({chain: mainnet,// Provider url heretransport: http(''),})asEnsPublicClient;DentityEnsClient.initialize(clientasany,'alice.eth').then((ensClient)=>{// Get ethereum addressconstaddress=ensClient.getEthAddress();console.log('ENS Address:',address);constverifications=ensClient.getVerifications();console.log('verifications:',verifications);// Get credential based on credential template typeconstdiscordVerification=ensClient.getSpecificVerification(CredentialTemplate.Discord,);console.log('discordVerification',discordVerification);DentityEnsClient.verifyVerification(discordVerification).then((verifyVerificationResult)=>{console.log('verifyVerificationResult',verifyVerificationResult);},);});

We currently support some of the following CredentialTemplates:

TemplateDescription
DiscordThe information is shared from Discord.
XThe information is shared from X.
EmailEmail of this ENS domain.
TelegramThe information is shared from Telegram.
PersonhoodThe state or fact of ENS domain owner of being an individual or having human characteristics.

Run the Sample

We have 2 examples for both ReactJS and NodeJS applications. You can go to examples folder to see and know the basic concept and how to use it.

Contribution

We welcome issue reports if any and pull requests for further improvement.

License

MIT License

About

A JavaScript library that fetches Dentity's Proof of Personhood and Social Credentials linked to an ENS profile

Topics

Resources

Stars

7 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages