MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / clearUserCredentials

Function clearUserCredentials

cli/src/utils/auth.ts:190–212  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

188 * Only removes the 'default' field, preserving other credentials.
189 */
190export const clearUserCredentials = (): void => {
191 const credentialsPath = getCredentialsPath()
192
193 try {
194 if (!fs.existsSync(credentialsPath)) return
195
196 const { default: _, ...rest } = readCredentialsFile()
197
198 if (Object.keys(rest).length === 0) {
199 fs.unlinkSync(credentialsPath)
200 } else {
201 fs.writeFileSync(credentialsPath, JSON.stringify(rest, null, 2))
202 }
203 } catch (error) {
204 logger.error(
205 {
206 error: error instanceof Error ? error.message : String(error),
207 },
208 'Error clearing credentials',
209 )
210 throw error
211 }
212}
213
214export async function logoutUser(): Promise<boolean> {
215 try {

Callers 1

logoutUserFunction · 0.85

Calls 2

readCredentialsFileFunction · 0.85
getCredentialsPathFunction · 0.70

Tested by

no test coverage detected