π File detail
utils/authPortable.ts
π§© .tsπ 20 linesπΎ 674 bytesπ text
β Back to All Filesπ― Use case
This file lives under βutils/β, which covers cross-cutting helpers (shell, tempfiles, settings, messages, process input, β¦). On the API surface it exposes maybeRemoveApiKeyFromMacOSKeychainThrows and normalizeApiKeyForConfig β mainly functions, hooks, or classes. Dependencies touch child processes and src.
Generated from folder role, exports, dependency roots, and inline comments β not hand-reviewed for every path.
π§ Inline summary
import { execa } from 'execa' import { getMacOsKeychainStorageServiceName } from 'src/utils/secureStorage/macOsKeychainHelpers.js' export async function maybeRemoveApiKeyFromMacOSKeychainThrows(): Promise<void> { if (process.platform === 'darwin') {
π€ Exports (heuristic)
maybeRemoveApiKeyFromMacOSKeychainThrowsnormalizeApiKeyForConfig
π External import roots
Package roots from from "β¦" (relative paths omitted).
execasrc
π₯οΈ Source preview
import { execa } from 'execa'
import { getMacOsKeychainStorageServiceName } from 'src/utils/secureStorage/macOsKeychainHelpers.js'
export async function maybeRemoveApiKeyFromMacOSKeychainThrows(): Promise<void> {
if (process.platform === 'darwin') {
const storageServiceName = getMacOsKeychainStorageServiceName()
const result = await execa(
`security delete-generic-password -a $USER -s "${storageServiceName}"`,
{ shell: true, reject: false },
)
if (result.exitCode !== 0) {
throw new Error('Failed to delete keychain entry')
}
}
}
export function normalizeApiKeyForConfig(apiKey: string): string {
return apiKey.slice(-20)
}