submitUpdateDIDRequest API Reference

This document provides a concise API reference for the submitUpdateDIDRequest function within the Hedera DID SDK for JavaScript.

Function Signature

This function resume the update flow of a Decentralized Identifier (DID) and publish update on the Hedera network using the Client Managed Secret Mode.

The submitUpdateDIDRequest 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 update process and the signature of the signing request.

function submitUpdateDIDRequest(
  options: SubmitUpdateDIDRequestOptions,
  providers: PublisherProviders,
): Promise<UpdateDIDResult>;

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 update request along with the current state of the DID update process and the signature of the signing request.

providers Parameter

The table below details the structure of the providers parameter.

Name Type Description

providers

PublisherProviders

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

CommonRegistrarOptions

An object specifying configuration options for DID deactivation request (refer to SubmitUpdateDIDRequestOptions Type for details).

Return Value

Upon successful execution, the function returns a Promise that resolves to a UpdateDIDResult object.

The table below describes the structure of the UpdateDIDResult type.

Name Type Description

did

string

The DID string of the updated Decentralized Identifier.

didDocument

DIDDocument

The updated DID Document associated with the 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?

ClientOptions

Configuration options for instantiating a Hedera Client. See a full running example in the source code.

client?

Client

An instance of a Hedera Client. See a full running example in the source code.

publisher?

Publisher

An instance of a Publisher responsible for submitting the DID creation transaction to the Hedera network.

SubmitUpdateDIDRequestOptions Type

The table below provides a detailed description of the SubmitUpdateDIDRequestOptions type.

Name Type Description

states

RunnerState<DIDMessage>[]

The state parameter is an array of RunnerState objects that encapsulate the current state of the DID update process. Each RunnerState represents a single operation in the DID update process. This parameter is generated by the generateUpdateDIDRequest function. Note that the RunnerState objects must be in the correct order and must be generated sequentially.

signatures

Record<string, Uint8Array>

The signatures parameter is an object containing the signatures of the signing requests. The keys of the object are unique identifiers for each RunnerState object, and the values are Uint8Array objects containing the signatures. The signatures must be generated using the private key associated with the DID root key. The signing request is generated by the generateUpdateDIDRequest function.

waitForDIDVisibility?

boolean

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 false, the function will return as soon as the registration transaction is confirmed, which may be faster but could lead to errors if you immediately try to use the DID.

Defaults to true.

visibilityTimeoutMs?

number

The maximum time (in milliseconds) to wait for the DID to be visible on the network. This option is only relevant if waitForDIDVisibility is set to true. If the DID is not visible within this timeout period, the function will throw an error. Defaults to 120000 milliseconds (2 minutes).

topicReader?

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 submitUpdateDIDRequest function.

Exception code Description

invalidArgument

Providers must contain client options or client or publisher.

invalidArgument

Hashgraph SDK Client must be configured with a network.

invalidArgument

Hashgraph SDK Client must be configured with an operator account.

invalidArgument

Signature and verifier are required for the signature step.

invalidArgument

No states provided.

invalidArgument

Number of states and signatures do not match.

invalidArgument

Signature for # not found.

notFound

The DID document was not found.

invalidSignature

The signature is invalid. Provided signer does not match the DID signer.

internalError

Invalid state of the operation.

internalError

Message awaiter timeout reached. Messages not found.

Function Implementation

The Hashgraph DID SDK provides a submitUpdateDIDRequest function within its registrar package. For further details, refer to the @hashgraph-did-sdk-js/registrar package documentation.