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

Function verifyAuth

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

Source from the content-addressed store, hash-verified

70
71export const linqHandler: WebhookProviderHandler = {
72 async verifyAuth({
73 request,
74 rawBody,
75 requestId,
76 providerConfig,
77 }: AuthContext): Promise<NextResponse | null> {
78 const signingSecret = providerConfig.signingSecret as string | undefined
79 if (!signingSecret?.trim()) {
80 logger.warn(`[${requestId}] Linq webhook missing signing secret in provider configuration`)
81 return new NextResponse('Unauthorized - Linq signing secret is required', { status: 401 })
82 }
83
84 const webhookId = request.headers.get('webhook-id')
85 const webhookTimestamp = request.headers.get('webhook-timestamp')
86 const webhookSignature = request.headers.get('webhook-signature')
87
88 if (!webhookId || !webhookTimestamp || !webhookSignature) {
89 logger.warn(`[${requestId}] Linq webhook missing Standard Webhooks signature headers`)
90 return new NextResponse('Unauthorized - Missing Linq signature headers', { status: 401 })
91 }
92
93 if (
94 !verifyLinqSignature(signingSecret, webhookId, webhookTimestamp, webhookSignature, rawBody)
95 ) {
96 logger.warn(`[${requestId}] Linq webhook signature verification failed`)
97 return new NextResponse('Unauthorized - Invalid Linq signature', { status: 401 })
98 }
99
100 return null
101 },
102
103 matchEvent({ body, providerConfig, requestId }: EventMatchContext): boolean {
104 const triggerId = providerConfig.triggerId as string | undefined

Callers

nothing calls this directly

Calls 3

verifyLinqSignatureFunction · 0.85
warnMethod · 0.65
getMethod · 0.65

Tested by

no test coverage detected