Software
For the basic walkthrough of how this code works, see https://google.github.io/makerspace-auth/client/Walkthrough.html
Prerequisites:
- Python 2.7 or 3.6+
evdev(python-evdev on Debian)RPimodule (orpip install fake-rpifor testing)- Make sure you're in the 'input' group to use evdev
- Make sure you're in the gpio group if you're on a Pi
Developing:
- The easiest way is to run
make setupand then. .venv/bin/activate. - You can also run the tests with tox, using
tox -p all - The code is formatted with isort+black, run
make lintand/ormake formatbefore sending pull requests.
Protocol
While using a server is optional (you can do everything with shell scripts), we use a simple HTTP-based protocol that's intended to be easy to adapt to existing systems. See https://google.github.io/makerspace-auth/server/Protocol.html
QA example
This simply flashes a light when its button is pressed. We use this to run QA on authboards once assembled, and is a very simple example of how the event loop works.
Two-button example
We determined two buttons ("on" and "off", basically) to be the minimum viable controls, and this is the version that we use at Google. If you're looking for a good jumping-off point, start here.
The basic workflow is:
- Scan badge
- Press "on". Tool will power up.
- Warning timer commences beeps. If you press "on" again, you get more time.
- Otherwise, tool powers off.
You should copy (or symlink) this file to ~/.authboxrc and make edits to conform to your pin numbers. The defaults are for an RDR-6081AKU (keystroking) and pi-hat-1 v1.0 hardware triggering both onbarod relays to enable devices.
This example out of the box stores authorized users in a local file
(See sample_auth_check.sh) but you likely want it to query your existing
user/training database. If you'd like to use the same protocol, that's
documented at
https://google.github.io/makerspace-auth/server/Protocol.html and if you use
curl, remember the '-f'.
Starting on boot
The simplest way that works on all distros is a cron job:
# Visually
pi$ crontab -e
(add the following line at the end, save, and apply)
@reboot cd /path/to/software; python two_button.py
# Through script
pi$ (crontab -l; echo "@reboot cd /path/to/software; python two_button.py") | crontab -
If your distro uses systemd, you can also make a systemd unit that runs it.
Metadata
Release files for authbox 1.0.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 | |
|---|---|---|---|
| authbox-1.0.0.tar.gz | 28.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| authbox-1.0.0-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details |
Total release size: 53.3 kB
Release files / authbox-1.0.0.tar.gz
| Download URL | authbox-1.0.0.tar.gz |
|---|---|
| Size | 28.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
53cea7f39c2f28440e6d132ec98056b35424f496b6d5ba98b05f65118555e10a
|
|
BLAKE2b-256 checksum How to use checksums |
5d8938fcd09b8659aec1fdaefe45cc12aa95170c67f38bd05670f6662438eada
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.8.0
|
Release files / authbox-1.0.0-py2.py3-none-any.whl
| Download URL | authbox-1.0.0-py2.py3-none-any.whl |
|---|---|
| Size | 24.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
7f4bece15f09e46e725862981fe7a14c2d31bbfa17690eee04d19a162c59f9b4
|
|
BLAKE2b-256 checksum How to use checksums |
297226853ea106a65f8b2e10b39444bffa872a04b770f4aaafccf0def12e67f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.38.0 CPython/3.8.0
|