generateDeactivateDIDRequest API Reference

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

Function Signature

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

The generateDeactivateDIDRequest function is invoked with providers and options parameters. The providers parameter encapsulates configuration parameters for interacting with the Hedera network, while the options parameter provides relevant configuration options for the DID deactivation request.

function generateDeactivateDIDRequest(
  options: GenerateDeactivateDIDRequestOptions,
  providers: PublisherProviders,
): Promise<DeactivateDIDRequest>;

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 deactivation 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

GenerateDeactivateDIDRequestOptions

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

Return Value

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

The table below describes the structure of the DeactivateDIDRequest type.

Name Type Description

state

RunnerState<DIDDeactivateMessage>

The current state of the DID deactivation process. Enables resuming the process after signing the request.

signingRequest

SigningRequest

The request to be signed by the client. Contains the serialized payload of the DID deactivation transaction and metadata (refer to SigningRequest Type for details).

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.

GenerateDeactivateDIDRequestOptions Type

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

Name Type Description

did

string

The DID string of the Decentralized Identifier to deactivate.

topicReader?

TopicReader

An instance of a TopicReader responsible for reading messages from the Hedera network topic.

SigningRequest Type

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

Name Type Description

payload

object

An object containing the payload of the DID message to be signed.

serializedPayload

Uint8Array

A serialized bytes representation of the DID message payload. Actual bytes to be signed.

multibasePublicKey

string

The public key of the corresponding private key required to sign the request.

alg

string

The algorithm used for signing the request. Currently, only Ed25519 is supported.

Errors

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

internalError

DID root key not found in a DID Document.

Function Implementation

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