maleo-foundation 0.1.76__tar.gz → 0.1.77__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.
Files changed (116) hide show
  1. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/PKG-INFO +1 -1
  2. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/client/manager.py +3 -0
  3. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/client/services/__init__.py +2 -0
  4. maleo_foundation-0.1.77/maleo_foundation/client/services/key.py +113 -0
  5. maleo_foundation-0.1.77/maleo_foundation/expanded_types/key.py +18 -0
  6. maleo_foundation-0.1.77/maleo_foundation/models/schemas/key.py +15 -0
  7. maleo_foundation-0.1.77/maleo_foundation/models/transfers/general/key.py +15 -0
  8. maleo_foundation-0.1.77/maleo_foundation/models/transfers/parameters/key.py +13 -0
  9. maleo_foundation-0.1.77/maleo_foundation/models/transfers/results/key.py +16 -0
  10. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation.egg-info/PKG-INFO +1 -1
  11. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation.egg-info/SOURCES.txt +6 -0
  12. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/pyproject.toml +1 -1
  13. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/README.md +0 -0
  14. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/__init__.py +0 -0
  15. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/authentication.py +0 -0
  16. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/client/__init__.py +0 -0
  17. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/client/services/encryption/__init__.py +0 -0
  18. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/client/services/encryption/aes.py +0 -0
  19. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/client/services/encryption/rsa.py +0 -0
  20. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/client/services/hash/__init__.py +0 -0
  21. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/client/services/hash/bcrypt.py +0 -0
  22. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/client/services/hash/hmac.py +0 -0
  23. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/client/services/hash/sha256.py +0 -0
  24. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/client/services/signature.py +0 -0
  25. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/client/services/token.py +0 -0
  26. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/constants.py +0 -0
  27. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/enums.py +0 -0
  28. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/expanded_types/__init__.py +0 -0
  29. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/expanded_types/client.py +0 -0
  30. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/expanded_types/encryption/__init__.py +0 -0
  31. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/expanded_types/encryption/aes.py +0 -0
  32. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/expanded_types/encryption/rsa.py +0 -0
  33. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/expanded_types/general.py +0 -0
  34. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/expanded_types/hash.py +0 -0
  35. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/expanded_types/query.py +0 -0
  36. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/expanded_types/service.py +0 -0
  37. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/expanded_types/signature.py +0 -0
  38. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/expanded_types/token.py +0 -0
  39. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/extended_types.py +0 -0
  40. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/managers/__init__.py +0 -0
  41. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/managers/client/__init__.py +0 -0
  42. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/managers/client/base.py +0 -0
  43. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/managers/client/google/__init__.py +0 -0
  44. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/managers/client/google/base.py +0 -0
  45. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/managers/client/google/secret.py +0 -0
  46. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/managers/client/google/storage.py +0 -0
  47. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/managers/client/maleo.py +0 -0
  48. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/managers/db.py +0 -0
  49. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/managers/middleware.py +0 -0
  50. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/managers/service.py +0 -0
  51. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/middlewares/authentication.py +0 -0
  52. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/middlewares/base.py +0 -0
  53. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/middlewares/cors.py +0 -0
  54. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/__init__.py +0 -0
  55. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/responses.py +0 -0
  56. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/schemas/__init__.py +0 -0
  57. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/schemas/encryption.py +0 -0
  58. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/schemas/general.py +0 -0
  59. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/schemas/hash.py +0 -0
  60. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/schemas/parameter.py +0 -0
  61. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/schemas/result.py +0 -0
  62. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/schemas/signature.py +0 -0
  63. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/schemas/token.py +0 -0
  64. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/table.py +0 -0
  65. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/__init__.py +0 -0
  66. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/general/__init__.py +0 -0
  67. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/general/signature.py +0 -0
  68. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/general/token.py +0 -0
  69. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/parameters/__init__.py +0 -0
  70. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/parameters/client.py +0 -0
  71. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/parameters/encryption/__init__.py +0 -0
  72. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/parameters/encryption/aes.py +0 -0
  73. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/parameters/encryption/rsa.py +0 -0
  74. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/parameters/general.py +0 -0
  75. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/parameters/hash/__init__.py +0 -0
  76. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/parameters/hash/bcrypt.py +0 -0
  77. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/parameters/hash/hmac.py +0 -0
  78. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/parameters/hash/sha256.py +0 -0
  79. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/parameters/service.py +0 -0
  80. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/parameters/signature.py +0 -0
  81. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/parameters/token.py +0 -0
  82. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/results/__init__.py +0 -0
  83. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/results/client/__init__.py +0 -0
  84. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/results/client/controllers/__init__.py +0 -0
  85. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/results/client/controllers/http.py +0 -0
  86. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/results/client/service.py +0 -0
  87. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/results/encryption/__init__.py +0 -0
  88. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/results/encryption/aes.py +0 -0
  89. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/results/encryption/rsa.py +0 -0
  90. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/results/hash.py +0 -0
  91. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/results/service/__init__.py +0 -0
  92. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/results/service/controllers/__init__.py +0 -0
  93. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/results/service/controllers/rest.py +0 -0
  94. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/results/service/general.py +0 -0
  95. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/results/service/query.py +0 -0
  96. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/results/signature.py +0 -0
  97. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/models/transfers/results/token.py +0 -0
  98. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/types.py +0 -0
  99. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/utils/__init__.py +0 -0
  100. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/utils/controller.py +0 -0
  101. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/utils/exceptions.py +0 -0
  102. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/utils/extractor.py +0 -0
  103. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/utils/formatter/__init__.py +0 -0
  104. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/utils/formatter/case.py +0 -0
  105. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/utils/loaders/__init__.py +0 -0
  106. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/utils/loaders/json.py +0 -0
  107. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/utils/loaders/key/__init__.py +0 -0
  108. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/utils/loaders/key/rsa.py +0 -0
  109. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/utils/loaders/yaml.py +0 -0
  110. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/utils/logging.py +0 -0
  111. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/utils/mergers.py +0 -0
  112. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation/utils/query.py +0 -0
  113. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation.egg-info/dependency_links.txt +0 -0
  114. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation.egg-info/requires.txt +0 -0
  115. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/maleo_foundation.egg-info/top_level.txt +0 -0
  116. {maleo_foundation-0.1.76 → maleo_foundation-0.1.77}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maleo_foundation
3
- Version: 0.1.76
3
+ Version: 0.1.77
4
4
  Summary: Foundation package for Maleo
5
5
  Author-email: Agra Bima Yuda <agra@nexmedis.com>
6
6
  License: MIT
@@ -14,6 +14,7 @@ from maleo_foundation.client.services.hash import (
14
14
  from maleo_foundation.client.services import (
15
15
  MaleoFoundationEncryptionServices,
16
16
  MaleoFoundationHashServices,
17
+ MaleoFoundationKeyClientService,
17
18
  MaleoFoundationSignatureClientService,
18
19
  MaleoFoundationTokenClientService,
19
20
  MaleoFoundationServices
@@ -35,6 +36,7 @@ class MaleoFoundationClientManager(ClientManager):
35
36
  aes=aes_encryption_service,
36
37
  rsa=rsa_encryption_service
37
38
  )
39
+ key_service = MaleoFoundationKeyClientService(logger=self._logger)
38
40
  bcrypt_hash_service = MaleoFoundationBcryptHashClientService(logger=self._logger)
39
41
  hmac_hash_service = MaleoFoundationHMACHashClientService(logger=self._logger)
40
42
  sha256_hash_service = MaleoFoundationSHA256HashClientService(logger=self._logger)
@@ -48,6 +50,7 @@ class MaleoFoundationClientManager(ClientManager):
48
50
  self._services = MaleoFoundationServices(
49
51
  encryption=encryption_services,
50
52
  hash=hash_services,
53
+ key=key_service,
51
54
  signature=signature_service,
52
55
  token=token_service
53
56
  )
@@ -3,11 +3,13 @@ from pydantic import Field
3
3
  from maleo_foundation.managers.client.base import ClientServices
4
4
  from maleo_foundation.client.services.encryption import MaleoFoundationEncryptionServices
5
5
  from maleo_foundation.client.services.hash import MaleoFoundationHashServices
6
+ from maleo_foundation.client.services.key import MaleoFoundationKeyClientService
6
7
  from maleo_foundation.client.services.signature import MaleoFoundationSignatureClientService
7
8
  from maleo_foundation.client.services.token import MaleoFoundationTokenClientService
8
9
 
9
10
  class MaleoFoundationServices(ClientServices):
10
11
  encryption:MaleoFoundationEncryptionServices = Field(..., description="Encryption's services")
11
12
  hash:MaleoFoundationHashServices = Field(..., description="Hash's services")
13
+ key:MaleoFoundationKeyClientService = Field(..., description="Key's service")
12
14
  signature:MaleoFoundationSignatureClientService = Field(..., description="Signature's service")
13
15
  token:MaleoFoundationTokenClientService = Field(..., description="Token's service")
@@ -0,0 +1,113 @@
1
+ from cryptography.hazmat.backends import default_backend
2
+ from cryptography.hazmat.primitives.asymmetric import rsa
3
+ from cryptography.hazmat.primitives import serialization
4
+ from maleo_foundation.expanded_types.key import BaseKeyResultsTypes
5
+ from maleo_foundation.managers.client.base import ClientService
6
+ from maleo_foundation.models.transfers.general.key import BaseKeyGeneralTransfers
7
+ from maleo_foundation.models.transfers.parameters.key import BaseKeyParametersTransfers
8
+ from maleo_foundation.models.transfers.results.key import BaseKeyResultsTransfers
9
+ from maleo_foundation.utils.exceptions import BaseExceptions
10
+
11
+ class MaleoFoundationKeyClientService(ClientService):
12
+ def create_private(self, parameters:BaseKeyParametersTransfers.CreatePrivateOrPair) -> BaseKeyResultsTypes.CreatePrivate:
13
+ """Create an RSA private key with X.509 encoding in .pem format."""
14
+ @BaseExceptions.service_exception_handler(
15
+ operation="creating private key",
16
+ logger=self._logger,
17
+ fail_result_class=BaseKeyResultsTransfers.Fail
18
+ )
19
+ def _impl():
20
+ #* Create private key
21
+ private_key = rsa.generate_private_key(
22
+ public_exponent=65537,
23
+ key_size=parameters.key_size,
24
+ backend=default_backend()
25
+ )
26
+
27
+ if parameters.password is None:
28
+ encryption_algorithm = serialization.NoEncryption()
29
+ else:
30
+ encryption_algorithm = serialization.BestAvailableEncryption(parameters.password.encode())
31
+
32
+ #* Serialize private key to PEM format
33
+ private_key_bytes = private_key.private_bytes(
34
+ encoding=serialization.Encoding.PEM,
35
+ format=serialization.PrivateFormat.PKCS8,
36
+ encryption_algorithm=encryption_algorithm
37
+ )
38
+
39
+ self._logger.info("Successfully created private key")
40
+ data = BaseKeyGeneralTransfers.PrivateKey(value=private_key_bytes.decode())
41
+ return BaseKeyResultsTransfers.CreatePrivate(data=data)
42
+ return _impl()
43
+
44
+ def create_public(self, parameters:BaseKeyParametersTransfers.CreatePublic) -> BaseKeyResultsTypes.CreatePublic:
45
+ """Create an RSA public key with X.509 encoding in .pem format."""
46
+ @BaseExceptions.service_exception_handler(
47
+ operation="creating public key",
48
+ logger=self._logger,
49
+ fail_result_class=BaseKeyResultsTransfers.Fail
50
+ )
51
+ def _impl():
52
+ #* Serialize private key
53
+ private_key_bytes = parameters.value.encode()
54
+ private_key = serialization.load_pem_private_key(
55
+ private_key_bytes,
56
+ password=parameters.password.encode() if parameters.password else None,
57
+ backend=default_backend()
58
+ )
59
+
60
+ public_key = private_key.public_key() #* Create public key
61
+
62
+ #* Serialize public key to PEM format
63
+ public_key_bytes = public_key.public_bytes(
64
+ encoding=serialization.Encoding.PEM,
65
+ format=serialization.PublicFormat.SubjectPublicKeyInfo
66
+ )
67
+
68
+ self._logger.info("Successfully created public key")
69
+ data = BaseKeyGeneralTransfers.PublicKey(value=public_key_bytes.decode())
70
+ return BaseKeyResultsTransfers.CreatePublic(data=data)
71
+ return _impl()
72
+
73
+ def create_pair(self, parameters:BaseKeyParametersTransfers.CreatePrivateOrPair) -> BaseKeyResultsTypes.CreatePair:
74
+ """Create an RSA key pair with X.509 encoding in .pem format."""
75
+ @BaseExceptions.service_exception_handler(
76
+ operation="creating key pair",
77
+ logger=self._logger,
78
+ fail_result_class=BaseKeyResultsTransfers.Fail
79
+ )
80
+ def _impl():
81
+ #* Create private key
82
+ private_key = rsa.generate_private_key(
83
+ public_exponent=65537,
84
+ key_size=parameters.key_size,
85
+ backend=default_backend()
86
+ )
87
+
88
+ if parameters.password is None:
89
+ encryption_algorithm = serialization.NoEncryption()
90
+ else:
91
+ encryption_algorithm = serialization.BestAvailableEncryption(parameters.password.encode())
92
+
93
+ #* Serialize private key to PEM format
94
+ private_key_bytes = private_key.private_bytes(
95
+ encoding=serialization.Encoding.PEM,
96
+ format=serialization.PrivateFormat.PKCS8,
97
+ encryption_algorithm=encryption_algorithm
98
+ )
99
+ private = BaseKeyGeneralTransfers.PrivateKey(value=private_key_bytes.decode())
100
+
101
+ public_key = private_key.public_key() #* Create public key
102
+
103
+ #* Serialize public key to PEM format
104
+ public_key_bytes = public_key.public_bytes(
105
+ encoding=serialization.Encoding.PEM,
106
+ format=serialization.PublicFormat.SubjectPublicKeyInfo
107
+ )
108
+ public = BaseKeyGeneralTransfers.PublicKey(value=public_key_bytes.decode())
109
+
110
+ self._logger.info("Successfully created key pair")
111
+ data = BaseKeyGeneralTransfers.KeyPair(private=private, public=public)
112
+ return BaseKeyResultsTransfers.CreatePair(data=data)
113
+ return _impl()
@@ -0,0 +1,18 @@
1
+ from typing import Union
2
+ from maleo_foundation.models.transfers.results.key import BaseKeyResultsTransfers
3
+
4
+ class BaseKeyResultsTypes:
5
+ CreatePrivate = Union[
6
+ BaseKeyResultsTransfers.Fail,
7
+ BaseKeyResultsTransfers.CreatePrivate
8
+ ]
9
+
10
+ CreatePublic = Union[
11
+ BaseKeyResultsTransfers.Fail,
12
+ BaseKeyResultsTransfers.CreatePublic
13
+ ]
14
+
15
+ CreatePair = Union[
16
+ BaseKeyResultsTransfers.Fail,
17
+ BaseKeyResultsTransfers.CreatePair
18
+ ]
@@ -0,0 +1,15 @@
1
+ from __future__ import annotations
2
+ from pydantic import BaseModel, Field
3
+ from maleo_foundation.enums import BaseEnums
4
+ from maleo_foundation.types import BaseTypes
5
+
6
+ class BaseKeySchemas:
7
+ class KeySize(BaseModel):
8
+ key_size:int = Field(2048, ge=2048, le=16384, description="Key's size")
9
+
10
+ class Password(BaseModel):
11
+ password:BaseTypes.OptionalString = Field(None, min_length=32, max_length=1024, description="password")
12
+
13
+ class Key(BaseModel):
14
+ type:BaseEnums.KeyType = Field(..., description="Key's type")
15
+ value:str = Field(..., description="Key's value")
@@ -0,0 +1,15 @@
1
+ from __future__ import annotations
2
+ from pydantic import BaseModel, Field
3
+ from maleo_foundation.enums import BaseEnums
4
+ from maleo_foundation.models.schemas.key import BaseKeySchemas
5
+
6
+ class BaseKeyGeneralTransfers:
7
+ class PrivateKey(BaseKeySchemas.Key):
8
+ type:BaseEnums.KeyType = Field(BaseEnums.KeyType.PRIVATE, description="Private key's type")
9
+
10
+ class PublicKey(BaseKeySchemas.Key):
11
+ type:BaseEnums.KeyType = Field(BaseEnums.KeyType.PUBLIC, description="Public key's type")
12
+
13
+ class KeyPair(BaseModel):
14
+ private:BaseKeyGeneralTransfers.PrivateKey = Field(..., description="Private key's data")
15
+ public:BaseKeyGeneralTransfers.PublicKey = Field(..., description="Public key's data")
@@ -0,0 +1,13 @@
1
+ from maleo_foundation.models.schemas.key import BaseKeySchemas
2
+ from maleo_foundation.models.transfers.general.key import BaseKeyGeneralTransfers
3
+
4
+ class BaseKeyParametersTransfers:
5
+ class CreatePrivateOrPair(
6
+ BaseKeySchemas.Password,
7
+ BaseKeySchemas.KeySize
8
+ ): pass
9
+
10
+ class CreatePublic(
11
+ BaseKeySchemas.Password,
12
+ BaseKeyGeneralTransfers.PrivateKey
13
+ ): pass
@@ -0,0 +1,16 @@
1
+ from __future__ import annotations
2
+ from pydantic import Field
3
+ from maleo_foundation.models.transfers.results.service.general import BaseServiceGeneralResultsTransfers
4
+ from maleo_foundation.models.transfers.general.key import BaseKeyGeneralTransfers
5
+
6
+ class BaseKeyResultsTransfers:
7
+ class Fail(BaseServiceGeneralResultsTransfers.Fail): pass
8
+
9
+ class CreatePrivate(BaseServiceGeneralResultsTransfers.SingleData):
10
+ data:BaseKeyGeneralTransfers.PrivateKey = Field(..., description="Private key data")
11
+
12
+ class CreatePublic(BaseServiceGeneralResultsTransfers.SingleData):
13
+ data:BaseKeyGeneralTransfers.PublicKey = Field(..., description="Private key data")
14
+
15
+ class CreatePair(BaseServiceGeneralResultsTransfers.SingleData):
16
+ data:BaseKeyGeneralTransfers.KeyPair = Field(..., description="Key pair data")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maleo_foundation
3
- Version: 0.1.76
3
+ Version: 0.1.77
4
4
  Summary: Foundation package for Maleo
5
5
  Author-email: Agra Bima Yuda <agra@nexmedis.com>
6
6
  License: MIT
@@ -14,6 +14,7 @@ maleo_foundation.egg-info/top_level.txt
14
14
  maleo_foundation/client/__init__.py
15
15
  maleo_foundation/client/manager.py
16
16
  maleo_foundation/client/services/__init__.py
17
+ maleo_foundation/client/services/key.py
17
18
  maleo_foundation/client/services/signature.py
18
19
  maleo_foundation/client/services/token.py
19
20
  maleo_foundation/client/services/encryption/__init__.py
@@ -27,6 +28,7 @@ maleo_foundation/expanded_types/__init__.py
27
28
  maleo_foundation/expanded_types/client.py
28
29
  maleo_foundation/expanded_types/general.py
29
30
  maleo_foundation/expanded_types/hash.py
31
+ maleo_foundation/expanded_types/key.py
30
32
  maleo_foundation/expanded_types/query.py
31
33
  maleo_foundation/expanded_types/service.py
32
34
  maleo_foundation/expanded_types/signature.py
@@ -55,17 +57,20 @@ maleo_foundation/models/schemas/__init__.py
55
57
  maleo_foundation/models/schemas/encryption.py
56
58
  maleo_foundation/models/schemas/general.py
57
59
  maleo_foundation/models/schemas/hash.py
60
+ maleo_foundation/models/schemas/key.py
58
61
  maleo_foundation/models/schemas/parameter.py
59
62
  maleo_foundation/models/schemas/result.py
60
63
  maleo_foundation/models/schemas/signature.py
61
64
  maleo_foundation/models/schemas/token.py
62
65
  maleo_foundation/models/transfers/__init__.py
63
66
  maleo_foundation/models/transfers/general/__init__.py
67
+ maleo_foundation/models/transfers/general/key.py
64
68
  maleo_foundation/models/transfers/general/signature.py
65
69
  maleo_foundation/models/transfers/general/token.py
66
70
  maleo_foundation/models/transfers/parameters/__init__.py
67
71
  maleo_foundation/models/transfers/parameters/client.py
68
72
  maleo_foundation/models/transfers/parameters/general.py
73
+ maleo_foundation/models/transfers/parameters/key.py
69
74
  maleo_foundation/models/transfers/parameters/service.py
70
75
  maleo_foundation/models/transfers/parameters/signature.py
71
76
  maleo_foundation/models/transfers/parameters/token.py
@@ -78,6 +83,7 @@ maleo_foundation/models/transfers/parameters/hash/hmac.py
78
83
  maleo_foundation/models/transfers/parameters/hash/sha256.py
79
84
  maleo_foundation/models/transfers/results/__init__.py
80
85
  maleo_foundation/models/transfers/results/hash.py
86
+ maleo_foundation/models/transfers/results/key.py
81
87
  maleo_foundation/models/transfers/results/signature.py
82
88
  maleo_foundation/models/transfers/results/token.py
83
89
  maleo_foundation/models/transfers/results/client/__init__.py
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "maleo_foundation"
7
- version = "0.1.76"
7
+ version = "0.1.77"
8
8
  description = "Foundation package for Maleo"
9
9
  authors = [
10
10
  { name = "Agra Bima Yuda", email = "agra@nexmedis.com" }