djangorestframework-api-key icon indicating copy to clipboard operation
djangorestframework-api-key copied to clipboard

Add support for upgrading API key hashes

Open florimondmanca opened this issue 3 years ago • 1 comments

Found out while working on https://github.com/florimondmanca/djangorestframework-api-key/issues/173#issuecomment-1146677315

Currently, if PASSWORD_HASHERS changes and hasher A (eg. PBKDF2) previously used to hash API keys is moved lower in the list than another hasher B (eg. Argon2), then API key hashes won't be upgraded.

This PR adds support for this, by implementing verify(..., setter=...).


Needs some tests...

florimondmanca avatar Jun 04 '22 20:06 florimondmanca

Codecov Report

Merging #213 (d9ad549) into master (6f76d19) will decrease coverage by 0.83%. The diff coverage is 50.00%.

@@             Coverage Diff             @@
##            master     #213      +/-   ##
===========================================
- Coverage   100.00%   99.16%   -0.84%     
===========================================
  Files           24       24              
  Lines          595      602       +7     
===========================================
+ Hits           595      597       +2     
- Misses           0        5       +5     
Impacted Files Coverage Δ
src/rest_framework_api_key/crypto.py 90.00% <50.00%> (-10.00%) :arrow_down:
src/rest_framework_api_key/models.py 97.75% <50.00%> (-2.25%) :arrow_down:

:mega: Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

codecov-commenter avatar Jun 04 '22 20:06 codecov-commenter

Closing as this is irrevelant if we go with the DRF-api-key-specific SHA512 hasher as in #244.

florimondmanca avatar Sep 11 '23 10:09 florimondmanca