({
request,
rawBody,
requestId,
providerConfig,
}: AuthContext)
| 70 | |
| 71 | export 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 |
nothing calls this directly
no test coverage detected