(dataDir = resolveDataDir())
| 17 | const token = value.trim(); |
| 18 | return token.length > 0 ? token : null; |
| 19 | } |
| 20 | |
| 21 | export function readInternalApiToken(dataDir = resolveDataDir()): string | null { |
| 22 | const tokenPath = getInternalApiTokenPath(dataDir); |
| 23 | if (!existsSync(tokenPath)) return null; |
| 24 | |
| 25 | try { |
| 26 | return normalizeToken(readFileSync(tokenPath, 'utf-8')) ?? null; |
| 27 | } catch { |
| 28 | return null; |
| 29 | } |
| 30 | } |
| 31 |
no test coverage detected