SharedAccessSignature class

Shared access signature tokens are used to authenticate the connection when using symmetric keys (as opposed to x509 certificates) to secure the connection with the Azure IoT hub.

Methods

create(string, string, string, string | number)

Instantiate a SharedAccessSignature token with the given parameters.

extend(number)

Extend the Sas and return the string form of it.

parse(string, string[])

Instantiate a SharedAccessSignature token from a string.

toString()

Formats a SharedAccessSignatureObject into a properly formatted string.

Method Details

create(string, string, string, string | number)

Instantiate a SharedAccessSignature token with the given parameters.

static function create(resourceUri: string, keyName: string, key: string, expiry: string | number): SharedAccessSignature

Parameters

resourceUri

string

the resource URI to encode into the token.

keyName

string

an identifier associated with the key.

key

string

a base64-encoded key value.

expiry

string | number

an integer value representing the number of seconds since the epoch 00:00:00 UTC on 1 January 1970.

Returns

A shared access signature token.

extend(number)

Extend the Sas and return the string form of it.

function extend(expiry: number): string

Parameters

expiry

number

an integer value representing the number of seconds since the epoch 00:00:00 UTC on 1 January 1970.

Returns

string

The string form of the shared access signature.

parse(string, string[])

Instantiate a SharedAccessSignature token from a string.

static function parse(source: string, requiredFields?: string[]): SharedAccessSignature

Parameters

source

string

the string to parse in order to create the SharedAccessSignature token.

requiredFields

string[]

an array of fields that we expect to find in the source string.

Returns

A shared access signature token.

toString()

Formats a SharedAccessSignatureObject into a properly formatted string.

function toString(): string

Returns

string

A properly formatted shared access signature token.