submitCreateDIDRequest API Reference
This document provides a concise API reference for the submitCreateDIDRequest function within the Hedera DID SDK for JavaScript.
Function Signature
This function resume the creation flow of a new Decentralized Identifier (DID) and publish it on the Hedera network using the Client Managed Secret Mode.
The submitCreateDIDRequest function is invoked with options and providers.` The providers parameter encapsulates configuration parameters for interacting with the Hedera network, while the options parameter takes current state of the DID creation process and the signature of the signing request.
function submitCreateDIDRequest(
options: SubmitCreateDIDRequestOptions,
providers: PublisherProviders,
): Promise<CreateDIDResult>;
Parameters
The function accepts the following parameters:
-
providers: (Required) An object encapsulating configuration parameters for interacting with the Hedera network. -
options: (Required) An object specifying configuration options for the DID creation request along with the current state of the DID creation process and the signature of the signing request.
providers Parameter
The table below details the structure of the providers parameter.
| Name | Type | Description |
|---|---|---|
providers |
|
An object containing a Hedera Client or a transaction Publisher (refer to PublisherProviders Type for details). |
options Parameter
The table below details the structure of the options parameter.
| Name | Type | Description |
|---|---|---|
options |
|
An object specifying configuration options for DID creation request (refer to SubmitCreateDIDRequestOptions Type for details). |
Return Value
Upon successful execution, the function returns a Promise that resolves to a CreateDIDResult object.
The table below describes the structure of the CreateDIDResult type.
| Name | Type | Description |
|---|---|---|
did |
|
The DID string of the newly created Decentralized Identifier. |
didDocument |
|
The DID Document associated with the newly created DID. |
Data Types
This section elaborates on the data types employed within the providers and options parameters.
PublisherProviders Type
To utilize this type, at least one of the following must be defined: client or publisher. If both are provided, publisher takes precedence.
The table below provides a detailed description of the PublisherProviders type.
| Name | Type | Description |
|---|---|---|
clientOptions? |
|
Configuration options for instantiating a Hedera Client. See a full running example in the source code. |
client? |
|
An instance of a Hedera Client. See a full running example in the source code. |
publisher? |
|
An instance of a Publisher responsible for submitting the DID creation transaction to the Hedera network. |
SubmitCreateDIDRequestOptions Type
The table below provides a detailed description of the SubmitCreateDIDRequestOptions type.
| Name | Type | Description |
|---|---|---|
state |
|
The |
signature |
|
The |
waitForDIDVisibility? |
|
Whether to wait for the DID to be visible on the network. The DID registration transaction may be confirmed before the DID is actually accessible and usable on the network. This option ensures that the function waits until the DID is fully propagated and discoverable. If set to Defaults to |
visibilityTimeoutMs? |
|
The maximum time (in milliseconds) to wait for the DID to be visible on the network. This option is only relevant if |
topicReader? |
|
An instance of a TopicReader responsible for reading messages from the Hedera network topic. |
Errors
The following table enumerates the exceptions that may arise during the execution of the submitCreateDIDRequest function.
| Exception code | Description |
|---|---|
|
Providers must contain client options or client or publisher. |
|
Hashgraph SDK Client must be configured with a network. |
|
Hashgraph SDK Client must be configured with an operator account. |
|
Signature and verifier are required for the signature step. |
|
Message awaiter timeout reached. Messages not found. |
|
Failed to create the DID. |
Function Implementation
The Hiero DID SDK provides a submitCreateDIDRequest function within its registrar package. For further details, refer to the @hiero-did-sdk-js/registrar package documentation.