From bc499a3628d3b5a246c36504998f2f9ce8fb2639 Mon Sep 17 00:00:00 2001 From: Yuval Adam <_@yuv.al> Date: Fri, 22 Jul 2016 17:53:37 +0300 Subject: Add theoretically-correct test vector instructions in README --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index 2836919..bb688b1 100644 --- a/README.md +++ b/README.md @@ -10,3 +10,27 @@ The usual: $ pip install -r requirements.txt $ python manage.py migrate ``` + +Create an admin superuser: + +```bash +$ python manage.py createsuperuser +``` + +Open a shell: + +```bash +$ python manage.py shell +``` + +Then create a device for your user using one of the published [test vectors](https://developers.yubico.com/OTP/Test_Vectors.html): + +```python +>>> from django.contrib.auth import get_user_model +>>> user = get_user_model().objects.get(username='admin') +>>> device = user.yubikeydevice_set.create(key='000102030405060708090a0b0c0d0e0f', private_id='010203040506', session=0, counter=0) +>>> device.public_id() +b'cccccccb' # note the modhex encoded public id of the primary key (1) +``` + +You should now be able to log in to http://127.0.0.1:8000/admin/login/ using user `admin`, password `password` and the OTP token `cccccccbdvgtiblfkbgturecfllberrvkinnctnn` -- cgit v1.3.1