Comment on page
Identity Resolver API
DecentKit's Decentralized Identity Resolver API enables developers to resolve identities on a cross-chain, cross-web basis. It addresses the problem of 'how do I find and connect to others.'
The Identity Resolver API performs forward and reverse address lookups across multiple blockchains. This enables users to resolve a web2 or web3 name to a blockchain address, or vice versa, across a multitude of chains.
The Identity Resolver API provides a reputation and trust score for each resolved identity. In this early phase, these numeric scores range from 0-99 with each increment indicating increasing levels of trust. These scores take into account connected address transaction history, associated verifiable credentials (such as those issued by recognized and certified identity verification services), associated on-chain name history and collectibles ownership, and ongoing community engagement feedback. These scores are intended to help protect users from phishing, scamming, and fake accounts.
In addition to web3 names, addresses, and decentralized identifiers, the API also supports web2 name resolution. For example, developers can execute lookups using Twitter handles, so long as the owner of the Twitter handle has permitted this lookup.
The API enables transactions based on a user's name, eliminating the need for explicit blockchain addresses. When one person sends tokens or data to another user's name, the API takes care of the network hopping needed to reach the recipient. This simplifies user experiences and opens new options for user-friendly decentralized applications.
💡 This SDK is in pre-alpha. The APIs and methods are likely to change significantly before the alpha release. This SDK is not yet publicly available on NPM.
useDecentProfile()
is a React hook provided by the Decentralized Identity Resolver API. It allows you to query the API for identity resolution. Here's how to get started:Step 1: Installation
First, install the React SDK in your project. If you're using npm, the command will be:
npm install @decentkit/react
Step 2: Import useDecentProfile
Next, import
useDecentProfile()
into your React component:import { useDecentProfile } from '@decentkit/react';
Step 3: Querying Web3 Address
If you provide a Web3 address to
useDecentProfile()
, the API will return all known Web3 names associated with that address:function App() {
const { data, isLoading } = useDecentProfile('WEB3_ADDRESS');
if (isLoading) {
return <div>Loading...</div>;
}
return <div>{data.names.join(', ')}</div>;
}
Step 4: Querying Web3 Name
If you provide a Web3 name to
useDecentProfile()
, the API will resolve it to the owner address and perform the same search:function App() {
const { data, isLoading } = useDecentProfile('WEB3_NAME');
if (isLoading) {
return <div>Loading...</div>;
}
return <div>{data.ownerAddress}</div>;
}
Step 5: Accessing Web2 Accounts
The API will also return any known Web2 accounts, such as a Twitter handle, that are proven to be owned by the same entity:
function App() {
const { data, isLoading } = useDecentProfile('WEB3_ADDRESS');
if (isLoading) {
return <div>Loading...</div>;
}
return <div>{data.accounts.twitter}</div>;
}
Step 6: Trust Score
Each identity returned will also have an aggregated trust score associated with it:
function App() {
const { data, isLoading } = useDecentProfile('WEB3_ADDRESS');
if (isLoading) {
return <div>Loading...</div>;
}
return <div>Trust Score: {data.trustScore}</div>;
}
Last modified 6mo ago