Add token and pin initialization#110
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
danni
left a comment
There was a problem hiding this comment.
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.
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.
I don't think you need to reassign these?
There was a problem hiding this comment.
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.
I don't think you need to reassign this.
Adding implementations and tests for C_InitToken and C_InitPIN
Happens to also solve: #6