Blizzard Authenticator and OTP library in Python
Project description
python-bna
Requirements
- Python 3.6+
Command-line usage
bna is a command line interface to the python-bna library. It can store and manage multiple authenticators, as well as create new ones.
Remember: Using an authenticator on the same device as the one you log in with is less secure than keeping the devices separate. Use this at your own risk.
Configuration is stored in ~/.config/bna/bna.conf
. You can pass a
different config path with bna --config=~/.bna.conf
for example.
Creating a new authenticator
$ bna new
If you do not already have an authenticator, it will be set as default.
You can pass --set-default
otherwise.
Getting an authentication token
$ bna
01234567
$ bna EU-1234-1234-1234
76543210
Getting an authenticator's restore code
$ bna show-restore-code
Z45Q9CVXRR
$ bna restore EU-1234-1234-1234 ABCDE98765
Restored EU-1234-1234-1234
Getting an OTPAuth URL
To display the OTPAuth URL (used for setup QR Codes):
$ bna show-url
otpauth://totp/Blizzard:EU123412341234:?secret=ASFAS75ASDF75889G9AD7S69AS7697AS&issuer=Blizzard&digits=8
Now paste this to your OTP app, or convert to QRCode and scan, or manually enter the secret.
This is compatible with standard TOTP clients and password managers such as:
Getting a QR code
To encode to a QRCode on your local system install 'qrencode'
For a PNG file saved to disk :
$ bna show-url | qrencode -o ~/BNA-qrcode.png
# Scan QRCode
$ rm ~/BNA-qrcode.png
Or to attempt ot display QRCode in terminal as text output :
$ bna --otpauth-url | qrencode -t ANSI
Python library usage
Requesting a new authenticator
import bna
try:
# region is EU or US
# note that EU authenticators are valid in the US, and vice versa
serial, secret = bna.request_new_serial("US")
except bna.HTTPError as e:
print("Could not connect:", e)
Getting a token
# Get and print a token using PyOTP
from pyotp import TOTP
totp = TOTP(secret, digits=8)
print(totp.now())
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
Built Distribution
File details
Details for the file bna-5.1.0.tar.gz
.
File metadata
- Download URL: bna-5.1.0.tar.gz
- Upload date:
- Size: 9.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.0a2 CPython/3.10.2 Linux/5.16.4-arch1-1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6c53527bc8fe35853f4962b67c8056d98b5adb6ba6cfd713506bc175bbb67a7 |
|
MD5 | 89927627605f2ecbc05e1fdfe2c724bc |
|
BLAKE2b-256 | 9cad0fc9852ebd44187830c4c1998e6d1aa697d003b59fae6890eabb1456b374 |
File details
Details for the file bna-5.1.0-py3-none-any.whl
.
File metadata
- Download URL: bna-5.1.0-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.0a2 CPython/3.10.2 Linux/5.16.4-arch1-1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0530ec32406b24404ae98ae422fc15dc3c46ce441912a6c12f3e4bd0e942323 |
|
MD5 | 0340974bd2914f1d8ccf212d66a02295 |
|
BLAKE2b-256 | 760be823367598f27bc27833952a1509854d09e77bbcb1031f1106b26eee40d9 |