Skip to content

Conversation

@grindsa
Copy link
Owner

@grindsa grindsa commented Dec 22, 2025

This PR refactors the Signature class in signature.py for improved maintainability, clarity, and testability, while preserving backward compatibility. It also introduces a comprehensive suite of unittests in test_signature.py to ensure robust coverage of all logic branches and edge cases.

  • Modernized class structure and docstrings.
  • Consolidated and clarified key loading logic into a single _jwk_loader() method (replacing _jwk_load and _cli_jwk_load).
  • Simplified and clarified error handling and logging.
  • Improved method signatures and return types for consistency (all check methods now return tuples, preserving legacy compatibility).
  • Added helper method _get_revocation_path() for configuration parsing.
  • Reduced code duplication and cognitive complexity in check(), cli_check(), and eab_check() methods.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the Signature class in signature.py to improve code maintainability, reduce duplication, and enhance testability. The refactoring consolidates key loading methods, simplifies error handling logic, and adds comprehensive test coverage.

Key changes:

  • Consolidated _jwk_load and _cli_jwk_load into a unified _jwk_loader method with a cli parameter
  • Simplified configuration parsing by extracting _get_revocation_path helper method
  • Streamlined check, cli_check, and eab_check methods with early returns and consistent error handling

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
acme_srv/signature.py Refactored Signature class with consolidated key loading, simplified error handling, modernized docstrings, and reduced code duplication
test/test_signature.py Updated tests to reflect refactored method names, removed obsolete tests for deleted _cli_jwk_load method, added comprehensive test coverage for edge cases

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@grindsa grindsa requested a review from skcert December 22, 2025 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants