Skip to main content

Python package for the threebot authenticator app

Project description

Python package for interacting with threefold login

Usage

Initialize the authenticator

from ThreefoldLoginPkg import ThreefoldLogin
import string 
import random 

api_host = 'https://login.staging.jimber.org'
app_id = 'testapp'
seed_phrase = seed_phrase = 'calm science teach foil burst until ' \
              'next mango hole sponsor fold bottom ' \
              'cousin push focus track truly tornado ' \
              'turtle over tornado teach large fiscal'
redirect_url = "/callback"
kyc_backend_url = 'https://openkyc.staging.jimber.org'
authenticator = ThreefoldLogin (api_host,
    app_id,
    seed_phrase,
    redirect_url,
    kyc_backend_url
)

Generate a login request

allowed = string.ascii_letters + string.digits
state = ''.join(random.SystemRandom().choice(allowed) for _ in range(32))
url = authenticator.generate_login_url(state)

Redirect the user to the giving URL

Redirect the user to url

Callback

The callback will be send to https://{app_id}/{redirect_url}

try:
    authenticator.parse_and_validate_redirect_url(callback_url, state)
    print('successfully validated login attempt')
    if authenticator.is_email_verified():
        print('email is verified')
    else:
        print('email is not verified')
except ValueError:
    print('failed to validate login attempt')

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

threefoldlogin-0.0.1.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

threefoldlogin-0.0.1-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file threefoldlogin-0.0.1.tar.gz.

File metadata

  • Download URL: threefoldlogin-0.0.1.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/51.1.1 requests-toolbelt/0.8.0 tqdm/4.55.1 CPython/3.8.5

File hashes

Hashes for threefoldlogin-0.0.1.tar.gz
Algorithm Hash digest
SHA256 5485128ba27619bbde222dfdd3bf538a1bef9319e02f1bf0774926831437de61
MD5 156456a541018e2029a7b2a1c767831c
BLAKE2b-256 ecd755a5490b2d0cdf31109f9155bbfaf46674d226da2c650811fbc324bef887

See more details on using hashes here.

File details

Details for the file threefoldlogin-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: threefoldlogin-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/51.1.1 requests-toolbelt/0.8.0 tqdm/4.55.1 CPython/3.8.5

File hashes

Hashes for threefoldlogin-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4c5692f272c7aa9bfef7a7833cfa5a265388ec44d111da2a5b119b190c40d7ea
MD5 cdd6196fe5ff860100fea9f266a087a7
BLAKE2b-256 e0d1c790f86b5930b62055bd7727519ebd0386515bd85ae9fc42957f15798164

See more details on using hashes here.

Supported by

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