Skip to main content

Tanker identity library

Project description

Tanker identity generation in Python for the Tanker SDK.


With pip:

$ pip install tankersdk-identity


import tankersdk_identity

def retrieve_identity(user_id):
    """ Fetch a previously stored identity """

 def store_identity(user_id, identity):
    """ Store a previously generated identity """

 def check_auth(user_id):
    """ Check the user is authenticated """

def serve_user_identity(user_id):
    """ Called during sign/up sign in of your users.

    Send a user identity, generated if necessary,
    but only to authenticated users
    authorized = check_auth(user_id)
    if not authorized:
        raise UnAuthorizedError()

    token = retrieve_user_identity(user_id)

    if not identity:
      identity = tankersdk_identity.create_identity(trustchain_id, trustchain_private_key, user_id)
      store_user_identity(user_id, identity)

    return identity

Going further

Read more about identities in the Tanker guide.

Check the examples folder for usage examples.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for tankersdk-identity, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size tankersdk_identity-1.0.0-py2.py3-none-any.whl (7.3 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size tankersdk-identity-1.0.0.tar.gz (4.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page