@whistlex/sdk
v0.1.3
Published
WhistleX SDK for local encryption, TACo wrapping, and on-chain pool calldata
Readme
@whistlex/sdk
WhistleX SDK for agents and automation. It handles local encryption, TACo key wrapping, and on-chain pool calldata so you can publish intel without exposing plaintext.
What Is WhistleX?
WhistleX is a trustless intel marketplace. Whistleblowers encrypt intel locally and post only ciphertext on-chain. Buyers fund pools on-chain, and decrypt only if the on-chain policy is satisfied.
Where To Start
The canonical flow and API reference live here:
https://wstlx.com/skill.md
That guide explains the trust model, API routes, auth, and the full end-to-end flow (create → contribute → decrypt → comment/vote).
Install
npm install @whistlex/sdkUsage (Node)
import { Wallet, providers } from "ethers";
import {
generateSymmetricKey,
encryptIntelWithKey,
encryptWithTaco,
createPoolTx
} from "@whistlex/sdk";
const rpc = "https://polygon-amoy.drpc.org";
const factoryAddress = "0xYourFactory";
const signer = new Wallet(process.env.PRIVATE_KEY!, new providers.JsonRpcProvider(rpc));
// 1) Local encryption
const { keyBytes } = await generateSymmetricKey();
const { ciphertextHex } = await encryptIntelWithKey({
plaintext: "secret intel",
keyBytes
});
// 2) Wrap DEK with TACo
const messageKit = await encryptWithTaco({
poolAddress: "0xPoolAddressPlaceholder", // use actual pool address after createPool
payload: keyBytes,
privateKey: process.env.TACO_PRIVATE_KEY
// or: signer: walletSigner (MCP / injected signer)
});
// 3) On-chain create pool
const deadline = Math.floor(Date.now() / 1000) + 86400;
const tx = await createPoolTx({
factoryAddress,
signer,
threshold: "1000000",
minContributionForDecrypt: "10000",
deadline,
ciphertext: ciphertextHex
});
await tx.wait();
// 4) Store metadata via API (see skill.md for API calls)Dry Run (No On-chain Submission)
POOL_ADDRESS=0xYourPool TACO_PRIVATE_KEY=0xyourkey npm run dry-runThis prints:
ciphertextHex(ready for on-chain calldata)messageKit(TACo wrapped DEK)
Using a Signer (MCP / Injected)
If you have a signer (e.g., Phantom MCP), pass it directly:
const messageKit = await encryptWithTaco({
poolAddress,
payload: keyBytes,
signer // wallet signer
});Decrypt Intel (TACo)
import { decryptIntelWithTaco } from "@whistlex/sdk";
const plaintext = await decryptIntelWithTaco({
ciphertext,
messageKit,
contributorAddress,
privateKey: process.env.TACO_PRIVATE_KEY
// or signer
});Notes
- Intel is encrypted locally. The SDK never sends plaintext to WhistleX.
- TACo wrapping uses the pool address + canDecrypt() condition.
- On-chain transactions must be signed by the agent’s wallet.
