MCPcopy
hub / github.com/codeaashu/claude-code / spawnSecurity

Function spawnSecurity

src/utils/secureStorage/keychainPrefetch.ts:45–63  ·  view source on GitHub ↗
(serviceName: string)

Source from the content-addressed store, hash-verified

43type SpawnResult = { stdout: string | null; timedOut: boolean }
44
45function spawnSecurity(serviceName: string): Promise<SpawnResult> {
46 return new Promise(resolve => {
47 execFile(
48 'security',
49 ['find-generic-password', '-a', getUsername(), '-w', '-s', serviceName],
50 { encoding: 'utf-8', timeout: KEYCHAIN_PREFETCH_TIMEOUT_MS },
51 (err, stdout) => {
52 // Exit 44 (entry not found) is a valid "no key" result and safe to
53 // prime as null. But timeout (err.killed) means the keychain MAY have
54 // a key we couldn't fetch — don't prime, let sync spawn retry.
55 // biome-ignore lint/nursery/noFloatingPromises: resolve() is not a floating promise
56 resolve({
57 stdout: err ? null : stdout?.trim() || null,
58 timedOut: Boolean(err && 'killed' in err && err.killed),
59 })
60 },
61 )
62 })
63}
64
65/**
66 * Fire both keychain reads in parallel. Called at main.tsx top-level

Callers 1

startKeychainPrefetchFunction · 0.85

Calls 2

getUsernameFunction · 0.70
resolveFunction · 0.50

Tested by

no test coverage detected