Encapsulates a DWN Protocol with its associated metadata and configuration.

This class primarly exists to provide developers with a convenient way to configure/install protocols on remote DWNs.

Constructors

  • Constructs a new instance of the Protocol class.

    Parameters

    • agent: Web5Agent

      The Web5Agent instance used for network interactions.

    • protocolsConfigureMessage: ProtocolsConfigureMessage

      The configuration message containing the protocol details.

    • metadata: ProtocolMetadata

      Metadata associated with the protocol, including the author and optional message CID.

    Returns Protocol

Properties

_agent: Web5Agent

The Web5Agent instance that handles DWNs requests.

_metadata: ProtocolMetadata

The ProtocolsConfigureMessage containing the detailed configuration for the protocol.

_protocolsConfigureMessage: ProtocolsConfigureMessage

Metadata associated with the protocol, including the author and optional message CID.

Accessors

  • get definition(): ProtocolDefinition
  • Retrieves the protocol definition from the protocol's configuration message.

    Returns ProtocolDefinition

    The protocol definition.

Methods

  • Sends the protocol configuration to a remote DWN identified by the target DID.

    Parameters

    • target: string

      The DID of the target DWN to which the protocol configuration will be installed.

    Returns Promise<DwnResponseStatus>

    A promise that resolves to an object containing the status of the send operation.

  • Serializes the protocol's configuration message to JSON.

    Returns ProtocolsConfigureMessage

    The serialized JSON object of the protocol's configuration message.