UNPKG

@botwall/sdk

Version:

BotWall SDK for site protection and bot crawling

25 lines 982 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.sendCrawlRequest = sendCrawlRequest; const signRequest_1 = require("../crypto/signRequest"); /** * Sends a crawl request, auto-signing the headers using Ed25519. * @param url - The URL to fetch * @param headers - Headers object (must include signature-input and required headers) * @param privateKey - Ed25519 private key (base64-encoded) * @param options - Optional fetch options (method, body, etc.) * @returns The fetch Response object */ async function sendCrawlRequest(url, headers, privateKey, options = {}) { // Sign the request const signature = (0, signRequest_1.signRequest)(headers, privateKey); const signedHeaders = { ...headers, signature }; // Prepare fetch options const fetchOptions = { ...options, headers: signedHeaders, }; // Send the request return fetch(url, fetchOptions); } //# sourceMappingURL=sendCrawlRequest.js.map