passphera-core 0.23.0__tar.gz → 0.24.0__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.23.0
3
+ Version: 0.24.0
4
4
  Summary: The core system of passphera project
5
5
  Home-page: https://github.com/passphera/core
6
6
  Author: Fathi Abdelmalek
@@ -8,6 +8,8 @@ from cipherspy.cipher import *
8
8
  from cipherspy.exceptions import InvalidAlgorithmException
9
9
  from cipherspy.utilities import generate_salt, derive_key
10
10
 
11
+ from passphera_core.exceptions import InvalidPropertyNameException
12
+
11
13
 
12
14
  @dataclass
13
15
  class Password:
@@ -112,7 +114,7 @@ class Generator:
112
114
  :return: None
113
115
  """
114
116
  if prop not in {"shift", "multiplier", "key", "algorithm", "prefix", "postfix"}:
115
- raise ValueError(f"Invalid property: {prop}")
117
+ raise InvalidPropertyNameException(prop)
116
118
  if prop in ["shift", "multiplier"]:
117
119
  value = int(value)
118
120
  setattr(self, prop, value)
@@ -128,8 +130,7 @@ class Generator:
128
130
  :return: None
129
131
  """
130
132
  if prop not in {"shift", "multiplier", "key", "algorithm", "prefix", "postfix"}:
131
- raise ValueError(f"Invalid property: {prop}")
132
-
133
+ raise InvalidPropertyNameException(prop)
133
134
  setattr(self, prop, self._default_properties[prop])
134
135
  if prop == "algorithm":
135
136
  self.get_algorithm()
@@ -17,3 +17,9 @@ class DuplicatePasswordException(Exception):
17
17
  if hasattr(password, 'context') and password.context:
18
18
  return f"Password for context '{password.context}' already exists"
19
19
  return "Duplicate password detected"
20
+
21
+
22
+ class InvalidPropertyNameException(Exception):
23
+ def __init__(self, property_name: str) -> None:
24
+ self.property_name = property_name
25
+ super().__init__(f"Invalid property name '{property_name}'")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: passphera-core
3
- Version: 0.23.0
3
+ Version: 0.24.0
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.23.0',
8
+ version='0.24.0',
9
9
  author='Fathi Abdelmalek',
10
10
  author_email='abdelmalek.fathi.2001@gmail.com',
11
11
  url='https://github.com/passphera/core',