()
| 138 | } |
| 139 | |
| 140 | async function readLocalAuth(): Promise<Record<string, Info>> { |
| 141 | const file = Bun.file(filepath) |
| 142 | const data = await file.json().catch(() => ({}) as Record<string, unknown>) |
| 143 | return Object.entries(data).reduce( |
| 144 | (acc, [key, value]) => { |
| 145 | const parsed = Info.safeParse(value) |
| 146 | if (!parsed.success) return acc |
| 147 | acc[key] = parsed.data |
| 148 | return acc |
| 149 | }, |
| 150 | {} as Record<string, Info>, |
| 151 | ) |
| 152 | } |
| 153 | |
| 154 | export async function get(providerID: string) { |
| 155 | const auth = await all() |