DID Generation
DID is an ethereum wallet address
Did is a basic secp256k1 key generated ethereum address which is written in format
did:pkh:{address_key} e.g did:pkh:0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Generating Ethereum Compatible DiD
Install Protocol SDK and Viem
npm install viem @permission-io/protocol-sdkyarn add viem @permission-io/protocol-sdkbun add viem @permission-io/protocol-sdkimport { generatePrivateKey, privateKeyToDid, defaultPermissionDIDDocument } from "@permission-io/protocol-sdk/did";
// 1. Generate a random private key
const privateKey = generatePrivateKey();
// 2. Derive the DID (did:pkh:...)
const did = await privateKeyToDid(privateKey);
console.log(`Generated DID: ${did}`);
// 3. Create a default DID Document
const didDoc = defaultPermissionDIDDocument(privateKey);
console.log(didDoc);DID Document Structure
A DID Document (Decentralized Identifier Document) is a fundamental component of the Decentralized Identifiers architecture, serving as the digital identity profile for a DID subject
DID Document structure for permission protocol requirements is as follows
Permission Protocol SDK
Quick Start
1. Generate an Identity
Create a new private key and derived DID.
Usage Guide
Prerequisites
Initialize a viem Client (Wallet and Public) to interact with the blockchain.
Registering a DID
Method A: Self-Registration
Register your own DID directly on-chain.
Method B: Delegated Registration (Meta-Transaction)
Allow a third party (relayer) to pay for the gas fees while you sign the intent.
Signer (Identity Owner):
Relayer (Gas Payer):
Updating a DID
Method A: Self-Update
Update your existing DID Document.
Method B: Delegated Update
Update a DID Document via a relayer.
Resolving a DID
Fetch and decode a DID Document from the blockchain.
🚧 Content in Progress 🚧 This documentation page is currently being created and is incomplete. Please check back later for updates.
W3C DiD Spec: https://www.w3.org/TR/did-1.0/
Last updated

