A webservice that exposes NFC methods through a socket.io connection. Currently mainly aimed towards reading and writing NDEF messages on NTAG213 for cashless drinks app CatLab Drinks.
We are running our service on a Raspberry Pi 3 running Ubuntu, but these instructions should be working on all Ubuntu/Debian machines.
sudo apt install libtool-bin
sudo apt install libpcsclite1 libpcsclite-dev
sudo apt install pcscd
npm install
Make sure libnfc is working and that you blacklist the required modules. https://github.com/nfc-tools/libnfc
In order to prevent unauthorized access to the reader you need to setup a password in your .env file (or in your environment variables).
cp .env.example .env
nano .env
And add a password at NFC_PASSWORD=
Your browser will block websites loaded over https from accessing unencrypted websites, so in order for your webapp to be able to connect to this service you will need to load the webapp over unencrypted http access, or implement encryption by adding an apache/nginx reverse proxy and purchasing an ssl certificate on top of this service.
In order to disable the beeper we need to disable a security measure:
Now make sure the service automatically starts when turning on the system: (We are using PM2, but there are various alternatives) https://www.digitalocean.com/community/tutorials/how-to-use-pm2-to-setup-a-node-js-production-environment-on-an-ubuntu-vps
pm2 startup