-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better pin handling #76
Conversation
check whether or not PIN exists on the device, if it does, ask for PIN, if not remove any PIN entered using --pin
remove debug print
set-pin won't work if a PIN exists, similarly chnage-PIN will error out if a PIN exists, so alert and guide the user beforehand, maybe someday add a unified command for PIN management.
amended to have set and change PIN alert and exit early. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Squash all commits into one for the sake of better git history
@@ -409,3 +409,7 @@ def isCorrectVersion(current, target): | |||
self.verify_flash(sig) | |||
|
|||
return sig | |||
|
|||
def has_pin (self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra space
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what extra space? when I have spaceds at the end of the line the PR quality checker says bad.
@@ -409,3 +409,7 @@ def isCorrectVersion(current, target): | |||
self.verify_flash(sig) | |||
|
|||
return sig | |||
|
|||
def has_pin (self): | |||
haspin = (self.client.info.options["clientPin"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return self.client.info.options["clientPin"]
if not pin: | ||
dev = solo.client.find(serial, udp=udp) | ||
if dev.has_pin() is False: | ||
#remove PIN if no PIN set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
silently removing the PIN is incorrect and misleading -- if there is no PIN set and the user specifies a PIN, he should get an error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay yeah silently is maybe bad, I just wanted to try and resolve this without the user needing to actially do anything extra, making it easier to use
if not pin: | ||
dev = solo.client.find(serial, udp=udp) | ||
if dev.has_pin() is False: | ||
#remove PIN if no PIN set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment as above
client = solo.client.find(serial) | ||
if client.has_pin(): | ||
print("This Device already has a PIN, use change-pin instead") | ||
sys.exit(1) | ||
"""Set pin of current key""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
docstring should be first
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so that's a special string? I thought that was just a comment
cert = solo.client.find(serial, udp=udp).make_credential(pin=pin) | ||
dev = solo.client.find(serial, udp=udp) | ||
if dev.has_pin() is False: | ||
#remove PIN if no PIN set |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
no plan how |
Ask for PIN directly upon request but only if a PIN exists, also remove PINs not being asked for.