()
| 46 | } |
| 47 | |
| 48 | export function loadTokens(): TokenData | null { |
| 49 | const credentialsFile = resolveReadPathSync( |
| 50 | CREDENTIALS_FILE_NAME, |
| 51 | getCredentialsFilePath(), |
| 52 | CREDENTIALS_MODE |
| 53 | ); |
| 54 | if (!fs.existsSync(credentialsFile)) { |
| 55 | return null; |
| 56 | } |
| 57 | try { |
| 58 | const data = JSON.parse(fs.readFileSync(credentialsFile, "utf-8")); |
| 59 | return data as TokenData; |
| 60 | } catch { |
| 61 | return null; |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | export function clearTokens(): boolean { |
| 66 | const credentialsFile = getCredentialsFilePath(); |
no test coverage detected