passphera-core 0.25.2__py3-none-any.whl → 0.26.0__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.
@@ -61,6 +61,23 @@ class Password:
61
61
  key = derive_key(self.password, self.salt)
62
62
  return Fernet(key).decrypt(self.password.encode()).decode()
63
63
 
64
+ def to_dict(self) -> dict:
65
+ """Convert the Password entity to a dictionary."""
66
+ return {
67
+ "id": self.id,
68
+ "created_at": self.created_at,
69
+ "updated_at": self.updated_at,
70
+ "context": self.context,
71
+ "text": self.text,
72
+ "password": self.password,
73
+ "salt": self.salt,
74
+ }
75
+
76
+ def from_dict(self, data: dict) -> None:
77
+ """Convert a dictionary to a Password entity."""
78
+ for key, value in data.items():
79
+ setattr(self, key, value)
80
+
64
81
 
65
82
  @dataclass
66
83
  class Generator:
@@ -177,3 +194,22 @@ class Generator:
177
194
  password: str = main_algorithm.encrypt(intermediate)
178
195
  password = password.translate(str.maketrans(self.characters_replacements))
179
196
  return ''.join(c.upper() if c in text else c for c in password)
197
+
198
+ def to_dict(self) -> dict:
199
+ """Convert the Generator entity to a dictionary."""
200
+ return {
201
+ "id": self.id,
202
+ "created_at": self.created_at,
203
+ "updated_at": self.updated_at,
204
+ "shift": self.shift,
205
+ "multiplier": self.multiplier,
206
+ "key": self.key,
207
+ "algorithm": self.algorithm,
208
+ "prefix": self.prefix,
209
+ "postfix": self.postfix,
210
+ }
211
+
212
+ def from_dict(self, data: dict) -> None:
213
+ """Convert a dictionary to a Generator entity."""
214
+ for key, value in data.items():
215
+ setattr(self, key, value)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: passphera-core
3
- Version: 0.25.2
3
+ Version: 0.26.0
4
4
  Summary: The core system of passphera project
5
5
  Home-page: https://github.com/passphera/core
6
6
  Author: Fathi Abdelmalek
@@ -1,12 +1,12 @@
1
1
  passphera_core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- passphera_core/entities.py,sha256=xl9HAZA9SFgO5xt5bsyGbcH508auU33J-7D52bn1wbI,7550
2
+ passphera_core/entities.py,sha256=LnIMQ5xbVP59Cn96AmQ6BY358VJ-Vcx01pvhj919iJk,8732
3
3
  passphera_core/exceptions.py,sha256=Tqb-FKJ1_JfX5gSC8Wc0CP84AhwouvnP2gkg83xAlUY,786
4
4
  passphera_core/interfaces.py,sha256=DpHFh_vnamORf69P1dwLrZ8AYZPcYIol0Lq_VKRBkXc,855
5
5
  passphera_core/utilities.py,sha256=n7cAVox-yGd60595RjLvrGKSGqFQRm279YqKS3-R1X0,748
6
6
  passphera_core/application/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  passphera_core/application/generator.py,sha256=hBSk6vktJ2KPxzKSRnH_WVnCvg7vOHVzN-TQ5GdgXEQ,2769
8
8
  passphera_core/application/password.py,sha256=9wsSz3uMWEZCgfnX5V7WYiWp2OqjSmsn6OSWK4HIIfo,2876
9
- passphera_core-0.25.2.dist-info/METADATA,sha256=X0VrNDvEBZOQPMvaYd3n4hop0HlN-yAkNEGhBlUu50k,868
10
- passphera_core-0.25.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
- passphera_core-0.25.2.dist-info/top_level.txt,sha256=aDUX2iWGOyfzyf6XakLWTbgeWqNrypMHO074Qratyds,15
12
- passphera_core-0.25.2.dist-info/RECORD,,
9
+ passphera_core-0.26.0.dist-info/METADATA,sha256=PR8YE14fjCXNrx644AfMpzpPLp28HFOAEzJz7BmRHQQ,868
10
+ passphera_core-0.26.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
11
+ passphera_core-0.26.0.dist-info/top_level.txt,sha256=aDUX2iWGOyfzyf6XakLWTbgeWqNrypMHO074Qratyds,15
12
+ passphera_core-0.26.0.dist-info/RECORD,,