Modernise onetimepass for Python 3.8+ - #35
Merged
Conversation
- Remove the six dependency; the library now targets Python 3.8+ only - Add PEP 484 type hints to the public API - Use constant-time comparison (hmac.compare_digest) when validating tokens - Replace setup.py with a PEP 621 pyproject.toml (bump to 2.0.0) - Swap timecop for freezegun in the test suite - Replace Travis CI with a GitHub Actions matrix (Python 3.8-3.13) - Update README badge/changelog and docs version Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AzdBWLnyXWnN89YYbPxpwb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Modernises the library to a clean Python 3.8+ release (v2.0.0). The HOTP/TOTP cryptography is unchanged; the public API behaviour is the same, aside from the constant-time hardening which is transparent to callers.
Changes
Core (
onetimepass/__init__.py)sixdependency; the library now targets Python 3.8+ only.valid_hotp/valid_totp) now useshmac.compare_digeston zero-padded strings (constant-time) instead of==.2.0.0.Packaging
setup.pywith a PEP 621pyproject.toml(requires-python >=3.8, refreshed classifiers for 3.8–3.13, no runtime dependencies).Requirements / tests
sixfrom production requirements; swappedtimecopforfreezegunin the test suite.CI / docs
.travis.yml; added a GitHub Actions workflow with a Python 3.8–3.13 matrix running unit tests + doctests.Verification
python -m unittest tests→ 20 passed.python -m doctest onetimepass/__init__.py→ passed.six/timecopreferences remain in source; package imports cleanly (reports version 2.0.0).🤖 Generated with Claude Code
https://claude.ai/code/session_01AzdBWLnyXWnN89YYbPxpwb
Generated by Claude Code