passphera-core 0.25.1__tar.gz → 0.25.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: passphera-core
3
- Version: 0.25.1
3
+ Version: 0.25.2
4
4
  Summary: The core system of passphera project
5
5
  Home-page: https://github.com/passphera/core
6
6
  Author: Fathi Abdelmalek
@@ -11,6 +11,22 @@ from cipherspy.utilities import generate_salt, derive_key
11
11
  from passphera_core.exceptions import InvalidPropertyNameException
12
12
 
13
13
 
14
+ _cipher_registry: dict[str, BaseCipherAlgorithm] = {
15
+ 'caesar': CaesarCipherAlgorithm,
16
+ 'affine': AffineCipherAlgorithm,
17
+ 'playfair': PlayfairCipherAlgorithm,
18
+ 'hill': HillCipherAlgorithm,
19
+ }
20
+ _default_properties: dict[str, str] = {
21
+ "shift": 3,
22
+ "multiplier": 3,
23
+ "key": "hill",
24
+ "algorithm": "hill",
25
+ "prefix": "secret",
26
+ "postfix": "secret"
27
+ }
28
+
29
+
14
30
  @dataclass
15
31
  class Password:
16
32
  id: UUID = field(default_factory=uuid4)
@@ -48,21 +64,6 @@ class Password:
48
64
 
49
65
  @dataclass
50
66
  class Generator:
51
- _cipher_registry: dict[str, BaseCipherAlgorithm] = field(default_factory=lambda: {
52
- 'caesar': CaesarCipherAlgorithm,
53
- 'affine': AffineCipherAlgorithm,
54
- 'playfair': PlayfairCipherAlgorithm,
55
- 'hill': HillCipherAlgorithm,
56
- }, init=False)
57
- _default_properties: dict[str, str] = field(default_factory=lambda:{
58
- "shift": 3,
59
- "multiplier": 3,
60
- "key": "hill",
61
- "algorithm": "hill",
62
- "prefix": "secret",
63
- "postfix": "secret"
64
- }, init=False)
65
-
66
67
  id: UUID = field(default_factory=uuid4)
67
68
  created_at: datetime = field(default_factory=datetime.now)
68
69
  updated_at: datetime = field(default_factory=datetime.now)
@@ -79,9 +80,9 @@ class Generator:
79
80
  Get the primary algorithm used to cipher the password
80
81
  :return: BaseCipherAlgorithm: The primary algorithm used for the cipher
81
82
  """
82
- if self.algorithm.lower() not in self._cipher_registry:
83
+ if self.algorithm.lower() not in _cipher_registry:
83
84
  raise InvalidAlgorithmException(self.algorithm)
84
- return self._cipher_registry[self.algorithm.lower()]
85
+ return _cipher_registry[self.algorithm.lower()]
85
86
 
86
87
  def get_properties(self) -> dict:
87
88
  """
@@ -131,7 +132,7 @@ class Generator:
131
132
  """
132
133
  if prop not in {"shift", "multiplier", "key", "algorithm", "prefix", "postfix"}:
133
134
  raise InvalidPropertyNameException(prop)
134
- setattr(self, prop, self._default_properties[prop])
135
+ setattr(self, prop, _default_properties[prop])
135
136
  if prop == "algorithm":
136
137
  self.get_algorithm()
137
138
  self.updated_at = datetime.now(timezone.utc)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: passphera-core
3
- Version: 0.25.1
3
+ Version: 0.25.2
4
4
  Summary: The core system of passphera project
5
5
  Home-page: https://github.com/passphera/core
6
6
  Author: Fathi Abdelmalek
@@ -5,7 +5,7 @@ with open("README.md", "r") as f:
5
5
 
6
6
  setup(
7
7
  name='passphera-core',
8
- version='0.25.1',
8
+ version='0.25.2',
9
9
  author='Fathi Abdelmalek',
10
10
  author_email='abdelmalek.fathi.2001@gmail.com',
11
11
  url='https://github.com/passphera/core',