MCPcopy Index your code
hub / github.com/codeaashu/claude-code / maybeRemoveApiKeyFromMacOSKeychainThrows

Function maybeRemoveApiKeyFromMacOSKeychainThrows

src/utils/authPortable.ts:4–15  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2import { getMacOsKeychainStorageServiceName } from 'src/utils/secureStorage/macOsKeychainHelpers.js'
3
4export async function maybeRemoveApiKeyFromMacOSKeychainThrows(): Promise<void> {
5 if (process.platform === 'darwin') {
6 const storageServiceName = getMacOsKeychainStorageServiceName()
7 const result = await execa(
8 `security delete-generic-password -a $USER -s "${storageServiceName}"`,
9 { shell: true, reject: false },
10 )
11 if (result.exitCode !== 0) {
12 throw new Error('Failed to delete keychain entry')
13 }
14 }
15}
16
17export function normalizeApiKeyForConfig(apiKey: string): string {
18 return apiKey.slice(-20)

Callers 1

Calls 1

Tested by

no test coverage detected