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

Function verifyAuth

apps/sim/lib/webhooks/providers/loops.ts:61–88  ·  view source on GitHub ↗
({
    request,
    rawBody,
    requestId,
    providerConfig,
  }: AuthContext)

Source from the content-addressed store, hash-verified

59
60export const loopsHandler: WebhookProviderHandler = {
61 async verifyAuth({
62 request,
63 rawBody,
64 requestId,
65 providerConfig,
66 }: AuthContext): Promise<NextResponse | null> {
67 const signingSecret = providerConfig.signingSecret as string | undefined
68 if (!signingSecret?.trim()) {
69 logger.warn(`[${requestId}] Loops webhook missing signing secret in provider configuration`)
70 return new NextResponse('Unauthorized - Loops signing secret is required', { status: 401 })
71 }
72
73 const webhookId = request.headers.get('webhook-id')
74 const timestamp = request.headers.get('webhook-timestamp')
75 const signature = request.headers.get('webhook-signature')
76
77 if (!webhookId || !timestamp || !signature) {
78 logger.warn(`[${requestId}] Loops webhook missing signature headers`)
79 return new NextResponse('Unauthorized - Missing Loops signature headers', { status: 401 })
80 }
81
82 if (!verifyLoopsSignature(signingSecret, webhookId, timestamp, signature, rawBody)) {
83 logger.warn(`[${requestId}] Loops signature verification failed`)
84 return new NextResponse('Unauthorized - Invalid Loops signature', { status: 401 })
85 }
86
87 return null
88 },
89
90 async matchEvent({ body, requestId, providerConfig }: EventMatchContext): Promise<boolean> {
91 const triggerId = providerConfig.triggerId as string | undefined

Callers

nothing calls this directly

Calls 3

verifyLoopsSignatureFunction · 0.85
warnMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected