Skip to content

Commit 1e95483

Browse files
committed
Convert README.rst to markdown
1 parent 6997ab1 commit 1e95483

3 files changed

Lines changed: 96 additions & 106 deletions

File tree

README.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# python-bna
2+
[![Build Status](https://api.travis-ci.org/jleclanche/python-bna.svg?branch=master)](https://travis-ci.org/jleclanche/python-bna)
3+
4+
5+
## Command-line usage
6+
7+
bna is a command line interface to the python-bna library. It can store
8+
and manage multiple authenticators, as well as create new ones.
9+
10+
11+
Remember: Using an authenticator on the same device as the one you log in with
12+
is less secure than keeping the devices separate. Use this at your own risk.
13+
14+
Configuration is stored in `~/.config/bna/bna.conf`. You can pass a
15+
different config path with `bna --config=~/.bna.conf` for example.
16+
17+
18+
### Creating a new authenticator
19+
20+
$ bna new
21+
22+
If you do not already have an authenticator, it will be set as default.
23+
You can pass `--set-default` otherwise.
24+
25+
26+
### Getting an authentication token
27+
28+
$ bna
29+
01234567
30+
$ bna EU-1234-1234-1234
31+
76543210
32+
33+
34+
### Getting an authenticator's restore code
35+
36+
$ bna show-restore-code
37+
Z45Q9CVXRR
38+
$ bna restore EU-1234-1234-1234 ABCDE98765
39+
Restored EU-1234-1234-1234
40+
41+
42+
### Getting an OTPAuth URL
43+
44+
To display the OTPAuth URL (used for setup QR Codes):
45+
46+
$ bna show-otpauth-url
47+
otpauth://totp/Blizzard:EU123412341234:?secret=ASFAS75ASDF75889G9AD7S69AS7697AS&issuer=Blizzard&digits=8
48+
49+
Now paste this to your OTP app, or convert to QRCode and scan, or
50+
manually enter the secret.
51+
52+
This is compatible with standard TOTP clients and password managers such as:
53+
- [andOTP](https://play.google.com/store/apps/details?id=org.shadowice.flocke.andotp) (Android),
54+
- [KeepassXC](https://keepassxc.org/) (Cross-platform)
55+
- [1Password](https://1password.com/) (Cross-platform)
56+
57+
58+
#### Getting a QR code
59+
60+
To encode to a QRCode on your local system install \'qrencode\'
61+
62+
For a PNG file saved to disk :
63+
64+
$ bna --otpauth-url | qrencode -o ~/BNA-qrcode.png
65+
# Scan QRCode
66+
$ rm ~/BNA-qrcode.png
67+
68+
Or to attempt ot display QRCode in terminal as text output :
69+
70+
$ bna --otpauth-url | qrencode -t ANSI
71+
72+
73+
## Python library usage
74+
75+
### Requesting a new authenticator
76+
77+
```py
78+
import bna
79+
try:
80+
# region is EU or US
81+
# note that EU authenticators are valid in the US, and vice versa
82+
serial, secret = bna.request_new_serial("US")
83+
except bna.HTTPError as e:
84+
print("Could not connect:", e)
85+
```
86+
87+
### Getting a token
88+
89+
```py
90+
# Get and print a token using PyOTP
91+
from pyotp import TOTP
92+
totp = TOTP(secret, digits=8)
93+
print(totp.now())
94+
```

README.rst

Lines changed: 0 additions & 106 deletions
This file was deleted.

setup.cfg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
name = bna
33
version = 4.1.0
44
description = Blizzard Authenticator and OTP library in Python
5+
long_description = file: README.md
6+
long_description_content_type = text/markdown
57
author = Jerome Leclanche
68
author_email = jerome@leclan.ch
79
url = https://github.com/jleclanche/python-bna/

0 commit comments

Comments
 (0)