()
| 26 | } |
| 27 | |
| 28 | async function loadKeytar(): Promise<KeytarModule | null> { |
| 29 | try { |
| 30 | const mod = (await import('keytar')) as Partial<KeytarModule> | { default?: Partial<KeytarModule> } |
| 31 | const candidate = ('default' in mod ? mod.default : mod) as Partial<KeytarModule> | undefined |
| 32 | if ( |
| 33 | candidate && |
| 34 | typeof candidate.getPassword === 'function' && |
| 35 | typeof candidate.setPassword === 'function' && |
| 36 | typeof candidate.deletePassword === 'function' |
| 37 | ) { |
| 38 | return candidate as KeytarModule |
| 39 | } |
| 40 | } catch { |
| 41 | // keytar is optional; safeStorage fallback handles the common case. |
| 42 | } |
| 43 | return null |
| 44 | } |
| 45 | |
| 46 | async function loadFallbackSecrets(): Promise<SecretMap> { |
| 47 | try { |
no outgoing calls
no test coverage detected