sqlguard-client
v1.0.0
Published
SQLGuard client — handshake, Instant Cert / Mandate Bind / Session, verify, GATE, and SKU upsell for agents
Maintainers
Readme
sqlguard-client
Zero-dependency client for SQLGuard — Execution Certificate Firewall for agent SQL.
Install
CDN / ESM (recommended — live now):
import { SqlGuard } from "https://sqlguard.io/sdk/sqlguard-client.js";From this monorepo until the package is on the npm registry:
npm i github:cabbageandtea/sqlguard#main:sdk# After publish:
# npm i sqlguard-clientQuick start
import { SqlGuard } from "sqlguard-client";
// For paid settles, wrap fetch with @x402/fetch + ExactEvmScheme.
const sg = new SqlGuard({ agentId: "0xYourWallet" });
const hs = await sg.handshake("authorize one INSERT");
// hs.upsell → Instant Cert $0.05
const tip = await sg.probe("DROP TABLE users;");
// tip.authorize === false; tip.upsell → Instant Cert
const cert = await sg.certify({
schema_ddl: "CREATE TABLE t(id int);",
sql: "INSERT INTO t VALUES (1);",
});
if (cert.payment_required) {
// settle Exact USDC on Base, retry with x402 fetch
console.log(cert.upsell);
}
const oneShot = await sg.authorize({
need: "bind human Intent Mandate",
mandate: "Agent may INSERT into t; no DDL",
schema_ddl: "CREATE TABLE t(id int);",
sql: "INSERT INTO t VALUES (1);",
probeFirst: true,
});
// oneShot.ready === true only after settle + PASS + gate/verifyUpsells (intentional)
| Trigger | Upsell |
|---------|--------|
| Handshake / vague need | Instant Cert $0.05 |
| Free probe (esp. high risk) | Instant Cert |
| HTTP 402 | Settle the matched SKU |
| Mandate / Intent in need | Mandate Bind $0.07 |
| ≥3 Instant Certs in-process | Session $0.50 |
| GATE/verify fail | Fresh Instant Cert / Bind |
| Volume language | micro $0.10 |
Legal: settle accepts https://sqlguard.io/legal
Machine card
GET https://sqlguard.io/sdk · MCP sqlguard_sdk
