changes
This commit is contained in:
parent
ecf9949d42
commit
9ee5a8a9f0
26
main.py
26
main.py
@ -46,8 +46,14 @@ from fido2.ctap2 import Ctap2
|
||||
|
||||
gotAaguid = None
|
||||
GPIO.setmode(GPIO.BCM)
|
||||
GPIO.setup(14, GPIO.OUT)
|
||||
GPIO.output(14, GPIO.LOW)
|
||||
|
||||
greenLed = 14
|
||||
redLed = 4
|
||||
|
||||
GPIO.setup(greenLed, GPIO.OUT)
|
||||
GPIO.output(greenLed, GPIO.LOW)
|
||||
GPIO.setup(redLed, GPIO.OUT)
|
||||
GPIO.output(redLed, GPIO.LOW)
|
||||
class CliInteraction(UserInteraction):
|
||||
def prompt_up(self):
|
||||
print("\nTouch your authenticator device now...\n")
|
||||
@ -63,10 +69,10 @@ def badCred():
|
||||
print("Bad credential!")
|
||||
time.sleep(2)
|
||||
while True:
|
||||
GPIO.output(14, GPIO.LOW)
|
||||
# GPIO.output(14, GPIO.LOW)
|
||||
print("Waiting for device...")
|
||||
while True:
|
||||
GPIO.output(14, GPIO.LOW)
|
||||
# GPIO.output(14, GPIO.LOW)
|
||||
dev = next(CtapHidDevice.list_devices(), None)
|
||||
|
||||
if dev:
|
||||
@ -186,16 +192,20 @@ while True:
|
||||
print("Credential authenticated!")
|
||||
|
||||
for i in range(5):
|
||||
GPIO.output(14, GPIO.HIGH)
|
||||
GPIO.output(greenLed, GPIO.HIGH)
|
||||
time.sleep(0.05)
|
||||
GPIO.output(14, GPIO.LOW)
|
||||
GPIO.output(greenLed, GPIO.LOW)
|
||||
time.sleep(0.05)
|
||||
|
||||
print("CLIENT DATA:", result.client_data)
|
||||
print()
|
||||
print("AUTH DATA:", result.authenticator_data)
|
||||
GPIO.output(14, GPIO.LOW)
|
||||
# GPIO.output(14, GPIO.LOW)
|
||||
time.sleep(1)
|
||||
except Exception as e:
|
||||
GPIO.output(14, GPIO.LOW)
|
||||
print("Authentication Failed!")
|
||||
for i in range(5):
|
||||
GPIO.output(redLed, GPIO.HIGH)
|
||||
time.sleep(0.05)
|
||||
GPIO.output(redLed, GPIO.LOW)
|
||||
time.sleep(0.05)
|
||||
|
Loading…
Reference in New Issue
Block a user