init
This commit is contained in:
commit
ec53fcbe95
1905 changed files with 513762 additions and 0 deletions
19
utils/authPortable.ts
Normal file
19
utils/authPortable.ts
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
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)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue