Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatSASURI ¶
func GenerateSASToken ¶
func GenerateSASToken(ctx context.Context, signer Signer, uri, policyName string, expires time.Time) (string, error)
GenerateSASToken will generate a token for accessing Azure IoT Hub, from a base64-encoded key. The token is scoped to a specific resource tree identified by uri - only resources which have uri as a prefix can be accessed with this token. Device SAS tokens must be device-scoped e.g. hubname.azure-devices.net/devices/device1 FormatSASURI can be used to generate an appropriate URI.
policyName is an optional shared access policy to referred to - omit when using device-registry credentials.
Algorithm specified at https://learn.microsoft.com/en-us/azure/iot-hub/iot-hub-dev-guide-sas?tabs=node
Types ¶
type LocalSigner ¶
type LocalSigner struct {
Secret SASKey
}
type SASKey ¶
type SASKey []byte
SASKey is a secret for performing HMAC operations. Standard textual representation is base64-encoded.