MCPcopy Index your code
hub / github.com/simstudioai/sim / safeCompare

Function safeCompare

packages/security/src/compare.ts:8–13  ·  view source on GitHub ↗
(a: string, b: string)

Source from the content-addressed store, hash-verified

6 * secrets where leaking length or content via timing must be avoided.
7 */
8export function safeCompare(a: string, b: string): boolean {
9 const key = 'safeCompare'
10 const ha = createHmac('sha256', key).update(a).digest()
11 const hb = createHmac('sha256', key).update(b).digest()
12 return timingSafeEqual(ha, hb)
13}

Callers 15

compare.test.tsFile · 0.90
verifyCronAuthFunction · 0.90
validateAuthTokenFunction · 0.90
validateDeploymentAuthFunction · 0.90
checkInternalApiKeyFunction · 0.90
verifyUploadTokenFunction · 0.90
validateNotionSignatureFunction · 0.90
verifyLinqSignatureFunction · 0.90
verifyAuthFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected