-
Notifications
You must be signed in to change notification settings - Fork 71
Add token and pin initialization #110
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
base: master
Are you sure you want to change the base?
Conversation
69ae329
to
a261695
Compare
I wrote this casually for personal use and am not super familiar with extending Python with C, so please don't hesitate to comment if there are better ways to do certain things. |
a261695
to
69d938a
Compare
Added as Token.init_token and Session.init_pin
69d938a
to
287dd87
Compare
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.
Reviewed. Apologies for the delay. Not sure why I never got notified for this.
assertRV(_funclist.C_InitToken(slot_id, pin_data, pin_length, | ||
label)) | ||
|
||
return True |
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.
Rather than returning True/False out of this function, it's probably better to return None
or raise ArgumentsBad
. That means you can try/except/finally your codepath.
tlabel = token_label.encode('utf-8') | ||
|
||
if pin and tlabel: | ||
pin_data = pin |
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.
I don't think you need to reassign these?
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.
Oh, I suppose you do for nogil
, NM
pin = user_pin.encode('utf-8') | ||
|
||
if pin: | ||
pin_data = pin |
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.
I don't think you need to reassign this.
Adding implementations and tests for C_InitToken and C_InitPIN
Happens to also solve: #6