()
| 44 | } |
| 45 | |
| 46 | async function loadFallbackSecrets(): Promise<SecretMap> { |
| 47 | try { |
| 48 | const raw = await fs.readFile(fallbackPath(), 'utf8') |
| 49 | const parsed = JSON.parse(raw) as Record<string, unknown> |
| 50 | const out: SecretMap = {} |
| 51 | for (const [key, value] of Object.entries(parsed)) { |
| 52 | if (typeof value === 'string' && value.trim()) out[key] = value |
| 53 | } |
| 54 | return out |
| 55 | } catch { |
| 56 | return {} |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | async function saveFallbackSecrets(next: SecretMap): Promise<void> { |
| 61 | await fs.mkdir(path.dirname(fallbackPath()), { recursive: true }) |
no test coverage detected