
Research
/Security News
737 Chrome VPN Extensions Linked to Brand Impersonation and Browser Traffic Redirection
The campaign amassed more than 75,000 installs by targeting Russian-speaking users seeking access to blocked services.
@smartpolicy/sdk
Advanced tools
TypeScript SDK for SmartPolicy — check on-chain authorization policies, issue EIP-712 grants, and build policy transactions for AI agents and backends
TypeScript SDK for SmartPolicy — runtime authorization for AI agents and smart contracts. Check on-chain policies, issue EIP-712 grants, and build policy transactions, in a few calls. Wraps viem; never holds your keys.
npm install @smartpolicy/sdk
Everything reduces to: may this subject do this action under this policy?
import { SmartPolicy } from "@smartpolicy/sdk";
const sp = SmartPolicy.baseSepolia(); // zero-config against the testnet
const ok = await sp.isAllowed(1n, "0xAgent…", "withdraw"); // → boolean
const why = await sp.check(1n, "0xAgent…", "withdraw");
// { allowed, exists, active, rule: "MEMBERS", isMember, reasons: [...] }
A protected contract answers the identical question on-chain via PolicyGate,
so your backend and your contract never disagree.
1. Deploy your gated contract. Inherit PolicyGate and gate the sensitive
functions (see contracts/src/examples/AgentGuardedTreasury.sol). For money
movement, use the two-factor onlyAllowedWithGrant and bind the parameters:
function sweep(address payable to, IGrantVerifier.Grant calldata g, bytes calldata sig)
external
onlyAllowedWithGrant(policyId, ACTION_SWEEP, keccak256(abi.encode(to)), g, sig)
{ /* … */ }
2. Create a policy and add your agent — build the txs, sign with your wallet:
const create = await sp.buildCreatePolicy({ openMembership: false }); // {to,value,data}
// … submit `create` from the wallet that should OWN the policy; read the
// new policyId from the PolicyCreated event …
const add = await sp.buildAddMembers(policyId, ["0xAgent…"]); // {to,value,data}
3. Run your own issuer (the "your issuers, not ours" model). Authorize its
address on the policy (buildAddIssuer), then mint short-lived grants after
whatever off-chain checks you want — budgets, KYC, rate limits:
import { GrantIssuer, bindContext } from "@smartpolicy/sdk";
const issuer = new GrantIssuer(sp, process.env.ISSUER_KEY); // your key, your rules
console.log("authorize this issuer on the policy:", issuer.address);
const { grant, signature, tuple } = await issuer.issue({
policyId,
subject: "0xAgent…",
action: "sweep",
target: treasuryAddress, // only this contract may redeem it
ttlSeconds: 600, // short-lived
context: bindContext(["address"], [coldWallet]), // ← binds the destination
});
await sp.verifyGrant(grant, signature); // pre-flight before broadcasting
// pass (grant, signature) to treasury.sweep(coldWallet, grant, signature)
Because the grant's context is the signed keccak256(abi.encode(coldWallet)),
a compromised agent cannot redirect the sweep — any other to reverts. The
issuer approved "sweep to the cold wallet," not "sweep."
buildRemoveMembers or buildSetActionRule(…, "NOBODY")
— stops the on-chain path immediately, and (with onlyAllowedWithGrant) grants too.buildRemoveIssuer — the kill-switch for the grant path; outstanding
grants stop verifying the next block.SmartPolicy.baseSepolia() / new SmartPolicy({ rpcUrl, chainId, registry, verifier })isAllowed · check · getPolicy · isMember · isAdmin · isOwner
· isAuthorizedIssuer · fees · assertChainIdGrantIssuer#issue · verifyGrant · bindContext · actionId{to,value,data} for the caller's wallet): buildCreatePolicy
· buildAddMembers · buildRemoveMembers · buildSetActionRule · buildAddIssuer
· buildRemoveIssuer · buildAddAdmin · buildSetExpiryBASE_SEPOLIA · DEPLOYMENTS · registryAbi · verifierAbiAUDIT.md). Point at your own deployment with
the SmartPolicy constructor.context). This SDK and the on-chain
GrantVerifier must match — they do, out of the box.FAQs
TypeScript SDK for SmartPolicy — check on-chain authorization policies, issue EIP-712 grants, and build policy transactions for AI agents and backends
The npm package @smartpolicy/sdk receives a total of 6 weekly downloads. As such, @smartpolicy/sdk popularity was classified as not popular.
We found that @smartpolicy/sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
The campaign amassed more than 75,000 installs by targeting Russian-speaking users seeking access to blocked services.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.