DID Management
A Decentralized Identifier (DID) gives a wallet a portable, verifiable identity that credentials can be bound to. This page covers creating a DID from a wallet key, importing an existing DID, and listing or deleting DIDs.
The examples use http://localhost:7005 as the base URL. A wallet needs a DID store to manage DIDs — the default wallet setup includes one (see Managing Wallets).
Default DID
Receiving and presenting credential endpoints accept an optional did. When you omit it, the wallet uses its default DID — the first DID in the wallet's DID store (or the staticDid, for a store-less wallet). There is no separate "set default" operation at the moment; add your preferred DID first, or pass did explicitly.
Create a DID
Create a DID from a key in the wallet. If you omit keyId, the wallet's default key is used.
Endpoint: POST /wallet/{walletId}/dids/create | API Reference
Example Request
curl -X POST http://localhost:7005/wallet/{walletId}/dids/create \
-H 'Content-Type: application/json' \
-d '{ "method": "key" }'
Path Parameters
- walletId: String (required) - The wallet to create the DID in. See Managing Wallets.
Body Parameters
- method: String (required) - The DID method to create. Supported:
key,jwk. - keyId: String (optional) - The key to derive the DID from. Defaults to the wallet's default key.
Example Response
{
"did": "did:key:z6Mkfriq1MqLBoPWecGoDLjguo1sB9brj6wT3qZ5BxkKpuP6",
"document": {
"@context": ["https://www.w3.org/ns/did/v1", "https://w3id.org/security/suites/jws-2020/v1"],
"id": "did:key:z6Mkfriq1MqLBoPWecGoDLjguo1sB9brj6wT3qZ5BxkKpuP6",
"verificationMethod": [
{
"id": "did:key:z6Mkfri...#z6Mkfri...",
"type": "JsonWebKey2020",
"controller": "did:key:z6Mkfriq1MqLBoPWecGoDLjguo1sB9brj6wT3qZ5BxkKpuP6",
"publicKeyJwk": { "kty": "OKP", "crv": "Ed25519", "x": "..." }
}
],
"assertionMethod": ["did:key:z6Mkfri...#z6Mkfri..."],
"authentication": ["did:key:z6Mkfri...#z6Mkfri..."]
}
}
Response Fields
- did: String - The newly created DID.
- document: Object - The resolved DID document.
Need a did:web? Creating it here isn't currently supported. Register it externally and bring it into the wallet with Import a DID instead.
Import a DID
Import an existing DID and its document.
Endpoint: POST /wallet/{walletId}/dids/import | API Reference
Example Request
curl -X POST http://localhost:7005/wallet/{walletId}/dids/import \
-H 'Content-Type: application/json' \
-d '{
"did": "did:web:example.org",
"document": "{\"id\":\"did:web:example.org\",\"verificationMethod\":[]}"
}'
Path Parameters
- walletId: String (required) - The wallet to import the DID into.
Body Parameters
- did: String (required) - The DID to import.
- document: String (required) - The DID document, as a JSON string.
Example Response
{
"did": "did:web:example.org",
"document": { "id": "did:web:example.org", "verificationMethod": [] }
}
List DIDs
Endpoint: GET /wallet/{walletId}/dids | API Reference
Example Request
curl http://localhost:7005/wallet/{walletId}/dids
Path Parameters
- walletId: String (required) - The wallet whose DIDs you want to list.
Example Response
[
{
"did": "did:key:z6Mkfriq1MqLBoPWecGoDLjguo1sB9brj6wT3qZ5BxkKpuP6",
"document": { "id": "did:key:z6Mkfriq1MqLBoPWecGoDLjguo1sB9brj6wT3qZ5BxkKpuP6" }
}
]
Get a DID
Endpoint: GET /wallet/{walletId}/dids/{did} | API Reference
Example Request
curl http://localhost:7005/wallet/{walletId}/dids/did:key:z6Mkfriq1MqLBoPWecGoDLjguo1sB9brj6wT3qZ5BxkKpuP6
Path Parameters
- walletId: String (required) - The wallet holding the DID.
- did: String (required) - The DID to fetch. Obtain it from list DIDs or the create/import response.
Example Response
{
"did": "did:key:z6Mkfriq1MqLBoPWecGoDLjguo1sB9brj6wT3qZ5BxkKpuP6",
"document": { "id": "did:key:z6Mkfriq1MqLBoPWecGoDLjguo1sB9brj6wT3qZ5BxkKpuP6" }
}
Delete a DID
Endpoint: DELETE /wallet/{walletId}/dids/{did} | API Reference
Example Request
curl -X DELETE http://localhost:7005/wallet/{walletId}/dids/did:key:z6Mkfriq1MqLBoPWecGoDLjguo1sB9brj6wT3qZ5BxkKpuP6
Path Parameters
- walletId: String (required) - The wallet holding the DID.
- did: String (required) - The DID to delete. Obtain it from list DIDs or the create/import response.
Example Response
204 No Content on success, or 404 Not Found if the DID doesn't exist.
Next Steps
- Receive a credential bound to your DID.
- Manage keys the DIDs are derived from.
