Create Your First Decentralized Identifier
Ready to jump in and create your first Decentralized Identifier (DID)? Follow this quick guide to get started with Veramo, a framework that makes it easy to manage DIDs and Verifiable Credentials.
Step 1: Install Veramo
First, let's install Veramo and its core dependencies:
npm install @veramo/core @veramo/did-manager @veramo/key-manager @veramo/did-comm
Step 2: Create Your First DID
Now that you have Veramo installed, you can create your first DID using the following code:
import { createAgent } from "@veramo/core";
import { KeyManager } from "@veramo/key-manager";
import { DIDManager } from "@veramo/did-manager";
import { DIDComm } from "@veramo/did-comm";
async function createDid() {
const agent = createAgent({
plugins: [new KeyManager(), new DIDManager(), new DIDComm()],
});
const identifier = await agent.didManagerCreate({
provider: "did:key",
alias: "my-first-did",
options: { keyType: "Ed25519" },
});
console.log("Your new DID:", identifier.did);
}
createDid();
Once you run this code, you’ll see your new Decentralized Identifier (DID) output in the console.
Step 3: Use Your DID
With your DID created, you can start using it in real-world applications to authenticate, share credentials, or communicate securely using DIDComm. You've now taken your first step into the world of Decentralized Identity!