@trustwallet/cli 0.6.2 → 0.6.3

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.
Files changed (2) hide show
  1. package/dist/index.js +66 -24
  2. package/package.json +12 -12
package/dist/index.js CHANGED
@@ -124,7 +124,13 @@ function loadKeytar() {
124
124
  return null;
125
125
  }
126
126
  }
127
- var fs, path, os, crypto, crypto2, __require, FileStore, ALGORITHM, KEY_LENGTH, IV_LENGTH, SALT_LENGTH, ITERATIONS, SERVICE, WALLET_ACCOUNT, API_SECRET_ACCOUNT, KeychainManager, CREDENTIALS_FILE, CredentialManager, WALLET_FILE, WalletConfigStore, ALERTS_FILE, AlertStore, SEEN_HASHES_FILE, SeenHashStore;
127
+ function getBackend() {
128
+ const keytar = loadKeytar();
129
+ if (keytar) return keytar;
130
+ if (macSecurity.isAvailable()) return macSecurity;
131
+ return null;
132
+ }
133
+ var fs, path, os, crypto, import_child_process, import_os, crypto2, __require, FileStore, ALGORITHM, KEY_LENGTH, IV_LENGTH, SALT_LENGTH, ITERATIONS, SERVICE, WALLET_ACCOUNT, API_SECRET_ACCOUNT, macSecurity, KeychainManager, CREDENTIALS_FILE, CredentialManager, WALLET_FILE, WalletConfigStore, ALERTS_FILE, AlertStore, SEEN_HASHES_FILE, SeenHashStore;
128
134
  var init_dist = __esm({
129
135
  "../storage/dist/index.mjs"() {
130
136
  "use strict";
@@ -132,6 +138,8 @@ var init_dist = __esm({
132
138
  path = __toESM(require("path"), 1);
133
139
  os = __toESM(require("os"), 1);
134
140
  crypto = __toESM(require("crypto"), 1);
141
+ import_child_process = require("child_process");
142
+ import_os = require("os");
135
143
  crypto2 = __toESM(require("crypto"), 1);
136
144
  __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
137
145
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
@@ -189,50 +197,84 @@ var init_dist = __esm({
189
197
  SERVICE = "twak";
190
198
  WALLET_ACCOUNT = "wallet";
191
199
  API_SECRET_ACCOUNT = "api-secret";
200
+ macSecurity = {
201
+ isAvailable() {
202
+ return (0, import_os.platform)() === "darwin";
203
+ },
204
+ getPassword(service, account) {
205
+ try {
206
+ const output2 = (0, import_child_process.execFileSync)(
207
+ "security",
208
+ ["find-generic-password", "-s", service, "-a", account, "-w"],
209
+ { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] }
210
+ );
211
+ return output2.replace(/\r?\n$/, "");
212
+ } catch {
213
+ return null;
214
+ }
215
+ },
216
+ setPassword(service, account, password) {
217
+ (0, import_child_process.execFileSync)(
218
+ "security",
219
+ ["add-generic-password", "-s", service, "-a", account, "-w", "-U"],
220
+ { input: password, stdio: ["pipe", "pipe", "pipe"] }
221
+ );
222
+ },
223
+ deletePassword(service, account) {
224
+ try {
225
+ (0, import_child_process.execFileSync)(
226
+ "security",
227
+ ["delete-generic-password", "-s", service, "-a", account],
228
+ { stdio: ["pipe", "pipe", "pipe"] }
229
+ );
230
+ } catch {
231
+ }
232
+ }
233
+ };
192
234
  KeychainManager = class {
193
235
  async getWalletPassword() {
194
- const keytar = loadKeytar();
195
- if (!keytar) return null;
236
+ const backend = getBackend();
237
+ if (!backend) return null;
196
238
  try {
197
- return await keytar.getPassword(SERVICE, WALLET_ACCOUNT);
239
+ return await backend.getPassword(SERVICE, WALLET_ACCOUNT);
198
240
  } catch {
199
241
  return null;
200
242
  }
201
243
  }
202
244
  async saveWalletPassword(password) {
203
- const keytar = loadKeytar();
204
- if (!keytar) throw new Error("keytar native module not available on this system");
205
- await keytar.setPassword(SERVICE, WALLET_ACCOUNT, password);
245
+ const backend = getBackend();
246
+ if (!backend) throw new Error("No keychain backend available (keytar not installed and not on macOS)");
247
+ await backend.setPassword(SERVICE, WALLET_ACCOUNT, password);
206
248
  }
207
249
  async deleteWalletPassword() {
208
- const keytar = loadKeytar();
209
- if (!keytar) throw new Error("keytar native module not available on this system");
210
- await keytar.deletePassword(SERVICE, WALLET_ACCOUNT);
250
+ const backend = getBackend();
251
+ if (!backend) throw new Error("No keychain backend available (keytar not installed and not on macOS)");
252
+ await backend.deletePassword(SERVICE, WALLET_ACCOUNT);
211
253
  }
212
254
  async getApiSecret() {
213
- const keytar = loadKeytar();
214
- if (!keytar) return null;
255
+ const backend = getBackend();
256
+ if (!backend) return null;
215
257
  try {
216
- return await keytar.getPassword(SERVICE, API_SECRET_ACCOUNT);
258
+ return await backend.getPassword(SERVICE, API_SECRET_ACCOUNT);
217
259
  } catch {
218
260
  return null;
219
261
  }
220
262
  }
221
263
  async saveApiSecret(secret) {
222
- const keytar = loadKeytar();
223
- if (!keytar) throw new Error("keytar native module not available on this system");
224
- await keytar.setPassword(SERVICE, API_SECRET_ACCOUNT, secret);
264
+ const backend = getBackend();
265
+ if (!backend) throw new Error("No keychain backend available (keytar not installed and not on macOS)");
266
+ await backend.setPassword(SERVICE, API_SECRET_ACCOUNT, secret);
225
267
  }
226
268
  async deleteApiSecret() {
227
- const keytar = loadKeytar();
228
- if (!keytar) return;
269
+ const backend = getBackend();
270
+ if (!backend) return;
229
271
  try {
230
- await keytar.deletePassword(SERVICE, API_SECRET_ACCOUNT);
272
+ await backend.deletePassword(SERVICE, API_SECRET_ACCOUNT);
231
273
  } catch {
232
274
  }
233
275
  }
234
276
  isAvailable() {
235
- return loadKeytar() !== null;
277
+ return getBackend() !== null;
236
278
  }
237
279
  };
238
280
  CREDENTIALS_FILE = "credentials.json";
@@ -27838,7 +27880,7 @@ function registerServeCommand(program2) {
27838
27880
  // src/commands/skill.ts
27839
27881
  var import_fs = require("fs");
27840
27882
  var import_path = require("path");
27841
- var import_os = require("os");
27883
+ var import_os2 = require("os");
27842
27884
  var SKILL_ID = "twak";
27843
27885
  var SKILL_NAME = "TWAK \u2014 Trust Wallet Agent Kit";
27844
27886
  function findSkillMd() {
@@ -27862,10 +27904,10 @@ function registerSkillCommand(program2) {
27862
27904
  process.exitCode = 1;
27863
27905
  return;
27864
27906
  }
27865
- const skillsDir = opts.dir ? (0, import_path.resolve)(opts.dir) : (0, import_path.join)((0, import_os.homedir)(), ".claude", "skills");
27907
+ const skillsDir = opts.dir ? (0, import_path.resolve)(opts.dir) : (0, import_path.join)((0, import_os2.homedir)(), ".claude", "skills");
27866
27908
  if (opts.dir) {
27867
27909
  const { relative, sep: sep2 } = await import("path");
27868
- const safeBase = (0, import_path.join)((0, import_os.homedir)(), ".claude");
27910
+ const safeBase = (0, import_path.join)((0, import_os2.homedir)(), ".claude");
27869
27911
  const rel = relative(safeBase, skillsDir);
27870
27912
  const isOutside = rel.startsWith("..") || rel.startsWith(sep2) || (0, import_path.resolve)(opts.dir) === (0, import_path.resolve)("/");
27871
27913
  if (isOutside) {
@@ -28057,7 +28099,7 @@ var crypto3 = __toESM(require("crypto"));
28057
28099
  // package.json
28058
28100
  var package_default = {
28059
28101
  name: "@trustwallet/cli",
28060
- version: "0.6.2",
28102
+ version: "0.6.3",
28061
28103
  description: "TWAK CLI \u2014 command-line interface for Trust Wallet Agent Kit",
28062
28104
  main: "dist/index.js",
28063
28105
  types: "dist/index.d.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trustwallet/cli",
3
- "version": "0.6.2",
3
+ "version": "0.6.3",
4
4
  "description": "TWAK CLI — command-line interface for Trust Wallet Agent Kit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -27,17 +27,17 @@
27
27
  "devDependencies": {
28
28
  "tsup": "8.5.1",
29
29
  "typescript": "5.7.3",
30
- "@twak/actions": "0.6.2",
31
- "@twak/blockchain": "0.6.2",
32
- "@twak/core": "0.6.2",
33
- "@twak/mcp": "0.6.2",
34
- "@twak/storage": "0.6.2",
35
- "@twak/swap": "0.6.2",
36
- "@twak/wallet": "0.6.2",
37
- "@twak/wallet-core": "0.6.2",
38
- "@twak/walletconnect": "0.6.2",
39
- "@twak/transactions": "0.6.2",
40
- "@twak/security": "0.6.2"
30
+ "@twak/actions": "0.6.3",
31
+ "@twak/blockchain": "0.6.3",
32
+ "@twak/core": "0.6.3",
33
+ "@twak/mcp": "0.6.3",
34
+ "@twak/security": "0.6.3",
35
+ "@twak/storage": "0.6.3",
36
+ "@twak/swap": "0.6.3",
37
+ "@twak/wallet": "0.6.3",
38
+ "@twak/wallet-core": "0.6.3",
39
+ "@twak/walletconnect": "0.6.3",
40
+ "@twak/transactions": "0.6.3"
41
41
  },
42
42
  "publishConfig": {
43
43
  "access": "public"