@tatastu/mark
v0.1.2
Published
One API call stamps any content with a permanent, publicly verifiable provenance record.
Maintainers
Readme
Mark
应对欧盟《人工智能法案》第 50 条的实用方案。 第 50(4) 条要求通用人工智能系统的提供者为 AI 生成的内容打上机器可读的溯源标记,截止日期为 2026 年 8 月 2 日。Mark 只需一次 API 调用:在本地对内容进行哈希,即可获得一条永久、可公开验证的记录,证明是谁签署了它、以及签署时间。 支持任何语言、任何智能体、任何流水线。(这不构成法律意见;某次盖章是否满足你具体的第 50 条义务, 取决于你的使用场景和法律顾问的判断,参见 docs/eu-ai-act.md。)
import { stamp, hashText } from "@tatastu/mark"
const hash = await hashText("你好,世界!")
const receipt = await stamp({ contentHash: hash, title: "我的文章" })
console.log(receipt.verifyUrl)
// → https://mark.tatastu.dev/p/prf_01jz...在线服务:mark.tatastu.dev,验证永久免费。在浏览器中打开返回的
verifyUrl,即可看到公开记录:签署者、时间戳,以及锚定完成后的 Arweave/Base 锚定信息。
**个人用户:**登录 mark.tatastu.dev/account,选择文件即可使用 终身一次的免费印记,无需创建 API 密钥。文件只在浏览器中进行哈希处理,绝不会上传。API 密钥仅作为 智能体、脚本及其他应用使用的可移植凭据。
功能说明
盖章(stamp) 接收任意内容(文本、文件、JSON、代码、二进制)的 SHA-256 哈希,并记录:
- 签署者(你提供的创作者身份,或匿名)
- 签署时间(毫秒精度,由每日 Merkle 锚定限制)
- Mark 服务密钥透明日志中的 Ed25519 签名
24 小时内,印记被批量处理为 RFC 6962 Merkle 树,根节点锚定到 Arweave(永久存储)和 Base(EVM 链上 calldata)。锚定后,可通过本仓库中的离线验证器,在零网络请求的情况下完成验证。
安装
npm install @tatastu/mark快速开始
为文本盖章
import { stamp, hashText } from "@tatastu/mark"
const hash = await hashText("报告内容写在这里。")
const receipt = await stamp({ contentHash: hash, title: "Q3 报告" })
console.log(receipt.verifyUrl) // https://mark.tatastu.dev/p/prf_...
console.log(receipt.byline) // "Verified · https://mark.tatastu.dev/p/prf_..."验证内容
import { verify, hashText } from "@tatastu/mark"
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/mark"
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 的配置中添加 mark.tatastu.dev/mcp:
{
"mcpServers": {
"tatastu-proof": {
"url": "https://mark.tatastu.dev/mcp"
}
}
}离线验证
印记达到 ANCHORED 状态后,可在无网络的情况下完成验证:
import { getBundle, hashNodeBuffer } from "@tatastu/mark"
import { verifyOffline } from "@tatastu/mark/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 | 每个持久账号终身 1 次 | 已上线 | | Tatastu 会员 | $20/月(含整个 Tatastu 应用) | 每月含 100 次 | 已上线 | | 预付包 | $1 / $1.50 / $5 / $8 | 5 / 10 / 50 / 100 次(永不过期) | 已上线 | | 批量包 | $35 / $65 / $120 | 500 / 1,000 / 2,000 次(永不过期) | 已上线 | | 按次付费(x402) | $0.10 或 $0.05(API key) | 1 次 | 已上线 |
验证永久免费,无需注册账号。
购买页面只显示实时价格清单中可用的套餐。完整价格:mark.tatastu.dev/pricing。
贡献
请参阅 CONTRIBUTING.md。服务端、Worker 和 D1 数据库模式位于私有仓库——本仓库仅包含公开 SDK、离线验证器和示例代码。
