Skip to main content

Tanker identity library

Project description

Tanker identity generation in Python for the Tanker SDK.

https://travis-ci.org/TankerHQ/identity-python.svg?branch=master https://img.shields.io/pypi/v/tankersdk_identity.svg https://img.shields.io/codecov/c/github/TankerHQ/identity-python.svg?label=Coverage

Installation

With pip:

$ pip install tankersdk-identity

Usage

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.

Source Distribution

tankersdk-identity-1.1.0.tar.gz (7.4 kB view hashes)

Uploaded Source

Built Distribution

tankersdk_identity-1.1.0-py2.py3-none-any.whl (11.5 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page