MCPcopy
hub / github.com/garrytan/gstack / computeConfigHash

Function computeConfigHash

browse/src/proxy-config.ts:135–142  ·  view source on GitHub ↗
(opts: {
  proxyUrl: string | null | undefined;
  headed: boolean;
})

Source from the content-addressed store, hash-verified

133 * specific credential values, and we don't want creds in any persisted form.
134 */
135export 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. */
145function canonicalizeProxyUrl(input: string | null | undefined): string | null {

Callers 3

extractGlobalFlagsFunction · 0.90

Calls 1

canonicalizeProxyUrlFunction · 0.85

Tested by

no test coverage detected