Save data to file
(self)
| 32 | } |
| 33 | |
| 34 | def save(self): |
| 35 | """ |
| 36 | Save data to file |
| 37 | """ |
| 38 | try: |
| 39 | temp = self.data.copy() |
| 40 | if self.data.get("cipher_enabled") and self.data.get("hashed_password"): |
| 41 | temp["hashed_password"] = base64.b64encode( |
| 42 | temp["hashed_password"] |
| 43 | ).decode("utf-8") |
| 44 | with open(self.file_name, "w") as f: |
| 45 | json.dump(temp, f, indent=4) |
| 46 | except Exception as e: |
| 47 | logging.error(f"Failed to save data: {e}") |
| 48 | |
| 49 | def load(self): |
| 50 | """ |
no test coverage detected