( clientEnv: ClientEnv = env, )
| 154 | } |
| 155 | |
| 156 | export const clearChatGptOAuthCredentials = ( |
| 157 | clientEnv: ClientEnv = env, |
| 158 | ): void => { |
| 159 | const credentialsPath = getCredentialsPath(clientEnv) |
| 160 | if (!fs.existsSync(credentialsPath)) { |
| 161 | return |
| 162 | } |
| 163 | |
| 164 | try { |
| 165 | const existingData = JSON.parse(fs.readFileSync(credentialsPath, 'utf8')) |
| 166 | delete existingData.chatgptOAuth |
| 167 | fs.writeFileSync(credentialsPath, JSON.stringify(existingData, null, 2)) |
| 168 | } catch { |
| 169 | // Ignore errors |
| 170 | } |
| 171 | } |
| 172 | |
| 173 | export const isChatGptOAuthValid = (clientEnv: ClientEnv = env): boolean => { |
| 174 | const credentials = getChatGptOAuthCredentials(clientEnv) |
no test coverage detected