0.0.3 • Published 3 years ago

iothub-auth v0.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

iothub-auth

Generates Shared Access Keys to connect to Azure IoT Hub from ES6 modules

Node.js CI

api-versions support

IoT Hub has two authentication schemes:

  • V1 getIoTHubV1Credentials Used for classic hubs, using api-version=2020-09-30
  • V2 getIoTHubV2Credentials Used for classic hubs, using api-version=2021-06-30-preview

Usage

<script type="module">
import {getIoTHubV2Credentials} from 'https://unpkg.com/iothub-auth'
; (async ()=> {
    const [username, password, websocket] = await getIoTHubV2Credentials(
        'host', 
        'device', 
        'MDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDA=')
    document.write(username,password)
})()
</script>