@crawlcheck/sdk 1.0.1 → 1.0.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/README.md CHANGED
@@ -6,6 +6,18 @@ A typed client for the CrawlCheck API and the offline verifier for its evidence,
6
6
  npm i @crawlcheck/sdk
7
7
  ```
8
8
 
9
+ ## Check before acting
10
+
11
+ ```js
12
+ import { CrawlCheck } from "@crawlcheck/sdk";
13
+ const cc = new CrawlCheck();
14
+ const { proceed, receipt } = await cc.guard("example.com", "read", { agent: "MyAgentBot" });
15
+ // proceed is true on allow; warn proceeds only with { allowWarn: true }; require_confirmation only if confirm(receipt) resolves true.
16
+ // The receipt is a signed crawlcheck-decision; guard() verified it here and checked its key against the published directory.
17
+ ```
18
+
19
+ `preflight(domain, action, { agent, template, policy })` returns the signed receipt without deciding for you; `verifyDocument(doc)` verifies any signed resolve answer or decision receipt offline. `resolve(domain)` returns the full signed ResolveV1 answer.
20
+
9
21
  ## Read a record
10
22
 
11
23
  ```js