ecodev-core 0.0.61__py3-none-any.whl → 0.0.62__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of ecodev-core might be problematic. Click here for more details.

ecodev_core/__init__.py CHANGED
@@ -59,6 +59,8 @@ from ecodev_core.db_upsertion import upsert_df_data
59
59
  from ecodev_core.db_upsertion import upsert_selector
60
60
  from ecodev_core.deployment import Deployment
61
61
  from ecodev_core.email_sender import send_email
62
+ from ecodev_core.encryption import decrypt_value
63
+ from ecodev_core.encryption import encrypt_value
62
64
  from ecodev_core.enum_utils import enum_converter
63
65
  from ecodev_core.list_utils import first_func_or_default
64
66
  from ecodev_core.list_utils import first_or_default
@@ -118,4 +120,5 @@ __all__ = [
118
120
  'sfield', 'field', 'upsert_df_data', 'upsert_deletor', 'get_row_versions', 'get_versions',
119
121
  'db_to_value', 'upsert_data', 'upsert_selector', 'get_sfield_columns', 'filter_to_sfield_dict',
120
122
  'SETTINGS', 'add_missing_enum_values', 'ban_token', 'TokenBanlist', 'is_banned',
121
- 'get_lang', 'set_lang', 'Lang', 'localized_col', 'I18nMixin', 'add_missing_columns']
123
+ 'get_lang', 'set_lang', 'Lang', 'localized_col', 'I18nMixin', 'add_missing_columns',
124
+ 'encrypt_value', 'decrypt_value']
@@ -0,0 +1,32 @@
1
+ from cryptography.fernet import Fernet
2
+
3
+ from ecodev_core import SETTINGS
4
+
5
+
6
+ FERNET = Fernet(SETTINGS.fernet_key.encode())
7
+
8
+
9
+ def encrypt_value(value):
10
+ """
11
+ Encrypt a value using Fernet symmetric encryption.
12
+
13
+ Args:
14
+ value: Value to encrypt (will be converted to string)
15
+
16
+ Returns:
17
+ Encrypted bytes
18
+ """
19
+ return FERNET.encrypt(str(value).encode())
20
+
21
+
22
+ def decrypt_value(encrypted):
23
+ """
24
+ Decrypt an encrypted value and convert to float.
25
+
26
+ Args:
27
+ encrypted: Encrypted bytes to decrypt
28
+
29
+ Returns:
30
+ Decrypted value as float
31
+ """
32
+ return float(FERNET.decrypt(encrypted).decode())
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ecodev-core
3
- Version: 0.0.61
3
+ Version: 0.0.62
4
4
  Summary: Low level sqlmodel/fastapi/pydantic building blocks
5
5
  License: MIT
6
6
  Author: Thomas Epelbaum
@@ -1,4 +1,4 @@
1
- ecodev_core/__init__.py,sha256=KkXNOayUlBWog-V_uoAq5oi2mXvrjdWOlirEj09zCU4,6633
1
+ ecodev_core/__init__.py,sha256=cXLgsUatKOmD-v5bw7-PurIO2uZqrU1RjimiGB8SEFc,6769
2
2
  ecodev_core/app_activity.py,sha256=KBtI-35LBLPDppFB7xjxWthXQrY3Z_aGDnC-HrW8Ea0,4641
3
3
  ecodev_core/app_rights.py,sha256=RZPdDtydFqc_nFj96huKAc56BS0qS6ScKv4Kghqd6lc,726
4
4
  ecodev_core/app_user.py,sha256=r1bqA4H08x53XmxmjwyGKl_PFjYQazzBbVErdkztqeE,2947
@@ -15,6 +15,7 @@ ecodev_core/db_retrieval.py,sha256=sCP7TDGIcTOK5gT3Inga91bE4S31HbQPw4yI22WJbss,7
15
15
  ecodev_core/db_upsertion.py,sha256=ttngwZzJUQdr9Mc-qkDljJpru5yN3kvAzAMTW84CLHo,13136
16
16
  ecodev_core/deployment.py,sha256=z8ACI00EtKknXOB8xyPwYIXTvPjIDOH9z9cBGEU0YrA,281
17
17
  ecodev_core/email_sender.py,sha256=V3UGweuq6Iy09Z9to8HzM6JOVDVGHZXHGjUSkW94Tac,1912
18
+ ecodev_core/encryption.py,sha256=I17TDKDKsE696Dq8hwXhR05H7CcLtCt98ZDExb0L5YM,636
18
19
  ecodev_core/enum_utils.py,sha256=BkQ4YQ97tXBYmMcQiSIi0mbioD5CgVU79myg1BBAXuA,556
19
20
  ecodev_core/es_connection.py,sha256=WC2_BIWBoxgihF1tyHhHsBlcFhM6nZD7eDrPuoJJOqI,2208
20
21
  ecodev_core/list_utils.py,sha256=QFchUnD9CvMiBFBUaxkZTyDyEqpIJBwCNPubNUSl8TA,4877
@@ -28,7 +29,7 @@ ecodev_core/settings.py,sha256=UvaTv8S_HvfFAL-m1Rfqv_geSGcccuV3ziR1o1d5wu4,1795
28
29
  ecodev_core/sqlmodel_utils.py,sha256=t57H3QPtKRy4ujic1clMK_2L4p0yjGJLZbDjHPZ8M94,453
29
30
  ecodev_core/token_banlist.py,sha256=rKXG9QkfCpjOTr8gBgdX-KYNHAkKvQ9TRnGS99VC9Co,491
30
31
  ecodev_core/version.py,sha256=eyIf8KkW_t-hMuYFIoy0cUlNaMewLe6i45m2HKZKh0Q,4403
31
- ecodev_core-0.0.61.dist-info/LICENSE.md,sha256=8dqVJEbwXjPWjjRKjdLMym5k9Gi8hwtrHh84sti6KIs,1068
32
- ecodev_core-0.0.61.dist-info/METADATA,sha256=Wj0Sw5HyCm5Z4n7anHgK9VpvQr_0Hgv6kKaDyRbuKA4,3510
33
- ecodev_core-0.0.61.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
34
- ecodev_core-0.0.61.dist-info/RECORD,,
32
+ ecodev_core-0.0.62.dist-info/LICENSE.md,sha256=8dqVJEbwXjPWjjRKjdLMym5k9Gi8hwtrHh84sti6KIs,1068
33
+ ecodev_core-0.0.62.dist-info/METADATA,sha256=jmFdYoMdQYTBt9HDP68n_u0L0b7Xl1n4iumI6z5Bnek,3510
34
+ ecodev_core-0.0.62.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
35
+ ecodev_core-0.0.62.dist-info/RECORD,,