Skip to content

Commit

Permalink
Merge branch 'release/0.4.1' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
erikvw committed Mar 25, 2024
2 parents 61118da + afaf815 commit abf6359
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion django_crypto_fields/field_cryptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from Cryptodome.Cipher import AES as AES_CIPHER
from django.apps import apps as django_apps
from django.conf import settings
from django.core.cache import cache
from django.core.exceptions import ObjectDoesNotExist

Expand Down Expand Up @@ -142,7 +143,14 @@ def using(self):
def cache_key_prefix(self) -> bytes:
algorithm = safe_encode_utf8(self.algorithm)
access_mode = safe_encode_utf8(self.access_mode)
return b"django-crypto-fields-" + algorithm + b"-" + access_mode + b"-"
prefix = safe_encode_utf8(
getattr(
settings,
"CACHE_CRYPTO_KEY_PREFIX",
"crypto",
)
)
return prefix + algorithm + b"-" + access_mode + b"-"

def update_crypt(self, cipher: Cipher) -> None:
"""Updates Crypt model and the cache.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
path,date
/Users/erikvw/source/edc_source/django-crypto-fields/django_crypto_fields/tests/crypto_keys,2024-03-21 03:44:41.226908+00:00
/Users/erikvw/source/edc_source/django-crypto-fields/django_crypto_fields/tests/crypto_keys,2024-03-25 06:53:16.697430+00:00

0 comments on commit abf6359

Please sign in to comment.