dereferenceDID API Reference
This document provides a concise API reference for the dereferenceDID function within the Hedera DID SDK for JavaScript.
Function Signature
function dereferenceDID(
didUrl: string,
accept?: DIDResolutionAccept,
options?: DereferenceDIDOptions,
): Promise<
| Service
| VerificationMethod
| ServiceEndpoint
| JsonLdVerificationMethod
| JsonLdService
| DIDDereferenceResolution
| Uint8Array
>;
Parameters
The function accepts the following parameters:
-
didUrl: (Required) The DID URL to dereference. -
accept: (Optional) Specifies the desired format for the DID fragment resolution. -
options: (Optional) The options to use when dereferencing the DID URL.
didUrl Parameter
| Name | Type | Description |
|---|---|---|
didUrl |
|
The DID URL string of the Decentralized Identifier to dereference. |
accept Parameter
| Name | Type | Description |
|---|---|---|
accept? |
|
Specifies the desired format for the DID fragment resolution. See Accept type for allowed values. |
options Parameter
| Name | Type | Description |
|---|---|---|
options? |
|
The options to use when dereferencing the DID URL. See DereferenceDIDOptions type for more details. |
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: * |
DereferenceDIDOptions 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 Service, VerificationMethod, or DIDDereferenceResolution object, depending on the provided didUrl and accept values.
| Name | Type | Description |
|---|---|---|
Service |
|
Returned if DID URL has a service fragment or service parameter was provided. |
VerificationMethod |
|
Returned if DID URL has a verificationMethod fragment. |
ServiceEndpoint |
|
Returned if DID URL has dereference to a service endpoint. |
DIDDereferenceResolution |
|
Returned if |
CBOR Response |
|
Returned if |
Errors
The following exceptions may arise during the execution of the dereferenceDID function:
| Exception code | Description |
|---|---|
|
Unsupported DID method or invalid DID URL. |
|
Unsupported DID URL parameters. |
|
HL, versionTime, and versionId params are not supported. |
|
The DID document was not found. |
|
Fragment not found in DID document. |
|
Query not found in DID document. |
|
Cannot verify signature without a public key or a verifier. |
|
No public key found in |
|
Unsupported representation format. |
|
Multiple service endpoints are not supported. |
|
This service endpoint type is not supported. |
Function Implementation
The Hiero DID SDK provides a dereferenceDID function within its resolver package. For further details, refer to the @hiero-did-sdk-js/resolver package documentation.