(opts: {
proxyUrl: string | null | undefined;
headed: boolean;
})
| 133 | * specific credential values, and we don't want creds in any persisted form. |
| 134 | */ |
| 135 | export function computeConfigHash(opts: { |
| 136 | proxyUrl: string | null | undefined; |
| 137 | headed: boolean; |
| 138 | }): string { |
| 139 | const proxyKey = canonicalizeProxyUrl(opts.proxyUrl); |
| 140 | const input = JSON.stringify({ proxy: proxyKey, headed: opts.headed }); |
| 141 | return createHash('sha256').update(input).digest('hex').slice(0, 16); |
| 142 | } |
| 143 | |
| 144 | /** Strip creds from a proxy URL for hashing. Returns null for empty input. */ |
| 145 | function canonicalizeProxyUrl(input: string | null | undefined): string | null { |
no test coverage detected