This commit is contained in:
EggMan20339 2024-05-09 22:34:53 -04:00
parent b42085c6ef
commit eabd40db41

10
main.py
View File

@ -33,7 +33,7 @@ On Windows, the native WebAuthn API will be used.
"""
import time
import configparser
gpie = True
gpie = False
if gpie:
import RPi.GPIO as GPIO
import pickle
@ -54,7 +54,7 @@ config = configparser.ConfigParser()
config.read('config.ini')
nfc = False
isNfc = False
dbusername = config.get('Setup', 'dbusername')
dbpassword = config.get('Setup', 'dbpassword')
@ -110,10 +110,10 @@ class CliInteraction(UserInteraction):
print("User Verification required.")
return True
clf = nfc.ContactlessFrontend('usb')
def read_nfc_tag():
clf = None
try:
clf = nfc.ContactlessFrontend('usb')
tag = clf.connect(rdwr={'on-connect': lambda tag: False})
nfc = True
return tag.identifier if tag else None
@ -126,7 +126,7 @@ def read_nfc_tag():
pass
while True:
nfc = False
isNfc = False
if gpie:
GPIO.output(door, GPIO.LOW)
@ -247,7 +247,7 @@ while True:
request_options, state = server.authenticate_begin(credentials, user_verification=uv)
# Authenticate the credential
if not nfc:
if not isNfc:
result = client.get_assertion(request_options["publicKey"])
else:
sendme = cbor.encode(credentials)