@crawlcheck/sdk 1.5.0 → 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +15 -8
- package/package.json +8 -4
package/dist/index.d.ts
CHANGED
|
@@ -635,7 +635,7 @@ export declare class CrawlCheck {
|
|
|
635
635
|
* domain it names. In a browser a cross-origin redirect hides its target, so it is refused rather than followed blind.
|
|
636
636
|
*/
|
|
637
637
|
guardedFetch(url: string, opts?: GuardedFetchOptions): Promise<GuardedFetchResult>;
|
|
638
|
-
/** Look a domain up without sending it: only the first prefixLen hex characters of sha256(domain) leave this process. found false with ready true means no public measurement. */
|
|
638
|
+
/** Look a domain up without sending it: only the first prefixLen hex characters of sha256(domain) leave this process (one more character per 413, up to 8). found false with ready true means no public measurement. */
|
|
639
639
|
/** Make a signed lockfile for an MCP server (CrawlCheck reads tools/list; no tool is called). Save it; check with checkLock before every connect. */
|
|
640
640
|
mcpLock(url: string): Promise<McpLock & JsonObject>;
|
|
641
641
|
/** Read the server's tools now (through CrawlCheck) and compare with a lockfile; the answer is signed. For a fully offline check, list the tools yourself and call checkLock. */
|
package/dist/index.js
CHANGED
|
@@ -421,7 +421,7 @@ export class CrawlCheck {
|
|
|
421
421
|
}
|
|
422
422
|
return { proceed: false, response: null, url: cur, hops, why: ["more than " + max + " redirects"] };
|
|
423
423
|
}
|
|
424
|
-
/** Look a domain up without sending it: only the first prefixLen hex characters of sha256(domain) leave this process. found false with ready true means no public measurement. */
|
|
424
|
+
/** Look a domain up without sending it: only the first prefixLen hex characters of sha256(domain) leave this process (one more character per 413, up to 8). found false with ready true means no public measurement. */
|
|
425
425
|
/** Make a signed lockfile for an MCP server (CrawlCheck reads tools/list; no tool is called). Save it; check with checkLock before every connect. */
|
|
426
426
|
async mcpLock(url) { return this.req("GET", "/api/v1/mcp/lock", { url }); }
|
|
427
427
|
/** Read the server's tools now (through CrawlCheck) and compare with a lockfile; the answer is signed. For a fully offline check, list the tools yourself and call checkLock. */
|
|
@@ -436,13 +436,20 @@ export class CrawlCheck {
|
|
|
436
436
|
throw new Error("prefixLen must be 2 to 8");
|
|
437
437
|
const h = await sha256Hex(d);
|
|
438
438
|
let r;
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
439
|
+
// pfx3: a 413 means more than 100 measured domains share the prefix (the corpus grows); send one more hex character and
|
|
440
|
+
// try again, up to 8. Each extra character halves the bucket twice and still never names the domain.
|
|
441
|
+
for (let n = prefixLen;; n++) {
|
|
442
|
+
try {
|
|
443
|
+
r = await this.req("GET", "/api/v1/resolve-prefix/" + h.slice(0, n));
|
|
444
|
+
break;
|
|
445
|
+
}
|
|
446
|
+
catch (e) {
|
|
447
|
+
if (e instanceof CrawlCheckError && e.status === 503)
|
|
448
|
+
return { found: false, ready: false, in_bucket: null, answer: null, verification: null, accepted: false, why: "the prefix index is not built yet" };
|
|
449
|
+
if (e instanceof CrawlCheckError && e.status === 413 && n < 8)
|
|
450
|
+
continue;
|
|
451
|
+
throw e;
|
|
452
|
+
}
|
|
446
453
|
}
|
|
447
454
|
const hit = (r.answers || []).find((a) => a.domain_sha256 === h);
|
|
448
455
|
if (!hit)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crawlcheck/sdk",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "Typed client for the CrawlCheck API (generated from its OpenAPI document) and the zero-dependency offline verifier for evidence bundles and remediation receipts.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
"homepage": "https://crawlcheck.io/sdk",
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|
|
27
|
-
"url": "git+https://github.com/emmanuelorta/crawlcheck.git",
|
|
27
|
+
"url": "git+https://github.com/emmanuelorta/crawlcheck-core.git",
|
|
28
28
|
"directory": "sdk"
|
|
29
29
|
},
|
|
30
30
|
"bugs": {
|
|
31
|
-
"url": "https://github.com/emmanuelorta/crawlcheck/issues"
|
|
31
|
+
"url": "https://github.com/emmanuelorta/crawlcheck-core/issues"
|
|
32
32
|
},
|
|
33
33
|
"keywords": [
|
|
34
34
|
"crawlcheck",
|
|
@@ -43,5 +43,9 @@
|
|
|
43
43
|
"scripts": {
|
|
44
44
|
"test": "node --test test/*.test.js"
|
|
45
45
|
},
|
|
46
|
-
"license": "MIT"
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"funding": {
|
|
48
|
+
"type": "github",
|
|
49
|
+
"url": "https://github.com/sponsors/emmanuelorta"
|
|
50
|
+
}
|
|
47
51
|
}
|