Class: Config

Config(brokerCaBundle, cert, privateKey, brokers)

new Config(brokerCaBundle, cert, privateKey, brokers)

The Data Exchange Layer (DXL) client configuration contains the information necessary to connect a Client to the DXL fabric.

The configuration includes the required PKI information (client certificate, client private key, broker CA certificates) and the set of DXL message brokers that are available to connect to on the fabric.

Name Type Description
brokerCaBundle String

The bundle containing the broker CA certificates in PEM format.

cert String

The client certificate in PEM format.

privateKey String

The client private key in PEM format.

brokers Array.<Broker>

An array of Broker objects representing brokers comprising the DXL fabric.

var dxl = require('@opendxl/dxl-client')
var fs = require('fs')
var config = new dxl.Config(

var client = new dxl.Client(config)


brokerCaBundle :String

The bundle containing the broker CA certificates in PEM format.

  • String

brokers :Array.<Broker>

An array of Broker objects representing brokers comprising the DXL fabric.


cert :String

The client certificate in PEM format.

  • String

keepAliveInterval :number

The maximum period in seconds between communications with a connected Broker. If no other messages are being exchanged, this controls the rate at which the client will send ping messages to the Broker.

  • number
Default Value:
  • 1800

privateKey :String

The client private key in PEM format.

  • String

reconnectDelay :Number

The delay between retry attempts in seconds.

  • Number
Default Value:
  • 1


(static) createDxlConfigFromFile(configFile) → {Config}

This method allows creation of a Config object from a specified configuration file. The information contained in the file has a one-to-one correspondence with the Config constructor.


Name Type Description
configFile String

Path to the configuration file

  • If an error is encountered when attempting to read the configuration file.

  • If one or more of the entries in the broker section of the configuration is invalid.


A Config object corresponding to the specified configuration file.

var config = dxl.Config.createDxlConfigFromFile(c:\\certs\\dxlclient.config)

(static) provisionConfig(configDir, commonOrCsrFileName, hostInfo, optionsopt)

Provisions a DXL client by performing the following steps:

  • Either generates a certificate signing request and private key, storing each to a file (the default), or reads the certificate signing request from a file (if the certRequestFile property under the options object is present and has a truthy value).

  • Sends the certificate signing request to a signing endpoint on a management server. If the request is successfully authenticated and authorized, the management server is expected to respond with the following data:

    • [ca bundle] - a concatenation of one or more PEM-encoded CA certificates
    • [signed client cert] - a PEM-encoded certificate signed from the certificate request
    • [broker config] - zero or more lines, each delimited by a line feed character, for each of the brokers known to the management service. Each line contains a key and value, delimited by an equal sign. The key contains a broker guid. The value contains other metadata for the broker, e.g., the broker guid, port, hostname, and ip address. For example: "[guid1]=[guid1];8883;broker;\n[guid2]=[guid2]...".
  • Saves the [ca bundle] and [signed client cert] to separate files.

  • Creates a "dxlclient.config" file with the following sections:

    • A "Certs" section with certificate configuration which refers to the locations of the private key, ca bundle, and certificate files.
    • A "Brokers" section with the content of the [broker config] provided by the management service.
Name Type Attributes Description
configDir String

Directory in which to store the configuration data.

commonOrCsrFileName String

A string representing either a common name (CN) to add into the generated file or the path to the location of an existing CSR file. The parameter is interpreted as a path to an existing CSR file if a property named certRequestFile exists on the command object and has a truthy value. If the parameter represents a path to an existing CSR file, this function does not generate a new CSR file.

hostInfo Object

Info for the management service host.

Name Type Attributes Default Description
user String

Username to run remote commands as.

password String

Password for the management service user.

port String <optional>

Port at which the management service resides.

truststore String <optional>

Location of a file of CA certificates to use when verifying the management service's certificate. If no value is specified, no validation of the management service's certificate is performed.

options Object <optional>

Additional options for the provision operation.

Name Type Attributes Default Description
certRequestFile Boolean <optional>

If present and truthy, interprets the commonOrCsrFileName parameter as the name of an existing CSR file.

filePrefix String <optional>

Prefix of the private key, CSR, and certificate to store.

opensslbin String <optional>

Path to the openssl executable. If not specified, the function attempts to find the openssl executable from the environment path.

passphrase String <optional>

Password to use for encrypting the private key.

san Array.<String> <optional>

List of subject alternative names to add to the CSR.

country String <optional>

Country (C) to use in the CSR's Subject DN.

stateOrProvince String <optional>

State or province (ST) to use in the CSR's Subject DN.

locality String <optional>

Locality (L) to use in the CSR's Subject DN.

organization String <optional>

Organization (O) to use in the CSR's Subject DN.

organizationalUnit String <optional>

Organizational Unit (OU) to use in the CSR's Subject DN.

emailAddress String <optional>

E-mail address to use in the CSR's Subject DN.

doneCallback function <optional>

Callback to invoke once the provisioned configuration has been stored. If an error occurs, the first parameter supplied to the doneCallback is an Error instance containing failure details.