verify-receipt — команда для Claude Code: проверка и установка
Проверяет Ed25519-подпись файла receipt и показывает, был ли он изменён. Подходит для разовой проверки записи protect-mcp.
/plugin marketplace add wshobson/agents
/plugin install protect-mcp@claude-code-workflowsЧто делает verify-receipt
Команда читает JSON-файл receipt, проверяет обязательные поля и типы, затем восстанавливает каноническое представление по JCS (RFC 8785). После этого она сверяет Ed25519-подпись через @veritasacta/[email protected]. Проверка не делает сетевых запросов.
Публичный ключ можно передать вторым аргументом в hex или взять из ./protect-mcp.key. При первом запуске npx скачивает пакет; для офлайн-машины сначала выполните npm install --no-save @veritasacta/[email protected]. Код завершения 0 означает подлинную запись, 1 — несовпадение подписи, 2 — повреждённую структуру или отсутствующий ключ. Без публичного ключа команда не сможет подтвердить receipt.
Какие задачи решает
- проверить подпись файла receipt
- найти изменённую после подписания запись
- проверить структуру JSON и обязательные поля
- передать публичный ключ для верификации
- отличить повреждённый receipt от подлинного
Примеры запросов агенту
- Проверь файл
./receipt.jsonкомандой/verify-receipt ./receipt.json. - Проверь
./receipt.jsonс публичным ключом0faf558a90dfbf88.... - Возьми последнюю строку из
./receipts/receipts.jsonl, сохрани её вreceipt.jsonи проверь через/verify-receipt receipt.json.
Как установить verify-receipt
1Через маркетплейс плагинов
/plugin marketplace add wshobson/agents/plugin install protect-mcp@claude-code-workflows2Вручную: положить файлы
.claude/commands/verify-receipt.mdВызов — /verify-receipt. Для всех проектов — ~/.claude/commands/
Вручную: положить файлы
~/.codex/prompts/verify-receipt.mdВызов — /prompts:verify-receipt. В Codex этот формат помечен устаревшим, замена — скиллы
Вручную: положить файлы
.github/prompts/verify-receipt.prompt.mdВручную: положить файлы
.gemini/commands/verify-receipt.tomlGemini хранит команды в TOML: текст запроса — в поле prompt
Вопросы о verify-receipt
Как установить verify-receipt в Claude Code?
Выполните /plugin marketplace add wshobson/agents, затем /plugin install protect-mcp@claude-code-workflows. Файл команды должен находиться по пути .claude/commands/verify-receipt.md.
Что делает verify-receipt?
Команда проверяет структуру receipt, восстанавливает каноническую форму JCS и сверяет Ed25519-подпись с публичным ключом. Она возвращает разные коды для подлинной, изменённой и некорректной записи.
Где verify-receipt берёт публичный ключ?
Ключ можно передать вторым аргументом в hex. Если аргумент не задан, команда читает publicKey из ./protect-mcp.key; сам receipt ключ не содержит.
Исходный текст
verify-receipt.md · MIT
--- description: "Verify a single Ed25519-signed receipt file against the signer's public key. Returns exit 0 if valid, 1 if tampered, 2 if malformed or the key is missing." argument-hint: "<path-to-receipt.json> [public-key-hex]" --- # Verify Receipt Verify an Ed25519 signed receipt produced by `protect-mcp` with `@veritasacta/verify` from npm. The check itself makes no network requests and needs no vendor lookup. `npx` downloads `@veritasacta/[email protected]` the first time it runs. For an offline machine, install it in the project first with `npm install --no-save @veritasacta/[email protected]`, and `npx` then runs the local copy without network access. ## Usage ``` /verify-receipt ./receipt.json ``` protect-mcp 0.7.4 appends receipts to `./receipts/receipts.jsonl`, one per line. Save one line to its own file first, e.g., the newest one with `tail -n 1 ./receipts/receipts.jsonl > receipt.json`. Use `/audit-chain` to verify the whole file. ## What This Command Does 1. Reads the receipt JSON file 2. Validates the structure (required fields, correct types) 3. Takes the public key from the second argument, or from the `publicKey` value in `./protect-mcp.key` (the receipt does not hold a key) 4. Reconstructs the canonical form (JCS, RFC 8785) 5. Verifies the Ed25519 signature over the canonical bytes 6. Reports the result ## Implementation Run this in a shell: ```bash PUB="${2:-$(node -p 'JSON.parse(require("fs").readFileSync("./protect-mcp.key")).publicKey')}" npx @veritasacta/[email protected] "$1" --key "$PUB" ``` Where `$1` is the receipt path provided by the user, and `$2` is an optional public key in hex. ### Expected exit codes | Exit | Meaning | Action | |------|---------|--------| | 0 | Valid receipt, signature verified | Report: "Verified. Receipt authentic." | | 1 | Signature mismatch — receipt tampered | Report: "TAMPERED. Signature does not match payload." | | 2 | Malformed receipt or missing key | Report: "Undecidable. The receipt is malformed or no public key was given." | ## What to Show the User For a valid receipt: ``` Verified ✓ Request: tu-1790427588265-c8x5 Tool: Read Decision: allow Signed at: 2026-09-26T12:59:48.265Z Key ID: generated ``` For a tampered receipt: ``` TAMPERED ✗ The signature does not match the payload. This receipt has been modified since it was signed. Request ID: tu-1790427588265-c8x5 Checked against key: 0faf558a90dfbf88... Possible causes: - A field was edited after signing (most common) - The signature was copied from a different receipt - The wrong public key was given Compare this receipt against a known-good copy to identify the altered field. ``` For a malformed receipt: ``` MALFORMED ✗ The file is not a valid Veritas Acta receipt. Missing or invalid fields: <list the specific structural issues> A protect-mcp 0.7.4 receipt includes: v, type, algorithm, kid, issuer, issued_at, payload, signature. ``` ## References - Receipt format: [IETF draft-farley-acta-signed-receipts](https://datatracker.ietf.org/doc/draft-farley-acta-signed-receipts/) - Verify CLI: [@veritasacta/verify on npm](https://www.npmjs.com/package/@veritasacta/verify) - All receipts: use `/audit-chain` to verify `./receipts/receipts.jsonl`
© Tom Farley · MIT · wshobson/agents