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

Function validateTypeformSignature

apps/sim/lib/webhooks/providers/typeform.ts:17–32  ·  view source on GitHub ↗
(secret: string, signature: string, body: string)

Source from the content-addressed store, hash-verified

15const logger = createLogger('WebhookProvider:Typeform')
16
17function validateTypeformSignature(secret: string, signature: string, body: string): boolean {
18 try {
19 if (!secret || !signature || !body) {
20 return false
21 }
22 if (!signature.startsWith('sha256=')) {
23 return false
24 }
25 const providedSignature = signature.substring(7)
26 const computedHash = hmacSha256Base64(body, secret)
27 return safeCompare(computedHash, providedSignature)
28 } catch (error) {
29 logger.error('Error validating Typeform signature:', error)
30 return false
31 }
32}
33
34export const typeformHandler: WebhookProviderHandler = {
35 async formatInput({ body, webhook }: FormatInputContext): Promise<FormatInputResult> {

Callers

nothing calls this directly

Calls 3

hmacSha256Base64Function · 0.90
safeCompareFunction · 0.90
errorMethod · 0.80

Tested by

no test coverage detected