resolveDID API Reference
This document provides a concise API reference for the resolveDID function within the Hedera DID SDK for JavaScript.
Function Signature
function resolveDID(
did: string,
accept?: DIDResolutionAccept,
options?: ResolveDIDOptions,
): Promise<DIDDocument | JsonLdDIDDocument | DIDResolution | Uint8Array>;
Parameters
The function accepts the following parameters:
-
did: (Required) The DID string of the Decentralized Identifier to resolve. -
accept: (Optional) Specifies the desired format for the DID Document resolution. -
options: (Optional) Specifies the options for the DID Document resolution.
did Parameter
| Name | Type | Description |
|---|---|---|
did |
|
The DID string of the Decentralized Identifier to resolve. |
accept Parameter
| Name | Type | Description |
|---|---|---|
accept? |
|
Specifies the desired format for the DID Document resolution. See Accept type for allowed values. |
options Parameter
It is an object that contains the following properties:
| Name | Type | Description |
|---|---|---|
options? |
|
Specifies the options for the DID Document resolution. See ResolveDIDOptions type for allowed values. |
Data Types
Accept type
| Name | Type | Description |
|---|---|---|
Accept |
|
A string literal representing the desired format for DID Document resolution. It must be one of the following: * |
ResolveDIDOptions type
| Name | Type | Description |
|---|---|---|
verifier? |
|
Specifies the verifier to use for verifying the DID Document signature. See Verifier for more details. |
topicReader? |
|
Specifies the TopicReader to use for reading messages from the Hedera network. Default is |
Return Value
Upon successful execution, the function returns a Promise that resolves to either a DIDDocument object or a DIDResolutionResponse object, depending on the value of the accept parameter.
| Name | Type | Description |
|---|---|---|
DID Document |
|
Returned if |
LD DID Document |
|
Returned if |
DID Resolution Response |
|
Returned if |
CBOR Response |
|
Returned if |
Errors
The following exceptions may arise during the execution of the resolveDID function:
| Exception code | Description |
|---|---|
|
Unsupported DID method or invalid DID. |
|
The DID document was not found. |
|
Cannot verify signature without a public key or a verifier. |
|
No public key found in |
|
Unsupported representation format. |
Function Implementation
The Hiero DID SDK provides a resolveDID function within its resolver package. For further details, refer to the @hiero-did-sdk-js/resolver package documentation.