()
| 2069 | |
| 2070 | |
| 2071 | def _load_credentials(): |
| 2072 | path = Path(CREDS_FILE) |
| 2073 | if not path.exists(): |
| 2074 | return None |
| 2075 | try: |
| 2076 | raw_text = path.read_text(encoding="utf-8") |
| 2077 | except Exception: |
| 2078 | return None |
| 2079 | if not raw_text: |
| 2080 | return None |
| 2081 | try: |
| 2082 | parsed = json.loads(raw_text) |
| 2083 | except Exception: |
| 2084 | return None |
| 2085 | if isinstance(parsed, dict): |
| 2086 | decrypted = _decrypt_creds(parsed) |
| 2087 | if isinstance(decrypted, dict): |
| 2088 | return decrypted |
| 2089 | if "__cred_store" not in parsed: |
| 2090 | return parsed |
| 2091 | return None |
| 2092 | |
| 2093 | |
| 2094 | def _save_credentials(payload): |
no test coverage detected