MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / stateMatches

Function stateMatches

packages/cli/src/auth/loopback.ts:171–176  ·  view source on GitHub ↗

* Constant-time comparison for the OAuth `state` parameter. Real * exploitability is very low (loopback, 256-bit entropy, narrow flow * window), but the rest of the auth path uses crypto-grade primitives * and a `!==` here would be a gratuitous deviation in security review.

(actual: string, expected: string)

Source from the content-addressed store, hash-verified

169 * and a `!==` here would be a gratuitous deviation in security review.
170 */
171function stateMatches(actual: string, expected: string): boolean {
172 const a = Buffer.from(actual, "utf8");
173 const b = Buffer.from(expected, "utf8");
174 if (a.length !== b.length) return false;
175 return timingSafeEqual(a, b);
176}
177
178function respond(res: ServerResponse, status: number, body: string): void {
179 res

Callers 1

handleRequestFunction · 0.85

Calls 1

fromMethod · 0.80

Tested by

no test coverage detected