(serviceName: string)
| 43 | type SpawnResult = { stdout: string | null; timedOut: boolean } |
| 44 | |
| 45 | function 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 |
no test coverage detected