approve-pairing

TotalClaw 作者 totalclaw

通过直接编辑凭证文件,无需 openclaw CLI 即可批准待处理的 DM 配对请求。当“openclawpairingapprove”不可用时使用(CLI不在路径中,未配置提升的访问权限,沙箱环境)。支持telegram、whatsapp、signal、imessage、discord、slack、feishu。

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install totalclaw:totalclaw~madan-wego-approve-pairing
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/totalclaw%3Atotalclaw~madan-wego-approve-pairing/file -o madan-wego-approve-pairing.md
# approve-pairing

Approve pending DM pairing requests by writing directly to OpenClaw credential files — no CLI required.

## How It Works

Pairing state lives in two files under `~/.openclaw/credentials/`:

- **`<channel>-pairing.json`** — pending requests (sender ID, code, accountId)
- **`<channel>-<accountId>-allowFrom.json`** — approved senders allowlist

Approving = add sender ID to allowFrom file + remove code from pairing file.

## Quick Approval (script)

```bash
python3 skills/approve-pairing/scripts/approve_pairing.py <channel> <code>
```

Example:
```bash
python3 skills/approve-pairing/scripts/approve_pairing.py telegram PWVW264M
```

The script:
1. Reads `~/.openclaw/credentials/<channel>-pairing.json`
2. Finds the request matching the code
3. Appends the sender ID to the allowFrom file
4. Removes the code from pending requests

## Manual Steps (if script unavailable)

1. Read `~/.openclaw/credentials/<channel>-pairing.json` to get `id` and `meta.accountId`
2. Write/update `~/.openclaw/credentials/<channel>-<accountId>-allowFrom.json`:
   ```json
   { "version": 1, "allowFrom": ["<sender_id>"] }
   ```
3. Clear the pending request from `<channel>-pairing.json`

## Notes

- Codes expire after 1 hour — check `createdAt` if approval fails
- A gateway restart may be needed: `openclaw gateway restart`
- If `accountId` is `"default"` or empty, the file is `<channel>-default-allowFrom.json`
- Pending requests capped at 3 per channel; old ones must expire before new ones are created

---

## 中文说明

# approve-pairing

通过直接写入 OpenClaw 凭证文件来批准待处理的 DM 配对请求 —— 无需 CLI。

## 工作原理

配对状态存储在 `~/.openclaw/credentials/` 下的两个文件中:

- **`<channel>-pairing.json`** —— 待处理请求(发送者 ID、验证码、accountId)
- **`<channel>-<accountId>-allowFrom.json`** —— 已批准发送者的允许列表

批准 = 将发送者 ID 添加到 allowFrom 文件 + 从 pairing 文件中移除验证码。

## 快速批准(脚本)

```bash
python3 skills/approve-pairing/scripts/approve_pairing.py <channel> <code>
```

示例:
```bash
python3 skills/approve-pairing/scripts/approve_pairing.py telegram PWVW264M
```

该脚本:
1. 读取 `~/.openclaw/credentials/<channel>-pairing.json`
2. 找到与验证码匹配的请求
3. 将发送者 ID 追加到 allowFrom 文件
4. 从待处理请求中移除验证码

## 手动步骤(如果脚本不可用)

1. 读取 `~/.openclaw/credentials/<channel>-pairing.json` 以获取 `id` 和 `meta.accountId`
2. 写入/更新 `~/.openclaw/credentials/<channel>-<accountId>-allowFrom.json`:
   ```json
   { "version": 1, "allowFrom": ["<sender_id>"] }
   ```
3. 从 `<channel>-pairing.json` 中清除待处理请求

## 注意事项

- 验证码在 1 小时后过期 —— 如果批准失败,检查 `createdAt`
- 可能需要重启网关:`openclaw gateway restart`
- 如果 `accountId` 为 `"default"` 或为空,则文件为 `<channel>-default-allowFrom.json`
- 每个频道的待处理请求上限为 3 个;必须等旧请求过期后才能创建新请求