Add djblets.secrets, for AES crypto helpers and token generation.

Review Request #12369 — Created June 13, 2022 and submitted

Information

Djblets
release-3.x

Reviewers

This introduces a new djblets.secrets module, which will be the home
of any future crypto/secrets-related work going forward.

This currently contains djblets.secrets.crypto, a collection of AES
encryption/decryption utilities that wrap the cryptography module.
This is a near-straight port of reviewboard.scmtools.crypto_utils,
with the exception that encrypt_password() has been renamed to
aes_encrypt_base64() and decrypt_password() has been renamed to
aes_decrypt_base64(). This is to help make it clear what form of
encryption and results are expected, and to allow room for other similar
utilities in the future.

cryptography is now a hard dependency of Djblets, rather than a soft
dependency, as Djblets-shipped code will be making use of this module in
the future.

Unit tests pass.

Summary ID
Add djblets.secrets, for AES crypto helpers and token generation.
This introduces a new `djblets.secrets` module, which will be the home of any future crypto/secrets-related work going forward. This currently contains `djblets.secrets.crypto`, a collection of AES encryption/decryption utilities that wrap the `cryptography` module. This is a near-straight port of `reviewboard.scmtools.crypto_utils`, with the exception that `encrypt_password()` has been renamed to `aes_encrypt_base64()` and `decrypt_password()` has been renamed to `aes_decrypt_base64()`. This is to help make it clear what form of encryption and results are expected, and to allow room for other similar utilities in the future. `cryptography` is now a hard dependency of Djblets, rather than a soft dependency, as Djblets-shipped code will be making use of this module in the future.
7557fa026d096cea9d10860121be9d07dbc137f5
Description From Last Updated

Mind adding a module docstring to secrets/__init__.py and secrets/tests/__init__.py?

daviddavid

continuation line under-indented for visual indent Column: 38 Error code: E128

reviewbotreviewbot
Checks run (1 failed, 1 succeeded)
flake8 failed.
JSHint passed.

flake8

chipx86
chipx86
david
  1. 
      
  2. Show all issues

    Mind adding a module docstring to secrets/__init__.py and secrets/tests/__init__.py?

    1. Not sure what's best to put in the tests one. Let me know if there's wording you prefer.

  3. 
      
maubin
  1. Ship It!
  2. 
      
chipx86
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-3.x (009c8e5)