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. |
rgerganov
left a comment
There was a problem hiding this comment.
Squash all commits into one for the sake of better git history
|
|
||
| return sig | ||
|
|
||
| def has_pin (self): |
There was a problem hiding this comment.
what extra space? when I have spaceds at the end of the line the PR quality checker says bad.
| return sig | ||
|
|
||
| def has_pin (self): | ||
| haspin = (self.client.info.options["clientPin"]) |
There was a problem hiding this comment.
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.
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.
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 |
| 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.
docstring should be first
There was a problem hiding this comment.
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 |
no plan how |
Ask for PIN directly upon request but only if a PIN exists, also remove PINs not being asked for.