Tanker identity library
Project description
Tanker identity generation in Python for the Tanker SDK.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file tankersdk-identity-1.0.0.tar.gz
.
File metadata
- Download URL: tankersdk-identity-1.0.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 24ca85bed72190301e0781abd11341b714ad1baa47429789f8a656437b55f946 |
|
MD5 | 1d236cb522e549acf0ebefc1c1e7eb85 |
|
BLAKE2b-256 | 811b03d7944731dd1329aff622d09a16d743e50541380680c647fd560f693fbf |
File details
Details for the file tankersdk_identity-1.0.0-py2.py3-none-any.whl
.
File metadata
- Download URL: tankersdk_identity-1.0.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | f7337b41d63533beefa2d4868c4b986afecda42d2a23f31124e509feae0478e9 |
|
MD5 | ddbb7498ac6944829c9a1d60ba0b0002 |
|
BLAKE2b-256 | 772fd1f6e6fd8cd6602c1e4641a9df53793f05884980e80b5ecb04dca8eae55b |