@tatastu/proof
v0.1.0
Published
One API call stamps any content with a permanent, publicly verifiable provenance record.
Maintainers
Readme
Tatastu Proof
一行 API 调用,为任何内容盖上永久、可公开验证的溯源印记。支持任何语言、任何 AI 智能体和任何流水线。
import { stamp, hashText } from "@tatastu/proof"
const hash = await hashText("你好,世界!")
const receipt = await stamp({ contentHash: hash, title: "我的文章" })
console.log(receipt.verifyUrl)
// → https://proof.tatastu.dev/p/prf_01jz...在线服务:proof.tatastu.dev — 验证永久免费。
功能说明
盖章(stamp) 接收任意内容(文本、文件、JSON、代码、二进制)的 SHA-256 哈希,并记录:
- 签署者(你提供的创作者身份,或匿名)
- 签署时间(毫秒精度,由每日 Merkle 锚定限制)
- Tatastu Proof 服务密钥透明日志中的 Ed25519 签名
24 小时内,印记被批量处理为 RFC 6962 Merkle 树,根节点锚定到 Arweave(永久存储)和 Base(EVM 链上 calldata)。锚定后,可通过本仓库中的离线验证器,在零网络请求的情况下完成验证。
安装
npm install @tatastu/proof快速开始
为文本盖章
import { stamp, hashText } from "@tatastu/proof"
const hash = await hashText("报告内容写在这里。")
const receipt = await stamp({ contentHash: hash, title: "Q3 报告" })
console.log(receipt.verifyUrl) // https://proof.tatastu.dev/p/prf_...
console.log(receipt.byline) // "Verified · https://proof.tatastu.dev/p/prf_..."验证内容
import { verify, hashText } from "@tatastu/proof"
const { proofs } = await verify(await hashText("报告内容写在这里。"))
if (proofs.length > 0) {
console.log("真实有效:", proofs[0].verifyUrl)
console.log("状态:", proofs[0].status) // SIGNED | ANCHORED | CONFIRMED
}EU AI 法案合规(第 50 条)
EU AI 法案第 50(4) 条要求对 AI 生成内容附加机器可读的溯源元数据,截止日期为 2026 年 8 月 2 日。
import { stamp, hashText } from "@tatastu/proof"
const aiOutput = "AI 生成的文本内容。"
const receipt = await stamp({ contentHash: await hashText(aiOutput) })
const labeledOutput = {
text: aiOutput,
_proof: {
contentHash: receipt.contentHash,
proofId: receipt.proofId,
verifyUrl: receipt.verifyUrl,
signedAt: receipt.signedAt,
bylineHtml: receipt.bylineHtml,
},
}详见 docs/eu-ai-act.md(英文)。
MCP(AI 智能体)
在 Claude Code、Cursor 或 Windsurf 的配置中添加 proof.tatastu.dev/mcp:
{
"mcpServers": {
"tatastu-proof": {
"url": "https://proof.tatastu.dev/mcp"
}
}
}离线验证
印记达到 ANCHORED 状态后,可在无网络的情况下完成验证:
import { getBundle, hashNodeBuffer } from "@tatastu/proof"
import { verifyOffline } from "@tatastu/proof/verify/offline"
import { readFile } from "node:fs/promises"
const bytes = await readFile("./report.pdf")
const bundle = await getBundle("prf_01jz...")
const result = await verifyOffline(bundle, await hashNodeBuffer(bytes))
console.log(result.valid, result.signatureVerified, result.merkleVerified)verify/offline.ts 是一个约 200 行的单文件,零依赖,仅使用 Web Crypto API(SubtleCrypto),适用于 Node 18+、Deno 和现代浏览器。
价格
| 套餐 | 价格 | 印记数 | 状态 | |------|------|--------|------| | 免费 | $0 | 25/月 | 已上线 | | Tatastu 会员 | $20/月(含整个 Tatastu 应用) | 每月含 500 次 | 已上线 | | 入门包 | $8 | 100 次(永不过期) | 即将上线 | | 创作者包 | $35 | 500 次(永不过期) | 即将上线 | | 创作者订阅 | $12/月 | 500/月 | 即将上线 | | 按次付费(x402) | $0.10 或 $0.05(API key) | n/a | 即将上线 |
验证永久免费,无需注册账号。
“即将上线”的套餐已定价但暂不可购买。完整价格:proof.tatastu.dev/pricing。
贡献
请参阅 CONTRIBUTING.md。服务端、Worker 和 D1 数据库模式位于私有仓库——本仓库仅包含公开 SDK、离线验证器和示例代码。
