A games launcher for GOG, Amazon and Epic Games for Linux, Windows and macOS.
TypeScript amazon-primeelectronepic-games-launcherepic-games-storeepic-storegaminggoggog-galaxyheroic-games-launcherlinuxplay-gamesprotonsteamwine
import { scrubSensitive } from '../scrub'
describe('scrubSensitive', () => {
it('redacts Epic OAuth tokens', () => {
const result = scrubSensitive(
'Authorization: Bearer eg1~abcdef123456 and more text'
)
expect(result).not.toContain('abcdef123456')
expect(result).toContain('[redacted]')
})
it('redacts JWT tokens', () => {
const result = scrubSensitive(
'token eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxMjM0NTY3ODkwIn0.signature123'
)
expect(result).not.toContain('eyJhbGciOiJIUzI1NiJ9')
expect(result).toContain('[redacted]')
})
it('redacts GOG credential key/value pairs', () => {
const result = scrubSensitive(
'{"access_token":"gog-access","refresh_token":"gog-refresh","account_id":"42"}'
)
expect(result).not.toContain('gog-access')
expect(result).not.toContain('gog-refresh')
expect(result).toContain('account_id')
expect(result).toContain('[redacted]')
})
it('redacts auth headers, cookies and query tokens', () => {
const result = scrubSensitive(
'Authorization: Basic dXNlcjpwYXNz\nCookie: session=abc; other=1\nhttps://x.test/?token=secret&foo=bar'
)
expect(result).not.toContain('dXNlcjpwYXNz')
expect(result).not.toContain('session=abc')
expect(result).not.toContain('token=secret')
expect(result).toContain('foo=bar')
})
it('redacts env-style secrets', () => {
const result = scrubSensitive(
'EPIC_ACCESS_TOKEN=epic-secret GOGDL_REFRESH_TOKEN=gog-secret NORMAL=value'
)
expect(result).not.toContain('epic-secret')
expect(result).not.toContain('gog-secret')
expect(result).toContain('NORMAL=value')
})
it('keeps normal error text untouched', () => {
const result = scrubSensitive(
'Cannot get game info for Doom + Doom II on gog'
)
expect(result).toBe('Cannot get game info for Doom + Doom II on gog')
})
})