pyauth / pyauth/python-pkcs11

user_pin and so_pin in Token.open() are documented as bytes, instead they are str

Open Beginner friendly
#225 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
170
Forks
79
PR merge metrics
No merged PRs in 30d

Description

In the docstring of the Token open function user_pin and so_pin are documented as bytes, but the code assumes they are strings:

      elif user_pin is not None:
            pin = user_pin.encode('utf-8')
            c_user_type = user_type if user_type is not None else CKU_USER
        elif so_pin is not None:
            pin = so_pin.encode('utf-8')
            c_user_type = CKU_SO

This causes pycharm (and other type checking tools) to complain

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Token.open() docstring and compare the documented types for user_pin and so_pin with the encode calls shown in the issue. Update the parameter documentation to match the string values accepted by the implementation, then run the relevant existing tests or documentation checks; done means type-checking tools no longer report this mismatch.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.