(path = credentialPath())
| 104 | * no-op when there is nothing to clear. |
| 105 | */ |
| 106 | export async function clearUserInfo(path = credentialPath()): Promise<void> { |
| 107 | const { credentials, source } = await readStore(path); |
| 108 | if (source === "absent" || !credentials.user) return; |
| 109 | delete credentials.user; |
| 110 | if (!credentials.api_key && !credentials.oauth && !hasPreservedUnknownData(credentials)) { |
| 111 | await deleteStore(path); |
| 112 | return; |
| 113 | } |
| 114 | await writeStore(credentials, path); |
| 115 | } |
no test coverage detected