Skip to content

Commit 5e9152b

Browse files
committed
fix audio report issue
1 parent bafd81b commit 5e9152b

12 files changed

Lines changed: 79 additions & 24 deletions

File tree

docs/Agent-Wallet/Developer/CLI-Reference.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ agent-wallet start -p Abc12345!
2626
```
2727
Password requirements: at least 8 characters, including uppercase, lowercase, numbers, and special characters.
2828

29+
:::caution Shell history risk
30+
Passing `-p` inline records the password in your terminal's history file. For production wallets, prefer interactive mode (`agent-wallet start` without `-p`) or set `AGENT_WALLET_PASSWORD` as an environment variable — see [Non-Interactive Execution](#non-interactive-execution-for-automation--background-services).
31+
:::
32+
2933
**Import an existing private key:**
3034
```bash
3135
agent-wallet start -p Abc12345! -k your-private-key-hex
@@ -155,16 +159,18 @@ jobs:
155159
156160
</details>
157161
158-
### Method B: Local Password Cache (True "Set and Forget")
162+
### Method B: Local Password Cache (Convenience vs. Security Trade-off)
159163
160-
The ultimate convenience solution. After running a command once with the `--save-runtime-secrets` flag, the password is permanently cached in a local file (`~/.agent-wallet/runtime_secrets.json`). The next time you run any signing command, the system automatically reads from the cache. No need for inline passwords or environment variables:
164+
After running a command once with the `--save-runtime-secrets` flag, the password is permanently cached in a local file (`~/.agent-wallet/runtime_secrets.json`). The next time you run any signing command, the system automatically reads from the cache. No need for inline passwords or environment variables:
161165

162166
```bash
163167
agent-wallet sign msg "Hello" -n tron -p "Abc12345!" --save-runtime-secrets
164168
```
165169

166-
:::danger Security Warning
167-
`runtime_secrets.json` stores your master password in **plaintext**. Any program with access to your file system (malicious plugins, AI agents, automation scripts) can read it directly. Only use this feature if you fully trust the runtime environment, and make sure this file is never committed to git or synced to the cloud.
170+
:::danger This disables the dual-lock protection
171+
Caching the password next to the wallet file means a single file system compromise grants full access to your funds — defeating Agent-wallet's core "physical file + password separation" security model. **Only use this for throwaway test wallets.**
172+
173+
`runtime_secrets.json` stores your master password in **plaintext**. Any program with access to your file system (malicious plugins, AI agents, automation scripts) can read it directly. Make sure this file is never committed to git or synced to the cloud.
168174

169175
The tool automatically sets restrictive file permissions (`600` — owner-read-only) on creation. If you've manually moved or copied the file, verify the permissions: `chmod 600 ~/.agent-wallet/runtime_secrets.json`.
170176
:::

docs/Agent-Wallet/Developer/SDK-Cookbook.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ Before running any example below, make sure you have:
2121

2222
1. Installed the Agent-wallet SDK (see [SDK Guide](./SDK-Guide.md))
2323
2. Initialized a local wallet via the CLI, or configured static mode environment variables
24-
3. Set `AGENT_WALLET_PASSWORD` (local `local_secure` mode) or `AGENT_WALLET_PRIVATE_KEY` (static mode)
24+
3. Set `AGENT_WALLET_PASSWORD` (local `local_secure` mode — strongly recommended)
25+
26+
:::danger Avoid static mode (`AGENT_WALLET_PRIVATE_KEY`) for real funds
27+
Static mode stores your private key as plaintext in an environment variable — the exact exposure Agent-wallet's `local_secure` mode is designed to prevent. Only use `AGENT_WALLET_PRIVATE_KEY` in fully isolated, offline test environments with throwaway keys. For mainnet operations, always use `AGENT_WALLET_PASSWORD` with your local encrypted safe.
28+
:::
2529

2630
---
2731

@@ -112,7 +116,15 @@ async function transferTRX(
112116
console.log("Unsigned txID:", unsignedTx.txID);
113117

114118
// Step 3: Sign locally with Agent-wallet
115-
const signedTx = JSON.parse(await wallet.signTransaction(unsignedTx));
119+
let signedTx: Record<string, unknown>;
120+
try {
121+
signedTx = JSON.parse(await wallet.signTransaction(unsignedTx));
122+
} catch (e) {
123+
throw new Error(`signTransaction returned invalid JSON: ${e}`);
124+
}
125+
if (!signedTx.signature) {
126+
throw new Error("Signed transaction is missing the signature field");
127+
}
116128
console.log("Signed, signature:", signedTx.signature);
117129

118130
// Step 4: Broadcast via TronGrid
@@ -177,7 +189,13 @@ async def transfer_trx(
177189
print("Unsigned txID:", unsigned_tx["txID"])
178190

179191
# Step 3: Sign locally with Agent-wallet
180-
signed_tx = json.loads(await wallet.sign_transaction(unsigned_tx))
192+
raw_signed = await wallet.sign_transaction(unsigned_tx)
193+
try:
194+
signed_tx = json.loads(raw_signed)
195+
except json.JSONDecodeError as e:
196+
raise ValueError(f"signTransaction returned invalid JSON: {e}") from e
197+
if "signature" not in signed_tx:
198+
raise ValueError("Signed transaction is missing the signature field")
181199
print("Signed, signature:", signed_tx["signature"])
182200

183201
# Step 4: Broadcast via TronGrid
@@ -306,6 +324,7 @@ async function transferBNB(
306324
console.log("Signed");
307325

308326
// Step 5: Broadcast
327+
// signTransaction returns hex without '0x' prefix; ethers requires it
309328
const txResponse = await rpcProvider.broadcastTransaction("0x" + signedTxHex);
310329
console.log("Broadcast successful! txHash:", txResponse.hash);
311330

docs/Agent-Wallet/FAQ.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ No limit. You can create separate wallets for different AI agents, different cha
7676
| **If an agent reads the file** | ✅ Key is inaccessible | ❌ Stolen instantly |
7777
| **Use case** | ✅ All scenarios | ⚠️ Fully isolated dev environments only |
7878

79-
**Always use `local_secure`** unless you're 100% certain no other agent is running on that machine.
79+
:::danger `raw_secret` exposes your private key as plaintext
80+
`raw_secret` stores your key unencrypted — the exact exposure `local_secure` mode is designed to prevent. If any other process on your machine can read files, your key can be stolen instantly. **Always use `local_secure`** unless you're 100% certain no other agent is running on that machine and it's a fully isolated, offline test environment.
81+
:::
8082

8183
### What values does the `network` parameter accept?
8284

docs/Agent-Wallet/QuickStart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ source ~/.zshrc
123123
```
124124

125125
</TabItem>
126-
<TabItem value="win-linux" label="Windows / Linux Users (Bash)">
126+
<TabItem value="win-linux" label="Linux / WSL Users (Bash)">
127127

128128
**Step 1:** Open `~/.bashrc` in an editor. Add the following line at the end of the file (replace the content inside the single quotes with your actual password):
129129

docs/McpServer-Skills/MCP/SUNMCPServer/FAQ.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ echo "your_private_key" | grep -E '^[0-9a-fA-F]{64}$'
135135

136136
1. **Verify password**: Run `echo $AGENT_WALLET_PASSWORD` to confirm the variable is set correctly.
137137
2. **Check wallet directory**: Verify `~/.agent-wallet/` exists and contains wallet files. If you used a custom directory, ensure `AGENT_WALLET_DIR` points to the correct path.
138-
3. **If password is lost**: You'll need to re-initialize the wallet. See the [Agent-Wallet Quick Start](../../../Agent-Wallet/QuickStart) and [Agent-Wallet FAQ](../../../Agent-Wallet/FAQ) for details.
138+
3. **If password is lost**: You'll need to re-initialize the wallet. Run `agent-wallet reset` to wipe and start over — see [CLI Reference → Reset](../../../Agent-Wallet/Developer/CLI-Reference#agent-wallet-reset-reset-all-data) and [Agent-Wallet FAQ](../../../Agent-Wallet/FAQ) for details.
139139

140140

141141
### "Conflicting Wallet Modes"
@@ -271,7 +271,7 @@ sun-mcp-server
271271
- Check Permit2 request structured data
272272
- Confirm chain ID, token address, deadline correct
273273

274-
3. **Reinitialize Wallet**see [Agent-Wallet Quick Start](../../../Agent-Wallet/QuickStart) for re-initialization instructions.
274+
3. **Reinitialize Wallet**run `agent-wallet reset` to wipe and start over. See [CLI Reference → Reset](../../../Agent-Wallet/Developer/CLI-Reference#agent-wallet-reset-reset-all-data) for details.
275275

276276
4. **Use Alternate Authorization Method**
277277
```

docs/McpServer-Skills/MCP/TRONMCPServer/FAQ.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ If the server reports an invalid private key at startup, it's usually a format i
9393

9494
`AGENT_WALLET_PASSWORD` must exactly match the master password set during wallet initialization. Verify that the wallet directory exists (`ls ~/.agent-wallet/`) and that `AGENT_WALLET_DIR` points to the correct path if you used a custom directory.
9595

96-
If the password is lost, you'll need to re-initialize — see the [Agent-Wallet Quick Start](../../../Agent-Wallet/QuickStart) and [Agent-Wallet FAQ](../../../Agent-Wallet/FAQ) for details.
96+
If the password is lost, you'll need to re-initialize. Run `agent-wallet reset` to wipe and start over — see [CLI Reference → Reset](../../../Agent-Wallet/Developer/CLI-Reference#agent-wallet-reset-reset-all-data) and [Agent-Wallet FAQ](../../../Agent-Wallet/FAQ) for details.
9797

9898
### TronGrid API Key not working
9999

i18n/zh-Hans/docusaurus-plugin-content-docs/current/Agent-Wallet/Developer/CLI-Reference.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ agent-wallet start -p Abc12345!
2626
```
2727
密码要求:至少 8 位,包含大写、小写、数字和特殊字符。
2828

29+
:::caution Shell 历史记录风险
30+
使用 `-p` 内联传递密码会将密码记录在终端的历史文件中。生产钱包建议使用交互式模式(不带 `-p``agent-wallet start`)或通过环境变量设置 `AGENT_WALLET_PASSWORD`——详见[非交互式执行](#非交互式执行专为自动化与后台设计)
31+
:::
32+
2933
**导入已有私钥:**
3034
```bash
3135
agent-wallet start -p Abc12345! -k 你的私钥十六进制
@@ -155,16 +159,18 @@ jobs:
155159
156160
</details>
157161
158-
### 方式 B:密码本地缓存(真正的"一劳永逸"
162+
### 方式 B:密码本地缓存(便利性与安全性的取舍
159163
160-
这是最省事的终极方案。执行一次带 `--save-runtime-secrets` 参数的命令后,密码会被永久缓存在本地文件(`~/.agent-wallet/runtime_secrets.json`)中。下次再运行任何签名命令时,系统会自动读取该缓存。你既不需要在命令行写密码,也不需要配环境变量:
164+
执行一次带 `--save-runtime-secrets` 参数的命令后,密码会被永久缓存在本地文件(`~/.agent-wallet/runtime_secrets.json`)中。下次再运行任何签名命令时,系统会自动读取该缓存。你既不需要在命令行写密码,也不需要配环境变量:
161165

162166
```bash
163167
agent-wallet sign msg "Hello" -n tron -p "Abc12345!" --save-runtime-secrets
164168
```
165169

166-
:::danger 安全提示
167-
`runtime_secrets.json` 以**明文**存储你的主密码。任何能访问你文件系统的程序(恶意插件、AI 代理、自动化脚本)都可以直接读取。请仅在你完全信任运行环境的前提下使用此功能,且务必确保该文件不会被提交到 git 或同步到云端。
170+
:::danger 此操作会使双重锁保护失效
171+
将密码缓存在钱包文件旁边,意味着一次文件系统入侵就能获取全部资金——彻底击溃 Agent-wallet 的核心"物理文件 + 密码分离"安全模型。**请仅对一次性测试钱包使用此功能。**
172+
173+
`runtime_secrets.json` 以**明文**存储你的主密码。任何能访问你文件系统的程序(恶意插件、AI 代理、自动化脚本)都可以直接读取。务必确保该文件不会被提交到 git 或同步到云端。
168174

169175
工具在创建该文件时会自动设置严格的文件权限(`600`——仅所有者可读)。如果你手动移动或复制过该文件,请验证权限:`chmod 600 ~/.agent-wallet/runtime_secrets.json`。
170176
:::
@@ -240,6 +246,7 @@ echo "提取到的签名内容是: $SIGNATURE"
240246
241247
# 接下来,你可以拿这个 $SIGNATURE 去发请求、拼 JSON,或者传给其他流水线任务...
242248
```
249+
243250
---
244251

245252
## 下一步

i18n/zh-Hans/docusaurus-plugin-content-docs/current/Agent-Wallet/Developer/SDK-Cookbook.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ Agent-wallet 专注做好最核心的安全签名步骤(第 2 步)。本页
2121

2222
1. 安装 Agent-wallet SDK(详见 [SDK 接入指南](./SDK-Guide.md)
2323
2. 通过 CLI 初始化本地钱包,或配置静态模式的环境变量
24-
3. 设置 `AGENT_WALLET_PASSWORD`(本地 `local_secure` 模式)或 `AGENT_WALLET_PRIVATE_KEY`(静态模式)
24+
3. 设置 `AGENT_WALLET_PASSWORD`(本地 `local_secure` 模式——强烈推荐)
25+
26+
:::danger 真金白银操作请勿使用静态模式(`AGENT_WALLET_PRIVATE_KEY`
27+
静态模式将你的私钥以明文存储在环境变量中——这恰恰是 Agent-wallet `local_secure` 模式旨在防范的风险。请仅在完全隔离的离线测试环境中使用一次性测试私钥。主网操作请永远使用 `AGENT_WALLET_PASSWORD` 配合本地加密保险箱。
28+
:::
2529

2630
---
2731

@@ -112,7 +116,15 @@ async function transferTRX(
112116
console.log("未签名 txID:", unsignedTx.txID);
113117

114118
// 第三步:用 Agent-wallet 本地签名
115-
const signedTx = JSON.parse(await wallet.signTransaction(unsignedTx));
119+
let signedTx: Record<string, unknown>;
120+
try {
121+
signedTx = JSON.parse(await wallet.signTransaction(unsignedTx));
122+
} catch (e) {
123+
throw new Error(`signTransaction 返回了无效的 JSON: ${e}`);
124+
}
125+
if (!signedTx.signature) {
126+
throw new Error("签名后的交易缺少 signature 字段");
127+
}
116128
console.log("已签名,signature:", signedTx.signature);
117129

118130
// 第四步:通过 TronGrid 广播
@@ -177,7 +189,13 @@ async def transfer_trx(
177189
print("未签名 txID:", unsigned_tx["txID"])
178190

179191
# 第三步:用 Agent-wallet 本地签名
180-
signed_tx = json.loads(await wallet.sign_transaction(unsigned_tx))
192+
raw_signed = await wallet.sign_transaction(unsigned_tx)
193+
try:
194+
signed_tx = json.loads(raw_signed)
195+
except json.JSONDecodeError as e:
196+
raise ValueError(f"signTransaction 返回了无效的 JSON: {e}") from e
197+
if "signature" not in signed_tx:
198+
raise ValueError("签名后的交易缺少 signature 字段")
181199
print("已签名,signature:", signed_tx["signature"])
182200

183201
# 第四步:通过 TronGrid 广播
@@ -306,6 +324,7 @@ async function transferBNB(
306324
console.log("已签名");
307325

308326
// 第五步:广播
327+
// signTransaction 返回的十六进制不带 '0x' 前缀;ethers 需要加上
309328
const txResponse = await rpcProvider.broadcastTransaction("0x" + signedTxHex);
310329
console.log("广播成功!txHash:", txResponse.hash);
311330

i18n/zh-Hans/docusaurus-plugin-content-docs/current/Agent-Wallet/FAQ.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ MetaMask 是给人用的浏览器钱包,有图形界面,每次签名需要
7676
| **代理读了文件** | ✅ 拿不到密钥 | ❌ 直接被盗 |
7777
| **适合场景** | ✅ 所有场景 | ⚠️ 完全隔离的开发环境 |
7878

79-
**永远用 `local_secure`**,除非你 100% 确定那台机器上没有任何其他代理。
79+
:::danger `raw_secret` 会以明文存储你的私钥
80+
`raw_secret` 不加密私钥——这恰恰是 `local_secure` 模式旨在防范的风险。如果你的机器上有任何其他进程能读取文件,你的私钥就会被直接盗走。**永远用 `local_secure`**,除非你 100% 确定那台机器上没有任何其他代理,且处于完全隔离的离线测试环境中。
81+
:::
8082

8183
### `network` 参数怎么填?
8284

i18n/zh-Hans/docusaurus-plugin-content-docs/current/Agent-Wallet/QuickStart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ source ~/.zshrc
123123
```
124124

125125
</TabItem>
126-
<TabItem value="win-linux" label="Windows / Linux 用户 (Bash)">
126+
<TabItem value="win-linux" label="Linux / WSL 用户 (Bash)">
127127

128128
**第 1 步:** 用编辑器打开 `~/.bashrc` 文件,在末尾添加以下内容(把单引号里的内容换成你的真实密码):
129129

0 commit comments

Comments
 (0)