passphera-core 0.9.1__py3-none-any.whl → 0.10.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.
@@ -19,7 +19,7 @@ class GeneratePasswordUseCase:
19
19
 
20
20
  def execute(self, user_id: UUID, context: str, text: str) -> Password:
21
21
  user_entity: User = self.user_repository.find_by_id(user_id)
22
- generator_entity: Generator = self.generator_repository.find_by_id(user_entity.generator)
22
+ generator_entity: Generator = self.generator_repository.find_by_id(user_entity.generator_id)
23
23
  password: str = generator_entity.generate_password(text)
24
24
  password_entity: Password = Password(user_id=user_id, context=context, text=text, password=password)
25
25
  password_entity.encrypt()
@@ -47,7 +47,7 @@ class GetPasswordByContextUseCase:
47
47
 
48
48
  def execute(self, user_id: UUID, context: str) -> Password:
49
49
  user_entity: User = self.user_repository.find_by_id(user_id)
50
- for password_id in user_entity.passwords:
50
+ for password_id in user_entity.passwords_ids:
51
51
  password_entity: Password = self.password_repository.find_by_id(password_id)
52
52
  if password_entity.context == context:
53
53
  return password_entity
@@ -67,8 +67,8 @@ class UpdatePasswordUseCase:
67
67
 
68
68
  def execute(self, user_id: UUID, context: str, text: str) -> Password:
69
69
  user_entity: User = self.user_repository.find_by_id(user_id)
70
- generator_entity: Generator = self.generator_repository.find_by_id(user_entity.generator)
71
- for password_id in user_entity.passwords:
70
+ generator_entity: Generator = self.generator_repository.find_by_id(user_entity.generator_id)
71
+ for password_id in user_entity.passwords_ids:
72
72
  password_entity: Password = self.password_repository.find_by_id(password_id)
73
73
  if password_entity.context == context:
74
74
  password_entity.password = generator_entity.generate_password(text)
@@ -99,7 +99,7 @@ class GetAllUserPasswordsUseCase:
99
99
  def execute(self, user_id: UUID) -> list[Password]:
100
100
  user_entity: User = self.user_repository.find_by_id(user_id)
101
101
  passwords: list[Password] = []
102
- for password_id in user_entity.passwords:
102
+ for password_id in user_entity.passwords_ids:
103
103
  password_entity: Password = self.password_repository.find_by_id(password_id)
104
104
  passwords.append(password_entity)
105
105
  return passwords
@@ -112,7 +112,7 @@ class DeleteAllUserPasswordsUseCase:
112
112
 
113
113
  def execute(self, user_id: UUID) -> None:
114
114
  user_entity: User = self.user_repository.find_by_id(user_id)
115
- for password_id in user_entity.passwords:
115
+ for password_id in user_entity.passwords_ids:
116
116
  self.password_repository.delete(password_id)
117
117
  user_entity.delete_password(password_id)
118
118
  self.user_repository.update(user_entity)
@@ -18,7 +18,7 @@ class RegisterUserUseCase:
18
18
  user_entity: User = User(**user.__dict__)
19
19
  generator_entity: Generator = Generator(user_id=user_entity.id)
20
20
  self.generator_repository.save(generator_entity)
21
- user_entity.generator = generator_entity.id
21
+ user_entity.generator_id = generator_entity.id
22
22
  self.user_repository.save(user_entity)
23
23
  return user_entity
24
24
 
@@ -84,7 +84,11 @@ class Generator:
84
84
  user_id: UUID = field(default_factory=uuid4)
85
85
  created_at: datetime = field(default_factory=datetime.now)
86
86
  updated_at: datetime = field(default_factory=datetime.now)
87
+ config_id: UUID = field(default_factory=UUID)
87
88
  config: GeneratorConfig = field(default_factory=GeneratorConfig)
89
+
90
+ def __post_init__(self):
91
+ self.config = GeneratorConfig(generator_id=self.id)
88
92
 
89
93
  def apply_replacements(self, password: str) -> str:
90
94
  """
@@ -115,11 +119,11 @@ class User:
115
119
  username: str = field(default_factory=str)
116
120
  email: str = field(default_factory=str)
117
121
  password: str = field(default_factory=str)
118
- generator: UUID = field(default_factory=UUID)
119
- passwords: list[UUID] = field(default_factory=list[UUID])
122
+ generator_id: UUID = field(default_factory=UUID)
123
+ passwords_ids: list[UUID] = field(default_factory=list[UUID])
120
124
 
121
125
  def add_password(self, password_id: UUID) -> None:
122
- self.passwords.append(password_id)
126
+ self.passwords_ids.append(password_id)
123
127
 
124
128
  def delete_password(self, password_id: UUID) -> None:
125
- self.passwords.remove(password_id)
129
+ self.passwords_ids.remove(password_id)
@@ -31,10 +31,6 @@ class GeneratorRepository(ABC):
31
31
  def update(self, generator: Generator) -> None:
32
32
  pass
33
33
 
34
- @abstractmethod
35
- def delete(self, generator_id: UUID) -> None:
36
- pass
37
-
38
34
  @abstractmethod
39
35
  def find_by_id(self, generator_id: UUID) -> Generator:
40
36
  pass
@@ -53,10 +49,6 @@ class GeneratorConfigRepository(ABC):
53
49
  def update(self, generator_config: GeneratorConfig) -> None:
54
50
  pass
55
51
 
56
- @abstractmethod
57
- def delete(self, generator_config_id: UUID) -> None:
58
- pass
59
-
60
52
  @abstractmethod
61
53
  def find_by_id(self, generator_config_id: UUID) -> GeneratorConfig:
62
54
  pass
@@ -75,10 +67,6 @@ class UserRepository(ABC):
75
67
  def update(self, user: User) -> None:
76
68
  pass
77
69
 
78
- @abstractmethod
79
- def delete(self, user_id: UUID) -> None:
80
- pass
81
-
82
70
  @abstractmethod
83
71
  def find_by_id(self, user_id: UUID) -> User:
84
72
  pass
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.2
2
2
  Name: passphera-core
3
- Version: 0.9.1
3
+ Version: 0.10.0
4
4
  Summary: The core system of passphera project
5
5
  Home-page: https://github.com/passphera/core
6
6
  Author: Fathi Abdelmalek
@@ -15,6 +15,15 @@ Classifier: Topic :: Security :: Cryptography
15
15
  Requires-Python: >=3
16
16
  Description-Content-Type: text/markdown
17
17
  Requires-Dist: cipherspy
18
+ Dynamic: author
19
+ Dynamic: author-email
20
+ Dynamic: classifier
21
+ Dynamic: description
22
+ Dynamic: description-content-type
23
+ Dynamic: home-page
24
+ Dynamic: requires-dist
25
+ Dynamic: requires-python
26
+ Dynamic: summary
18
27
 
19
28
  # passphera-core
20
29
 
@@ -0,0 +1,12 @@
1
+ passphera_core/__init__.py,sha256=0kEfHV5WvMWDoFn1qCeuD52WsgaX4sQ4V9P48cnFKb8,120
2
+ passphera_core/entities.py,sha256=vzD6NMA--kUI9DZ39wHCkniRI-bimxMTpE1gh5mzr3k,5180
3
+ passphera_core/exceptions.py,sha256=5NvV6LW4Pdok6gRxvM0cN3q6JEKgaCYAX8qGr2eqX2w,1890
4
+ passphera_core/interfaces.py,sha256=plI-jQ7cOKFtcL1Dh5UVfmPbJY525h57l44On9BQfac,1782
5
+ passphera_core/application/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ passphera_core/application/generator.py,sha256=ABUigLMtP52CHpTKIZmwNb0pgGeL4s_WgrpxLr1M9zw,3896
7
+ passphera_core/application/password.py,sha256=osy04J0MD5cZQA47RKH9KqA-P52MB3bWSEr1oirtORM,5533
8
+ passphera_core/application/user.py,sha256=yKIDxUi56I__KFhRViiTSxEsakFvssynazr3vHX7vqw,2069
9
+ passphera_core-0.10.0.dist-info/METADATA,sha256=4kQXy2_AgAVos1pEZYB_bLEYAKn8Pen68CVmF51__zM,869
10
+ passphera_core-0.10.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
11
+ passphera_core-0.10.0.dist-info/top_level.txt,sha256=aDUX2iWGOyfzyf6XakLWTbgeWqNrypMHO074Qratyds,15
12
+ passphera_core-0.10.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.45.1)
2
+ Generator: setuptools (75.8.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,12 +0,0 @@
1
- passphera_core/__init__.py,sha256=0kEfHV5WvMWDoFn1qCeuD52WsgaX4sQ4V9P48cnFKb8,120
2
- passphera_core/entities.py,sha256=SvzBKDx9NkaVunXBGT-PgEWbXNXivb8pGw9Q_KFtAgI,5021
3
- passphera_core/exceptions.py,sha256=5NvV6LW4Pdok6gRxvM0cN3q6JEKgaCYAX8qGr2eqX2w,1890
4
- passphera_core/interfaces.py,sha256=uwHjPd1uhnA02X9h39IrHuNS-_M8j_RyKMVdxi3DUak,2036
5
- passphera_core/application/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- passphera_core/application/generator.py,sha256=ABUigLMtP52CHpTKIZmwNb0pgGeL4s_WgrpxLr1M9zw,3896
7
- passphera_core/application/password.py,sha256=72PXsHsSYvBDLdzwtC8icwf8KZPScWBKb9jKIQRAkEg,5511
8
- passphera_core/application/user.py,sha256=WTDjccHjxoqsfC2j0c9MfwREmiST9XxYOHoaDWYGTcg,2066
9
- passphera_core-0.9.1.dist-info/METADATA,sha256=jwBmrk5oor-rOcC6PSjASjC00mpNFHc3PifeR3uKZ44,671
10
- passphera_core-0.9.1.dist-info/WHEEL,sha256=tZoeGjtWxWRfdplE7E3d45VPlLNQnvbKiYnx7gwAy8A,92
11
- passphera_core-0.9.1.dist-info/top_level.txt,sha256=aDUX2iWGOyfzyf6XakLWTbgeWqNrypMHO074Qratyds,15
12
- passphera_core-0.9.1.dist-info/RECORD,,