Skip to content

v2.0.0 MAJOR - Added KeyManager class, refactored crypto module, documentation changes, packaging changes and more!

Choose a tag to compare

@Someguy123 Someguy123 released this 25 Oct 22:53

There have been many, many changes since version 1.0, so I've decided it's about time that we finally bump our major version to version 2.0.0

While this release isn't really a breaking change from 1.5.0, there have been so many breaking changes introduced in the 1.x.x series, as well as major new features such as a cache abstraction layer and a cryptography module, it's worth having a clean semver slate with 2.0.0

Docs

  • Added documentation for byteify and stringify
  • Added documentation for the crypto module
  • Added documentation for the setuppy module
  • Updated the custom sphinx CSS to allow for a sensible 5th nesting level in the navigation
  • Adjusted the sphinx templates for autosummary/class.rst and autosummary/module.rst
    • Insert toctree directive automatically into generated files, so sub-components automatically have their RST stubs for navigation generated,
      instead of having to manually modify the generate files afterwards.
      • :toctree: is automatically added for module functions+classes
      • :toctree: is automatically added for class methods+attributes
    • The headings "Methods" and "Attributes" are automatically added for classes, for display in the navigation bar.
  • Added sphinx_rtd_theme as an import and in the extension list in conf.py (the README says to do this, so maybe it will prevent issues in the future?)

Packaging

  • Added extras_require to setup.py, allowing "extras" to be specified when installing privex-helpers, instead of
    having to specify optional dependencies directly in your requirements.txt
  • Excluded the tests module from the package

Unit Tests

  • Created TestKeyManager class inside of tests/test_crypto.py which tests the new asymmetric key system
    • Tests generation of RSA, ECDSA and Ed25519 keys by checking the public/private key length, as well as looking for strings in their output format
    • Tests loading of RSA, ECDSA, and Ed25519 keys
    • Tests loading invalid keys correctly raises an exception (otherwise how do we know that the previous loading attempts weren't just being ignored?)
    • Tests signing and verifying messages for RSA, ECDSA and Ed25519 keys
    • Tests encryption and decryption for RSA keys (other algorithms don't support encryption/decryption)

Code

  • crypto module is now a folder python module
    • Moved EncryptHelper into crypto/EncryptHelper.py
    • Created crypto/base.py with helper functions such as is_base64 and auto_b64decode
    • Created crypto/KeyManager.py
      • Generates Asymmetric keys in RSA, ECDSA and Ed25519 format
      • Serialize public/private keys into various formats, default: PEM+PKCS8 for private, OpenSSH for public
      • Load public/private keys in most formats, with auto detection
      • Ability to load a key from a file
      • Automatically interpolate public key when loading a private key
      • Ability to output generated keys to private and public file
      • Signing messages with RSA, ECDSA, and Ed25519
      • Verifying messages with RSA, ECDSA, and Ed25519
      • Encrypting messages/data with RSA
      • Decrypting messages/data with RSA
      • Lots of PyDoc blocks, clearly documenting how everything works
  • New setuppy module with various packaging related helpers, such as parsing requirements files and handling importing other requirements files
  • Added InvalidFormat exception, used by the crypto module
  • common module
    • New byteify function - convert a value into bytes if it isn't already bytes
    • New stringify function - decode bytes into a string, if it isn't already a string