X509AuthenticationProvider class

Provides an AuthenticationProvider object that can be created simply with an X509 certificate and key and is then used by the device client and transports to authenticate with the Azure IoT hub instance.

Unlike the SharedAccessSignatureAuthenticationProvider and SharedAccessKeyAuthenticationProvider objects, the X509AuthenticationProvider does not emit a newTokenAvailable event since there are no token involved in X509 authentication. The transports will get the credentials using the getDeviceCredentials method.

Properties

type

Methods

fromX509Options(string, string, X509)

Creates a new X509AuthenticationProvider from an X509 object containing a certificate and key.

getDeviceCredentials()
getDeviceCredentials(Callback<TransportConfig>)

This method is used by the transports to gets the most current device credentials in the form of a TransportConfig object.

setX509Options(X509)

Updates the certificate and key used by the device to connect and authenticate with an Azure IoT hub instance.

Property Details

type

type: AuthenticationType

Property Value

AuthenticationType

Method Details

fromX509Options(string, string, X509)

Creates a new X509AuthenticationProvider from an X509 object containing a certificate and key.

static function fromX509Options(deviceId: string, iotHubHostname: string, x509info: X509): X509AuthenticationProvider

Parameters

deviceId

string

The device identifier.

iotHubHostname

string

The host name of the Azure IoT hub instance the device should connect to.

x509info

X509

An X509 object containing a certificate and key that the device can use to authenticate with the Azure IoT hub instance.

Returns

getDeviceCredentials()

function getDeviceCredentials(): Promise<TransportConfig>

Returns

Promise<TransportConfig>

getDeviceCredentials(Callback<TransportConfig>)

This method is used by the transports to gets the most current device credentials in the form of a TransportConfig object.

function getDeviceCredentials(callback?: Callback<TransportConfig>)

Parameters

callback

Callback<TransportConfig>

optional function that will be called with either an error or a set of device credentials that can be used to authenticate with the IoT hub.

setX509Options(X509)

Updates the certificate and key used by the device to connect and authenticate with an Azure IoT hub instance.

function setX509Options(x509: X509)

Parameters

x509

X509

The X509 object containing the certificate and key.