tinesight.registrar#

Classes

TinesightRegistrar([country_name, state, ...])

Represents a Tinesight tenant, with functionality for generating a signed certificate per device.

class tinesight.registrar.TinesightRegistrar(country_name: str = 'US', state: str | None = None, organization: str | None = None)#

Represents a Tinesight tenant, with functionality for generating a signed certificate per device.

Examples:
>>> tsr = TinesightRegistrar()
>>> tsr.login(my_tinesight_account_user_name, my_tinesight_account_password)
>>> cert = tsr.register_device(my_local_key_path, device_id)
>>> with open('mydevice.crt', 'w') as fp:
>>>     fp.write(cert)

By following this example you can then instantiate a TinesightClient to invoke the Tinesight API.

login(username: str, password: str) TinesightRegistrar#

Basic login to using Cognito IDP with the SRP flow. This method is required to be called prior to registering any devices.

register_device(device_id: str, pem_key_path: Path, key_password: str = None, renew: bool = False) bytes | None#

Registers a uniquely identified device for your account by creating a certificate signing request and returning a signed certificate identifying your device, which will enable mTLS invocation of the Tinesight API. Certificates expire after one year.

If a device with this device_id has already been registered and its certificate is not expired, an exception will be thrown. If the certificate for this device is expired, a new certificate will be returned.

This method requires the TinesightRegistrar.login() method to have been called prior to executing.

Parameters:
  • device_id – unique device identifier

  • pem_key_path – path to your secret key

  • key_password – str, default None - password to your secret key

  • renew – bool, default False - if True, will force a renewal of the certificate

Returns:

certificate (bytes)

unregister_device(device_id: str)#

Unregisters a device (idempotent) from your account.

Parameters:

device_id – unique device identifier

Returns:

dict