Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | import * as fs from 'node:fs'
import * as os from 'node:os'
import * as path from 'node:path'
import { getEnvConfig } from './config'
export function readAccessToken(): string | null {
const { authUrl } = getEnvConfig()
try {
const raw = fs.readFileSync(path.join(os.homedir(), '.boltzbit', 'credentials.json'), 'utf-8')
const store = JSON.parse(raw) as Record<string, { accessToken?: string }>
return store[authUrl]?.accessToken ?? null
} catch {
return null
}
}
|