generateUpdateDIDRequest API Reference

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

Function Signature

This function generates a request to update a Decentralized Identifier (DID) on the Hedera network using the Client Managed Secret Mode.

The generateUpdateDIDRequest function is invoked with providers and options parameters. The providers parameter encapsulates configuration parameters for interacting with the Hedera network, while the options parameter enables customization of the DID update procedure and passing required public key.

function generateUpdateDIDRequest(
  options: GenerateUpdateDIDRequestOptions,
  providers: PublisherProviders,
): Promise<UpdateDIDRequest>;

Parameters

The function accepts the following parameters:

  • providers: (Required) An object encapsulating configuration parameters for interacting with the Hedera network.

  • options: (Required) Update request options.

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

GenerateUpdateDIDRequestOptions

An object specifying configuration options for DID update request (refer to GenerateUpdateDIDRequestOptions Type for details).

Return Value

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

The table below describes the structure of the UpdateDIDRequest type.

Name Type Description

state

OperationState

Serialized state used by submitUpdateDIDRequest.

signingRequest

ProofSigningRequest<string[]>

Proof signing request to be signed client-side.

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.

GenerateUpdateDIDRequestOptions Type

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

Name Type Description

did

string

The DID string of the Decentralized Identifier to update.

updatedDidDocument

JsonLdDIDDocument

Full updated DID document that should become the next DID state.

verificationMethod?

string

Verification method id to use for signing-request generation. Defaults to ${did}#did-root-key.

topicReader?

TopicReader

Optional topic reader used by the flow.

Errors

The following table enumerates the exceptions that may arise during the execution of the generateUpdateDIDRequest 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.

invalidDid

The DID must be a valid Hedera DID.

notFound

The DID document was not found.

Function Implementation

The Hashgraph DID SDK provides generateUpdateDIDRequest within @swiss-digital-assets-institute/registrar.