Tanker user token library
Project description
User token generation in Python for the Tanker SDK.
Installation
With pip:
$ pip install tankersdk-user-token
Usage
import tankersdk.usertoken
def retrieve_user_token(user_id):
""" Fetch a previously stored token """
...
def store_user_token(user_id, token):
""" Store a previously generated token """
...
def check_auth(user_id):
""" Check the user is authenticated """
...
def serve_user_token(user_id):
""" Called during sign/up sign in of your users.
Send a user token, generated if necessary, but only to
authenticated users
"""
authorized = check_auth(user_id)
if not authorized:
raise UnAuthorizedError()
token = retrieve_user_token(user_id)
if not token:
token = tankersdk.usertoken.generate_user_token(trustchain_id, trustchain_private_key, user_id)
store_user_token(user_id, token)
return token
Going further
Read more about user tokens 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
Close
Hashes for tankersdk_user_token-0.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7f23c01324c71f1a7f1a095c946de2f58763e1cd915b7bb44d08330cbd9841c0 |
|
MD5 | cc320f03d568c0cf4bd1407d545dc493 |
|
BLAKE2b-256 | 97d0979a975ddb1ca9685258c96880a3c7c6537c98de145444edbedf12121c99 |