Update a DID
Update a did:cheqd Decentralized Identifier (DID) using cheqd Studio.
Users are able to update DID Documents for various reasons, such as to include a new section (such as service
) or to rotate the verificationMethod
or authentication
keys within the DID Document.
With the /did/update
API, users are able to input either:
The specific section(s) of the DID Document to be updated; or
The full updated DID Document body.
Example Request formats
Update Service Section
To update individual sections of the DID Document, users are able to pass only the section they would like to update. For example, users may often want to update the service
section to add or change a serviceEndpoint
:
{
"did": "did:cheqd:mainnet:71e24492-e62c-4e55-a581-007a6e36e881",
"service": [
{
"id": "did:cheqd:mainnet:71e24492-e62c-4e55-a581-007a6e36e881#website",
"type": "LinkedDomains",
"serviceEndpoint": [
"https:example.com"
]
}
]
}
The above request format will replace the service
section of the existing DID Document with the new section. No extra information, such as the verificationMethod or authentication
keys need to be passed with the request, because cheqd Studio custodies the keys on behalf of the user.
Rotate Keys
Users may regularly want to rotate the keys used to control the DID. Like with the service
section above, users are able to pass the sections of the DID Document that include the rotated keys, usually contained within theverificationMethod
and authentication
sections.
{
"did": "did:cheqd:mainnet:71e24492-e62c-4e55-a581-007a6e36e881",
"verificationMethod": [
{
"id":"did:cheqd:mainnet:71e24492-e62c-4e55-a581-007a6e36e881#key-2",
"type":"Ed25519VerificationKey2018",
"controller":"did:cheqd:mainnet:71e24492-e62c-4e55-a581-007a6e36e881",
"publicKeyBase58":"4sjwZ3VGWupJ26ytxjhU6LhjKiPrHV5reZbaNseyHtf8"
}
],
"authentication": [
"did:cheqd:mainnet:71e24492-e62c-4e55-a581-007a6e36e881#key-2"
]
}
The example above will rotate the keys that control the DID Document, updating the DID Document's verificationMethod
and authentication
sections accordingly.
Pass full updated DID Document body
Users may alternatively want to update the DID Document body in full, and pass the updated DID Document to the API. For example:
{
"didDocument": {
"@context": [
"https://www.w3.org/ns/did/v1",
"https://w3id.org/security/suites/ed25519-2018/v1"
],
"id": "did:cheqd:mainnet:71e24492-e62c-4e55-a581-007a6e36e881",
"controller": [
"did:cheqd:mainnet:71e24492-e62c-4e55-a581-007a6e36e881"
],
"verificationMethod": [
{
"id": "did:cheqd:mainnet:71e24492-e62c-4e55-a581-007a6e36e881#key-1",
"type": "Ed25519VerificationKey2018",
"controller": "did:cheqd:mainnet:71e24492-e62c-4e55-a581-007a6e36e881",
"publicKeyBase58": "4sjwZ3VGWupJ26ytxjhU6LhjKiPrHV5reZbaNseyHtf8"
}
],
"authentication": [
"did:cheqd:mainnet:71e24492-e62c-4e55-a581-007a6e36e881#key-1"
],
"service": [
{
"id": "did:cheqd:mainnet:71e24492-e62c-4e55-a581-007a6e36e881#website",
"type": "LinkedDomains",
"serviceEndpoint": [
"https://example.com"
]
}
]
}
}
This method may be better for users wanting to update larger portions of the DID Document, or for having full visibility over the updated body.
Get started with the API below
Use the /did/update
API below to pass your DID Document update as a request, using either the full body or a specific section.
This endpoint updates a DID Document. As an input, it can take JUST the sections/parameters that need to be updated in the DID Document (in this scenario, it fetches the current DID Document and applies the updated section). Alternatively, it take the fully-assembled DID Document with updated sections as well as unchanged sections.
DID identifier to be updated.
did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0
Authentication section of the DID Document.
List of key references (publicKeys) which will be used for signing the message. The should be in hexadecimal format and placed in the wallet of current user.
POST /did/update HTTP/1.1
Host:
x-api-key: YOUR_API_KEY
Content-Type: application/x-www-form-urlencoded
Accept: */*
Content-Length: 1226
"did='did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0'&service=[{'id':'did:cheqd:mainnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#service-1','type':'LinkedDomains','serviceEndpoint':['https://example.com']}]&verificationMethod=[{'controller':'did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0','id':'did:cheqd:testnet :7bf81a20-633c-4cc7-bc4a-5a45801005e0#key-1','publicKeyBase58':'BTJiso1S4iSiReP6wGksSneGfiKHxz9SYcm2KknpqBJt','type':'Ed25519VerificationKey2018'}]&authentication=['text']&publicKeyHexs=['text']&didDocument={'@context':['https://www.w3.org/ns/did/v1'],'id':'did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0','controller':['did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0'],'verificationMethod':[{'id':'did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#key-1','type':'Ed25519VerificationKey2018','controller':'did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0','publicKeyBase58':'z6MkkVbyHJLLjdjU5B62DaJ4mkdMdUkttf9UqySSkA9bVTeZ'}],'authentication':['did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#key-1'],'service':[{'id':'did:cheqd:testnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#service-1','type':'LinkedDomains','serviceEndpoint':['https://example.com']}]}"
{
"did": "text",
"controllerKeyId": "text",
"keys": [
{}
],
"services": [
{
"id": "did:cheqd:mainnet:7bf81a20-633c-4cc7-bc4a-5a45801005e0#service-1",
"type": "LinkedDomains",
"serviceEndpoint": [
"https://example.com"
]
}
],
"controllerKeyRefs": [
"text"
],
"controllerKeys": [
"text"
]
}
Last updated
Was this helpful?