How to use the azure-iot-provisioning-device.ProvisioningDeviceConstants.userAgent function in azure-iot-provisioning-device

To help you get started, we’ve selected a few azure-iot-provisioning-device examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Azure / azure-iot-sdk-node / provisioning / transport / http / src / http.ts View on Github external
private _ensureRestApiClient(request: RegistrationRequest): void {
    if (!this._restApiClient) {
      this._restApiClient = new RestApiClient({ 'host' : request.provisioningHost , 'x509' : this._auth}, ProvisioningDeviceConstants.userAgent, this._httpBase);
    }
  }
github Azure / azure-iot-sdk-node / provisioning / transport / amqp / src / amqp.ts View on Github external
private _getAuthChallenge(request: RegistrationRequest, callback: (err: Error, tpmChallenge?: Buffer) => void): void {
    /*Codes_SRS_NODE_PROVISIONING_AMQP_18_012: [ `getAuthenticationChallenge` shall send the challenge to the AMQP service using a hostname of "/registrations/". ]*/
    /*Codes_SRS_NODE_PROVISIONING_AMQP_18_013: [ `getAuthenticationChallenge` shall send the initial buffer for the authentication challenge in the form "<0><0><0>" where <0> is a zero byte. ]*/
    /*Codes_SRS_NODE_PROVISIONING_AMQP_18_014: [ `getAuthenticationChallenge` shall send the initial response to the AMQP service in the form  "<0>" where <0> is a zero byte. ]*/
    /*Codes_SRS_NODE_PROVISIONING_AMQP_18_011: [ `getAuthenticationChallenge` shall initiate connection with the AMQP client using the TPM SASL mechanism. ]*/
    this._customSaslMechanism = new SaslTpm(request.idScope, request.registrationId, this._endorsementKey, this._storageRootKey, (challenge, getSasTokenCallback) => {
      this._getSasTokenCallback = getSasTokenCallback;
      /*Codes_SRS_NODE_PROVISIONING_AMQP_18_015: [ `getAuthenticationChallenge` shall call `callback` passing `null` and the challenge buffer after the challenge has been received from the service. ]*/
      callback(null, challenge);
    });

    const config: AmqpBaseTransportConfig = {
      uri: this._getConnectionUri(request),
      saslMechanismName: this._customSaslMechanism.name,
      saslMechanism: this._customSaslMechanism,
      userAgentString: ProvisioningDeviceConstants.userAgent
    };
    this._amqpBase.connect(config, (err) => {
      this._amqpStateMachine.handle('tpmConnectionComplete', err);
    });
  }