Skip to content

Commit

Permalink
Merge pull request #66 from rgerganov/fix-error-handle
Browse files Browse the repository at this point in the history
Fix error handling in 'verify'
  • Loading branch information
conorpp committed Mar 16, 2020
2 parents 3b96590 + 0261d6b commit fa65330
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions solo/cli/key.py
Expand Up @@ -321,16 +321,11 @@ def verify(pin, serial, udp):
print("Please press the button on your Solo key")
try:
cert = solo.client.find(serial, udp=udp).make_credential(pin=pin)
except ValueError as e:
# python-fido2 library pre-emptively returns `ValueError('PIN required!')`
# instead of trying, and returning `CTAP error: 0x36 - PIN_REQUIRED`
if "PIN required" in str(e):
print("Your key has a PIN set. Please pass it using `--pin <your PIN>`")
sys.exit(1)
raise

except Fido2ClientError as e:
cause = str(e.cause)
if "PIN required" in cause:
print("Your key has a PIN set. Please pass it using `--pin <your PIN>`")
sys.exit(1)
# error 0x31
if "PIN_INVALID" in cause:
print("Your key has a different PIN. Please try to remember it :)")
Expand Down

0 comments on commit fa65330

Please sign in to comment.