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())
Metadata
Release files for bna 5.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| bna-5.1.0.tar.gz | 9.8 kB | Without provenance | Details for bna-5.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bna-5.1.0-py3-none-any.whl | Python 3 | none | any | Details for bna-5.1.0-py3-none-any.whl |
Total release size: 19.9 kB
Release files / bna-5.1.0.tar.gz
| Download URL | bna-5.1.0.tar.gz |
|---|---|
| Size | 9.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f6c53527bc8fe35853f4962b67c8056d98b5adb6ba6cfd713506bc175bbb67a7
|
|
BLAKE2b-256 checksum How to use checksums |
9cad0fc9852ebd44187830c4c1998e6d1aa697d003b59fae6890eabb1456b374
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.0a2 CPython/3.10.2 Linux/5.16.4-arch1-1
|
Release files / bna-5.1.0-py3-none-any.whl
| Download URL | bna-5.1.0-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a0530ec32406b24404ae98ae422fc15dc3c46ce441912a6c12f3e4bd0e942323
|
|
BLAKE2b-256 checksum How to use checksums |
760be823367598f27bc27833952a1509854d09e77bbcb1031f1106b26eee40d9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.0a2 CPython/3.10.2 Linux/5.16.4-arch1-1
|
Security for bna 5.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.