()
| 149 | |
| 150 | /** Read existing credentials file, returns empty object if missing/invalid */ |
| 151 | const readCredentialsFile = (): Record<string, unknown> => { |
| 152 | const credentialsPath = getCredentialsPath() |
| 153 | if (!fs.existsSync(credentialsPath)) return {} |
| 154 | try { |
| 155 | return JSON.parse(fs.readFileSync(credentialsPath, 'utf8')) |
| 156 | } catch { |
| 157 | return {} |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | /** |
| 162 | * Save user credentials to file system. |
no test coverage detected