@mxraven/mail - v0.6.0
    Preparing search index...

    Class Verifier

    Verifies the signature of an mxRaven webhook request.

    A verifier is safe for concurrent use once constructed. Configure it with a signing secret or with per-key secrets for rotation. For typed dispatch and HTTP status handling, use WebhookHandler, which composes a verifier.

    const secret = process.env.MXRAVEN_WEBHOOK_SECRET;
    if (secret === undefined || secret === "") {
    throw new Error("MXRAVEN_WEBHOOK_SECRET is required");
    }

    const verifier = new Verifier({ secret });
    const event = await verifier.verifyAndDecode(request);
    Index
    • Verifies a request's signature.

      The body is read from a clone, so the caller can still read the original request body afterwards.

      Parameters

      • request: Request

        The incoming request.

      • options: VerifyOptions = {}

        An optional cancellation signal.

      Returns Promise<void>

      InvalidSignatureError When the signature does not match.

      WebhookRequestError When required headers are missing, the timestamp is stale, or the signing key is unknown.

      PayloadTooLargeError When the body exceeds the configured limit.