Encryptors 2.41__tar.gz → 2.42__tar.gz
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.
- {encryptors-2.41 → encryptors-2.42}/PKG-INFO +1 -1
- {encryptors-2.41 → encryptors-2.42}/setup.py +1 -1
- {encryptors-2.41 → encryptors-2.42}/src/Encryptors.egg-info/PKG-INFO +1 -1
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Graphql/Extensions/AuditExtension.py +7 -1
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Helpers/AuditDispatcher.py +1 -1
- encryptors-2.42/src/Osdental/Helpers/ResponseDecryptor.py +33 -0
- encryptors-2.41/src/Osdental/Helpers/ResponseDecryptor.py +0 -15
- {encryptors-2.41 → encryptors-2.42}/README.md +0 -0
- {encryptors-2.41 → encryptors-2.42}/setup.cfg +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Encryptors.egg-info/SOURCES.txt +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Encryptors.egg-info/dependency_links.txt +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Encryptors.egg-info/entry_points.txt +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Encryptors.egg-info/requires.txt +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Encryptors.egg-info/top_level.txt +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Cli/__init__.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Database/BaseRepository.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Database/Connection.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Database/__init__.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Decorators/Grpc.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Decorators/PublicResolver.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Decorators/Retry.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Decorators/SecureResolver.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Decorators/SqlDataNormalizer.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Decorators/__init__.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Encryptor/Aes.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Encryptor/Argon2.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Encryptor/Bcrypt.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Encryptor/Jwt.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Encryptor/Rsa.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Encryptor/Sha512.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Encryptor/__init__.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Exception/ControlledException.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Exception/__init__.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Graphql/Extensions/__init__.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Graphql/Models/__init__.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Graphql/_Exceptions/__init__.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Graphql/_Helpers/_AuditHelper.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Graphql/_Helpers/_ExtractAuthToken.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Graphql/_Helpers/_TenantPolicy.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Graphql/_Helpers/_TokenService.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Graphql/_Helpers/__init__.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Graphql/__init__.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Helpers/KeyVaultService.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Helpers/__init__.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Http/APIClient.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Http/_Exceptions.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Http/__init__.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Messaging/AzureServiceBus.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Messaging/Kafka.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Messaging/RabbitMQ.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Messaging/__init__.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Models/AuditConfig.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Models/Response.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Models/Token.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Models/_Audit.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Models/__init__.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/RedisCache/Redis.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/RedisCache/__init__.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Rest/Context/RequestContext.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Rest/Context/__init__.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Rest/Middlewares/RequestContextMiddleware.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Rest/Middlewares/__init__.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Rest/__init__.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Shared/Enums/Code.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Shared/Enums/Constant.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Shared/Enums/FileType.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Shared/Enums/GrahpqlOperation.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Shared/Enums/Message.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Shared/Enums/Profile.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Shared/Enums/__init__.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Shared/Logger.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Shared/Utils/CaseConverter.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Shared/Utils/CodeGenerator.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Shared/Utils/DataNormalizer.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Shared/Utils/DataUtils.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Shared/Utils/DateUtils.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Shared/Utils/FileMetaData.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Shared/Utils/HashValidator.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Shared/Utils/Mapper.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Shared/Utils/PasswordGenerator.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Shared/Utils/QueryGenerator.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Shared/Utils/RsaUtils.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Shared/Utils/TextProcessor.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Shared/Utils/__init__.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Shared/__init__.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Storage/AzureBlobStorage.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Storage/S3Storage.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/Storage/__init__.py +0 -0
- {encryptors-2.41 → encryptors-2.42}/src/Osdental/__init__.py +0 -0
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
# ANDERSON ESTO YA SE SUBIO Y ESTA ESTABLE, AUN TE QUEDA PENDIENTE LA AUDITORIA CON RSA Y AES DE ACCESSTOKEN
|
|
3
3
|
setup(
|
|
4
4
|
name="Encryptors",
|
|
5
|
-
version="2.
|
|
5
|
+
version="2.42",
|
|
6
6
|
author="OSDental LLC",
|
|
7
7
|
author_email="support@osdental.ai",
|
|
8
8
|
description="End-to-end algorithm library",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import json
|
|
2
|
+
import copy
|
|
2
3
|
from graphql.pyutils import is_awaitable
|
|
3
4
|
from ariadne.types import Extension
|
|
4
5
|
from Osdental.Shared.Logger import logger
|
|
@@ -9,6 +10,7 @@ from Osdental.Rest.Context.RequestContext import (
|
|
|
9
10
|
RequestContext
|
|
10
11
|
)
|
|
11
12
|
from Osdental.Graphql.Models import BaseGraphQLContext
|
|
13
|
+
from Osdental.Helpers.ResponseDecryptor import encryptor_data, VALID_TYPES
|
|
12
14
|
from Osdental.Shared.Enums.Constant import Constant
|
|
13
15
|
|
|
14
16
|
class AuditExtension(Extension):
|
|
@@ -154,7 +156,11 @@ class AuditExtension(Extension):
|
|
|
154
156
|
self.result = result
|
|
155
157
|
|
|
156
158
|
if not getattr(context, "audit_plain_response", None):
|
|
157
|
-
|
|
159
|
+
if result.encryption_type in VALID_TYPES and result.key:
|
|
160
|
+
result_copy = copy.deepcopy(result)
|
|
161
|
+
result = encryptor_data(result.encryption_type, result.key, result.data)
|
|
162
|
+
|
|
163
|
+
context.audit_plain_response = result_copy
|
|
158
164
|
|
|
159
165
|
return result
|
|
160
166
|
|
|
@@ -127,7 +127,7 @@ class AuditDispatcher:
|
|
|
127
127
|
audit_message = request_audit_payload | payload
|
|
128
128
|
|
|
129
129
|
else:
|
|
130
|
-
if encryption_type in VALID_TYPES and key
|
|
130
|
+
if encryption_type in VALID_TYPES and key:
|
|
131
131
|
data = decryptor_data(encryption_type, key, data)
|
|
132
132
|
|
|
133
133
|
payload = AuditHelper.build_final_payload(
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
from typing import Dict, Any
|
|
2
|
+
from Osdental.Encryptor.Aes import AES
|
|
3
|
+
from Osdental.Encryptor.Rsa import RSAEncryptor
|
|
4
|
+
from Osdental.Shared.Logger import logger
|
|
5
|
+
|
|
6
|
+
VALID_TYPES = {"RSA", "AES"}
|
|
7
|
+
|
|
8
|
+
def encryptor_data(encryption_type: str, key: str, data: Dict[str, Any] | str) -> Any:
|
|
9
|
+
match encryption_type:
|
|
10
|
+
|
|
11
|
+
case "AES":
|
|
12
|
+
return AES.encrypt(key, data)
|
|
13
|
+
|
|
14
|
+
case "RSA":
|
|
15
|
+
return RSAEncryptor.encrypt(data, key)
|
|
16
|
+
|
|
17
|
+
case _:
|
|
18
|
+
logger.warning(f"Encryption type '{encryption_type}' not supported.")
|
|
19
|
+
return data
|
|
20
|
+
|
|
21
|
+
def decryptor_data(encryption_type: str, key: str, data: Dict[str, Any] | str) -> Any:
|
|
22
|
+
|
|
23
|
+
match encryption_type:
|
|
24
|
+
|
|
25
|
+
case "AES":
|
|
26
|
+
return AES.decrypt(key, data)
|
|
27
|
+
|
|
28
|
+
case "RSA":
|
|
29
|
+
return RSAEncryptor.decrypt(data, key)
|
|
30
|
+
|
|
31
|
+
case _:
|
|
32
|
+
logger.warning(f"Encryption type '{encryption_type}' not supported.")
|
|
33
|
+
return data
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
from typing import Dict, Any
|
|
2
|
-
from Osdental.Encryptor.Aes import AES
|
|
3
|
-
from Osdental.Encryptor.Rsa import RSAEncryptor
|
|
4
|
-
|
|
5
|
-
VALID_TYPES = {"RSA", "AES"}
|
|
6
|
-
|
|
7
|
-
def decryptor_data(encryption_type: str, key: str, data: Dict[str, Any] | str) -> Any:
|
|
8
|
-
|
|
9
|
-
match encryption_type:
|
|
10
|
-
|
|
11
|
-
case "AES":
|
|
12
|
-
return AES.decrypt(key, data)
|
|
13
|
-
|
|
14
|
-
case "RSA":
|
|
15
|
-
return RSAEncryptor.decrypt(data, key)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{encryptors-2.41 → encryptors-2.42}/src/Osdental/Rest/Middlewares/RequestContextMiddleware.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|