mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2026-10-30 01:12:17 +00:00
test(utils): Add test and error handling for wiped InMemorySecret
- Updated `InMemorySecret.get_bytes()` in `src/utils/memory_protection.py` to raise a `RuntimeError` if the secret has been wiped, replacing the previous `AttributeError`. - Added `test_access_after_wipe_raises_error` to `src/tests/test_memory_protection.py` to verify this behavior. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
335de7abe3
commit
d729466513
2 files changed
+15
No files matched your search
@@ -17,6 +17,8 @@ class InMemorySecret:
|
||||
|
||||
def get_bytes(self) -> bytes:
|
||||
"""Decrypt and return the plaintext bytes."""
|
||||
if self._cipher is None:
|
||||
raise RuntimeError("Secret has been wiped")
|
||||
return self._cipher.decrypt(self._nonce, self._encrypted, None)
|
||||
|
||||
def wipe(self) -> None:
|
||||
|
||||
Reference in new issue
Block a user