Documentation ¶
Overview ¶
Package dps implements provisioning a device using the Azure IoT Device Provisioning Service. Only flows for SAS authentication over HTTPS are implemented. Entry point is calling Register.
Based on the Azure IoT docs at https://learn.microsoft.com/en-us/azure/iot/iot-mqtt-connect-to-iot-dps
Index ¶
Constants ¶
View Source
const ( DefaultHost = "global.azure-devices-provisioning.net" APIVersion = "2019-03-31" )
Variables ¶
View Source
var ErrEnrollmentDisabled = errors.New("enrollment is disabled")
Functions ¶
func DeriveDeviceKey ¶
DeriveDeviceKey will derive an SAS Key for a device to use with Group Enrollment. groupKey is the Group Enrollment Key. regID is the Registration ID that the device will be registered under.
func FormatSASURI ¶
Types ¶
type Registration ¶
type Registration struct { HostName string // Domain name of IoT Hub to connect to. DeviceID string }
func Register ¶
func Register(ctx context.Context, host, idScope, regID string, key auth.SASKey) (Registration, error)
Register will attempt to register a device with the device provisioning service.
- host is the hostname of the Device Provisioning Service. Defaults to DefaultHost if empty.
- idScope identifies the instance of device provisioning service to register the device in. Required.
- regID is an identifier for the registration, unique within an idScope. If using Group Enrollments, then the Registration ID becomes the new Device ID.
- key is the shared secret used to authenticate the device. Required.
func (Registration) AsConnectionParameters ¶
func (r Registration) AsConnectionParameters() iothub.ConnectionParameters
Click to show internal directories.
Click to hide internal directories.