(data: AuthData)
| 21 | }; |
| 22 | |
| 23 | export function saveAuth(data: AuthData) { |
| 24 | if (!existsSync(AUTH_DIR)) { |
| 25 | // Owner-only permissions (rwx------) so other users on the machine can't read tokens |
| 26 | mkdirSync(AUTH_DIR, { mode: 0o700 }); |
| 27 | } |
| 28 | writeFileSync(AUTH_FILE, JSON.stringify(data), { mode: 0o600 }); |
| 29 | } |
| 30 | |
| 31 | export function clearAuth() { |
| 32 | try { |