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-user-token.svg

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-0.1.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

tankersdk_identity-0.1.0-py2.py3-none-any.whl (7.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file tankersdk-identity-0.1.0.tar.gz.

File metadata

  • Download URL: tankersdk-identity-0.1.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for tankersdk-identity-0.1.0.tar.gz
Algorithm Hash digest
SHA256 73ca962f7d77b4e7a5e49eb1b727d244821cd3fa10d41272469fddf2149b3e04
MD5 8005a5ebb8df40d473e4b814ea59bbfd
BLAKE2b-256 b5406daf71177cf3fa99766e29941a6c7b6541c16226b29f4e2a40bc4496dc19

See more details on using hashes here.

File details

Details for the file tankersdk_identity-0.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: tankersdk_identity-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for tankersdk_identity-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 cdd060926959cd7f8da22e9c58e4fdca7f00091c96bb2996abcb83f077b04ca0
MD5 5a4e5e0e0da78b31322e50144040a663
BLAKE2b-256 3d8a4751440235151e23135d806677247918aab8fcbc2cf9edfff47628b98cb1

See more details on using hashes here.

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