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

Function validateZoomSignature

apps/sim/lib/webhooks/providers/zoom.ts:26–52  ·  view source on GitHub ↗
(
  secretToken: string,
  signature: string,
  timestamp: string,
  body: string
)

Source from the content-addressed store, hash-verified

24 */
25/** Exported for tests — Zoom signs `v0:{timestamp}:{rawBody}`. */
26export function validateZoomSignature(
27 secretToken: string,
28 signature: string,
29 timestamp: string,
30 body: string
31): boolean {
32 try {
33 if (!secretToken || !signature || !timestamp || !body) {
34 return false
35 }
36
37 const nowSeconds = Math.floor(Date.now() / 1000)
38 const requestSeconds = Number.parseInt(timestamp, 10)
39 if (Number.isNaN(requestSeconds) || Math.abs(nowSeconds - requestSeconds) > 300) {
40 return false
41 }
42
43 const message = `v0:${timestamp}:${body}`
44 const computedHash = hmacSha256Hex(message, secretToken)
45 const expectedSignature = `v0=${computedHash}`
46
47 return safeCompare(expectedSignature, signature)
48 } catch (err) {
49 logger.error('Zoom signature validation error', err)
50 return false
51 }
52}
53
54async function resolveZoomChallengeSecrets(
55 path: string,

Callers 3

zoom.test.tsFile · 0.90
verifyAuthFunction · 0.85
handleChallengeFunction · 0.85

Calls 3

hmacSha256HexFunction · 0.90
safeCompareFunction · 0.90
errorMethod · 0.80

Tested by

no test coverage detected