sqrlserver.url module

class sqrlserver.url.Url(authority, secure=True)

Bases: object

Represents the SQRL URL that identifies SQRL endpoints

Parameters:
  • authority (string) – The authority part of the url the SQRL client will contact to authenticate. Includes the username, password, domain, and port. See RFC 3986, Jan 2005, section 3.2 (https://tools.ietf.org/html/rfc3986#section-3.2)
  • secure (bool) – If True, uses the sqrl scheme, otherwise it uses qrl. Defaults to True.
Returns:

The initial Url object

Return type:

Url

generate(path, **kwargs)

Generates the actual URL

Parameters:

path (string) – The path portion of the URL. Must not contain any query parameters and must be absolute.

Keyword Arguments:
 
  • counter (uint) – The counter you wish to encode into the new nut (assuming you didn’t provide one). Required if a nut is to be autogenerated.
  • ext (uint) – The number of characters in the path that the SQRL client should include as part of the formal server ID. Default is 0.
  • ipaddr (string) – The IPv4 or IPv6 you wish to encode into the new nut (assuming you didn’t provide one). Defaults to ‘0.0.0.0’.
  • key (bytes) – The 32-byte key with which to encrypt the new nut (assuming you didn’t provide one). Required if a nut is to be autogenerated.
  • nut (Nut) – The nut you wish to embed in the URL. If omitted, one will be generated for you.
  • query (list) – Array of tuples, each representing additional name-value pairs that will be appended to the SQRL url.
  • timestamp (uint) – The UNIX timestamp (seconds only) you wish to encode into the new nut (assuming you didn’t provide one). Defaults to current system time.
  • type (string) – Either ‘qr’ or ‘link’. Defaults to ‘qr’. Used for setting the link type flag in the new nut.
Returns:

A string representing a valid SQRL URL

Return type:

string