@trustwallet/cli 0.6.1 → 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.
- package/dist/index.js +68 -25
- package/package.json +14 -13
package/dist/index.js
CHANGED
|
@@ -124,7 +124,13 @@ function loadKeytar() {
|
|
|
124
124
|
return null;
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
|
|
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
|
|
195
|
-
if (!
|
|
236
|
+
const backend = getBackend();
|
|
237
|
+
if (!backend) return null;
|
|
196
238
|
try {
|
|
197
|
-
return await
|
|
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
|
|
204
|
-
if (!
|
|
205
|
-
await
|
|
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
|
|
209
|
-
if (!
|
|
210
|
-
await
|
|
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
|
|
214
|
-
if (!
|
|
255
|
+
const backend = getBackend();
|
|
256
|
+
if (!backend) return null;
|
|
215
257
|
try {
|
|
216
|
-
return await
|
|
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
|
|
223
|
-
if (!
|
|
224
|
-
await
|
|
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
|
|
228
|
-
if (!
|
|
269
|
+
const backend = getBackend();
|
|
270
|
+
if (!backend) return;
|
|
229
271
|
try {
|
|
230
|
-
await
|
|
272
|
+
await backend.deletePassword(SERVICE, API_SECRET_ACCOUNT);
|
|
231
273
|
} catch {
|
|
232
274
|
}
|
|
233
275
|
}
|
|
234
276
|
isAvailable() {
|
|
235
|
-
return
|
|
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
|
|
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,
|
|
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,
|
|
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.
|
|
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",
|
|
@@ -28085,7 +28127,8 @@ var package_default = {
|
|
|
28085
28127
|
"qrcode-terminal": "0.12.0"
|
|
28086
28128
|
},
|
|
28087
28129
|
optionalDependencies: {
|
|
28088
|
-
"@amplitude/analytics-node": "1.5.39"
|
|
28130
|
+
"@amplitude/analytics-node": "1.5.39",
|
|
28131
|
+
keytar: "7.9.0"
|
|
28089
28132
|
},
|
|
28090
28133
|
devDependencies: {
|
|
28091
28134
|
"@twak/actions": "workspace:*",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trustwallet/cli",
|
|
3
|
-
"version": "0.6.
|
|
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",
|
|
@@ -21,22 +21,23 @@
|
|
|
21
21
|
"qrcode-terminal": "0.12.0"
|
|
22
22
|
},
|
|
23
23
|
"optionalDependencies": {
|
|
24
|
-
"@amplitude/analytics-node": "1.5.39"
|
|
24
|
+
"@amplitude/analytics-node": "1.5.39",
|
|
25
|
+
"keytar": "7.9.0"
|
|
25
26
|
},
|
|
26
27
|
"devDependencies": {
|
|
27
28
|
"tsup": "8.5.1",
|
|
28
29
|
"typescript": "5.7.3",
|
|
29
|
-
"@twak/
|
|
30
|
-
"@twak/
|
|
31
|
-
"@twak/
|
|
32
|
-
"@twak/
|
|
33
|
-
"@twak/
|
|
34
|
-
"@twak/
|
|
35
|
-
"@twak/swap": "0.6.
|
|
36
|
-
"@twak/
|
|
37
|
-
"@twak/wallet": "0.6.
|
|
38
|
-
"@twak/
|
|
39
|
-
"@twak/
|
|
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"
|
|
40
41
|
},
|
|
41
42
|
"publishConfig": {
|
|
42
43
|
"access": "public"
|