PublicResolver
Last updated
Last updated
The Resolver contract stores the personal information of a DID user, such as their name, avatar, and blockchain addresses. The DID user can choose to store their personal information through the Resolver contract, and all of the information fields are optional.
We are familiar with DNS resolution, which resolves domain names to IP addresses, and reverse resolution, which resolves IP addresses to domain names. Similarly, the reverse resolution of DID allows for the association of human-readable names with blockchain addresses and the resolution of machine-readable identifiers to human-readable identifiers.
To use the reverse resolution function, you only need to call the following function in the Resolver contract.
addr: get addr's DID name
Wallet developers are beginning to require the ability to resolve multiple blockchain addresses in the DID, and this specification standardizes the means of entering and retrieving these addresses. Users can set multiple blockchain addresses for DID.
Call the following function to add the address for DID. coinType
is the cryptocurrency type indexed by .
tokenId: DID tokenId
coinType: the cryptocurrency type indexed by
_addr: blockchain address
Access the DID-bound blockchain addresses and call the following function.
tokenId: DID tokenId
DID users can set the Ecdsa secp256K1 public key. When the user uses the private key to sign information, the receiver can use the public key to verify the signature. When the receiver wants to encrypt the communication with the DID User, the receiver can use the public key to encrypt the communication information, and the DID User uses the private key to decrypt the information.
In the resolver contract, the following function is called to set the public key.
tokenId: DID tokenId
x: the x coordinate of the curve point for the public key
y: the y coordinate of the curve point for the public key
Call the following function to query the public key.
tokenId: DID tokenId
The user can set some attributes for DID eg: name
, age
to store.
The following function is used to set text.
tokenId: DID tokenId
key: eg: name
value: eg: allen
Note: The avatar
field is used when the user wants to set an avatar for himself. The field value URI should follow the following rules:
HTTP: If you provide an HTTP URI, it should be able to parse directly into an avatar image, rather than a traditional HTML page, metadata, or other content.
NFT: NFT can also be used as the profile picture of DID. When setting the profile picture URI, you need to follow the following standards:
nft: protocol name
chainId: chain ID
tokenType: token type, eg: 721/1155
contractAddress: contract address
tokenId: NFT's tokenId
The following function is used to query the text.
tokenId: DID tokenId
key: eg: name
coinType: the cryptocurrency type indexed by
IPFS: If an IPFS URI is provided, it should be able to parse directly into an avatar image. Clients without built-in IPFS support can rewrite the URI as an HTTPS URL referencing the IPFS gateway before parsing. As described in .