How to use the azure-iot-security-tpm.TpmAuthenticationProvider function in azure-iot-security-tpm

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

github Azure / azure-iot-sdk-node / provisioning / device / samples / register_tpm.js View on Github external
provisioningClient.register(function(err, result) {
  if (err) {
    console.log("error registering device: " + err);
  } else {
    console.log('registration succeeded');
    console.log('assigned hub=' + result.registrationState.assignedHub);
    console.log('deviceId=' + result.registrationState.deviceId);
    var tpmAuthenticationProvider = tpmSecurity.TpmAuthenticationProvider.fromTpmSecurityClient(result.registrationState.deviceId, result.registrationState.assignedHub, securityClient);
    var hubClient = Client.fromAuthenticationProvider(tpmAuthenticationProvider, iotHubTransport);

    var connectCallback = function (err) {
      if (err) {
        console.error('Could not connect: ' + err.message);
      } else {
        console.log('Client connected');
        var message = new Message('Hello world');
        hubClient.sendEvent(message, printResultFor('send'));
      }
    };

    hubClient.open(connectCallback);

    function printResultFor(op) {
      return function printResult(err, res) {

azure-iot-security-tpm

Azure IoT TPM security client

MIT
Latest version published 5 months ago

Package Health Score

81 / 100
Full package analysis

Similar packages