@whistlex/sdk 0.1.0 → 0.1.1

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
@@ -36,6 +36,7 @@ const messageKit = await encryptWithTaco({
36
36
  poolAddress: "0xPoolAddressPlaceholder", // use actual pool address after createPool
37
37
  payload: keyBytes,
38
38
  privateKey: process.env.TACO_PRIVATE_KEY
39
+ // or: signer: walletSigner (MCP / injected signer)
39
40
  });
40
41
 
41
42
  // 3) On-chain create pool
@@ -53,6 +54,28 @@ await tx.wait();
53
54
  // 4) Store metadata via API (see /skill.md for API calls)
54
55
  ```
55
56
 
57
+ ## Dry Run (No On-chain Submission)
58
+
59
+ ```bash
60
+ POOL_ADDRESS=0xYourPool TACO_PRIVATE_KEY=0xyourkey npm run dry-run
61
+ ```
62
+
63
+ This will print:
64
+ - `ciphertextHex` (ready for on-chain calldata)
65
+ - `messageKit` (TACo wrapped DEK)
66
+
67
+ ### Using a Signer (MCP / Injected)
68
+
69
+ If you have a signer (e.g., Phantom MCP), pass it directly:
70
+
71
+ ```ts
72
+ const messageKit = await encryptWithTaco({
73
+ poolAddress,
74
+ payload: keyBytes,
75
+ signer // wallet signer
76
+ });
77
+ ```
78
+
56
79
  ## Notes
57
80
 
58
81
  - **Intel is encrypted locally**. The SDK never sends plaintext to WhistleX.
package/dist/taco.d.ts CHANGED
@@ -1,8 +1,10 @@
1
+ import { providers, Wallet } from "ethers";
1
2
  export declare const DEFAULT_POLYGON_AMOY_RPC_URL = "https://polygon-amoy.drpc.org";
2
3
  export declare const DEFAULT_TACO_RITUAL_ID = 6;
3
4
  export declare const DEFAULT_CONDITION_CHAIN_ID = 80002;
4
5
  export interface TacoConfig {
5
6
  privateKey?: string;
7
+ signer?: providers.JsonRpcSigner | Wallet;
6
8
  dkgRpcUrl?: string;
7
9
  conditionRpcUrl?: string;
8
10
  conditionChainId?: number;
package/dist/taco.js CHANGED
@@ -6,15 +6,18 @@ export const DEFAULT_CONDITION_CHAIN_ID = 80002;
6
6
  function resolveTacoConfig(config) {
7
7
  return {
8
8
  key: config.privateKey,
9
+ signer: config.signer,
9
10
  dkg: config.dkgRpcUrl || process.env.TACO_DKG_RPC_URL || DEFAULT_POLYGON_AMOY_RPC_URL,
10
11
  condition: config.conditionRpcUrl || process.env.TACO_CONDITION_RPC_URL || DEFAULT_POLYGON_AMOY_RPC_URL,
11
12
  conditionChain: config.conditionChainId || DEFAULT_CONDITION_CHAIN_ID,
12
13
  ritual: config.ritualId || DEFAULT_TACO_RITUAL_ID
13
14
  };
14
15
  }
15
- async function resolveConditionSigner(provider, key) {
16
+ async function resolveConditionSigner(provider, key, signer) {
17
+ if (signer)
18
+ return signer;
16
19
  if (!key) {
17
- throw new Error("TACo private key is required in Node SDK (no injected wallet). ");
20
+ throw new Error("TACo signer is required. Provide privateKey or signer.");
18
21
  }
19
22
  return new Wallet(key, provider);
20
23
  }
@@ -65,11 +68,11 @@ export async function encryptWithTaco(params) {
65
68
  if (!ContractCondition) {
66
69
  throw new Error("encryptWithTaco: ContractCondition not available");
67
70
  }
68
- const { key, dkg, condition, conditionChain, ritual } = resolveTacoConfig(params);
71
+ const { key, signer, dkg, condition, conditionChain, ritual } = resolveTacoConfig(params);
69
72
  await initialize();
70
73
  const dkgProvider = new providers.JsonRpcProvider(dkg);
71
74
  const conditionProvider = new providers.JsonRpcProvider(condition);
72
- const encryptorSigner = await resolveConditionSigner(conditionProvider, key);
75
+ const encryptorSigner = await resolveConditionSigner(conditionProvider, key, signer);
73
76
  const conditionInstance = new ContractCondition({
74
77
  method: "canDecrypt",
75
78
  parameters: [":contributor"],
@@ -101,10 +104,10 @@ export async function decryptWithTaco(params) {
101
104
  const ConditionContext = conditions?.context?.ConditionContext;
102
105
  if (!ConditionContext)
103
106
  throw new Error("decryptWithTaco: ConditionContext missing");
104
- const { key, condition, conditionChain, ritual, dkg } = resolveTacoConfig(params);
107
+ const { key, signer, condition, conditionChain, ritual, dkg } = resolveTacoConfig(params);
105
108
  await initialize();
106
109
  const conditionProvider = new providers.JsonRpcProvider(condition);
107
- const decryptorSigner = await resolveConditionSigner(conditionProvider, key);
110
+ const decryptorSigner = await resolveConditionSigner(conditionProvider, key, signer);
108
111
  const decryptorAddress = await decryptorSigner.getAddress();
109
112
  const kitBytes = Buffer.from(messageKit.replace(/^0x/, ""), "hex");
110
113
  const kit = ThresholdMessageKit.fromBytes(Uint8Array.from(kitBytes));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whistlex/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "WhistleX SDK for local encryption, TACo wrapping, and on-chain pool calldata",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -11,10 +11,13 @@
11
11
  "types": "./dist/index.d.ts"
12
12
  }
13
13
  },
14
- "files": ["dist"],
14
+ "files": [
15
+ "dist"
16
+ ],
15
17
  "scripts": {
16
18
  "build": "tsc -p tsconfig.json",
17
- "clean": "rm -rf dist"
19
+ "clean": "rm -rf dist",
20
+ "dry-run": "node ./scripts/dry-run.mjs"
18
21
  },
19
22
  "dependencies": {
20
23
  "@nucypher/taco": "0.6.0",