Skip to main content

验真 · 统一验证门面(verifyone)

道统算子谱单算子仓:verifyone 及其全量用例。总谱(17 枚算子 + 总控进化 + MCP 门面)见 daotong-ops 总仓。

定名语义

  • 道统出处:验证合一
  • 工程映射:聚合恒证/圭臬/玄圭的统一验证入口

这是什么

VerifyFacade 把散落各处的验证器聚合成一个总判定入口:登记多个验证器(不同协议自动适配),verify_all() 一次跑完全部并聚合——任一失败即整体不通过,无验证器视为未验证(不通过)。

三种验证器协议,鸭子类型自动适配:

协议 形态 返回
plain 可调用对象 {"ok": bool, "detail": str}
check() 带 .check() 方法的实例 {'ok': bool, ...} 或真值
run_all() 带 .run_all() 方法的聚合型验证器 {"ok": bool, "failed": [...]}

行为约定:

  • 重名拒绝:register() 同名验证器直接 ValueError,只增不覆盖;
  • 异常计败:验证器自身抛异常视同验证失败(detail 带异常类型),不炸总判定;
  • 空门面不通过:没有登记任何验证器时 overall_ok=False——「未验证」不冒充「已验证」。

快速开始

git clone https://github.com/tanbopiao/verifyone.git
cd verifyone

# 端到端演示:三类协议登记 → 聚合判定 → 逐项结果
python3 examples/demo.py

# CLI:demo 演示 / self 自检
python3 verifyone_cli.py demo
python3 verifyone_cli.py self

# 全量测试(10 用例)
python3 -m unittest discover -s . -p "test_*.py"

用法示例

from verifyone import VerifyFacade

v = VerifyFacade()
v.register("心跳", lambda: {"ok": True, "detail": "alive"})
v.register("探针", SomeProbe())          # 带 .check() 的实例,自动适配
v.register("聚合闸", SomeGate())          # 带 .run_all() 的聚合闸,自动适配

r = v.verify_all()
if not r["overall_ok"]:
    for item in r["results"]:
        if not item["ok"]:
            print("未过项:", item["name"], item["detail"])

零第三方依赖:纯 Python 标准库,单文件 verifyone.py 即用,可直接嵌入现有验证流程。

证据链算子(evidence_chain,v0.2.0 新增)

evidence_chain.py 是元御·智能体演习证据链白皮书的开源实现:资产登记册、根印哈希链、验档三查、RFC 3161 时间戳锚定。

from evidence_chain import AssetRegistry

reg = AssetRegistry()
reg.add_file("reports/e1.json")     # 逐件入册
reg.seal("E2 落盘后全域重封")        # 重封算根印,记沿革
ok, detail = reg.verify_archive()    # 验档三查:逐件对哈希+根印对账+未登记示警
  • 验档三查:任何一件资产被改动,逐件对哈希当场报漂移;登记册被改,根印对账不一致即失败;账外资产示警亮出(不判败但必须可见)。
  • 重封沿革:每次有意变更后重算根印入沿革;缺考与失败轮次不改根印,空登记册不重封。
  • RFC 3161 时间戳:timestamp_root() 把根印摘要提交 TSA 签发回执,verify_timestamp() 用 openssl 一条命令第三方复核。诚实边界:哈希链不防能同时改文件与台账的本地攻击者;社区级 TSA 公信力为社区级,商用采信建议升级合规时间戳服务。
  • 门面适配:AssetRegistry.check() 实现 check() 协议,可直接登记进 VerifyFacade 聚合判定。

自检:python3 evidence_chain.py selftest(10 例)。

六件套

件 位置
真实可运行核心 verifyone.py(统一验证门面)+ evidence_chain.py(证据链算子)
测试 test_verifyone.py(10 用例,含重名拒绝/异常计败/登记序无关)+ tests/test_evidence_chain.py(12 用例)
工具 verifyone_cli.py(demo / self 子命令)
样例 examples/demo.py
文档 本 README
许可证 LICENSE(MIT)

保存价值与利用方案

  • 保存价值:道统算子谱「验证合一」位——把恒证(算子自检)、圭臬(规则闸)、玄圭(台账校验)等异构验证器统一到一个聚合入口,是总谱 17 算子的验收面。
  • 利用方案:作为 daotong-ops 总谱与各单算子仓的统一验收门面;任何新算子仓落位后,向本门面注册即纳入统一自检;也可独立用于任意多验证器聚合场景(发布前检查、部署后探针、CI 终验)。

MIT Licensed

Metadata

Release files for verifyone 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for verifyone 0.2.0
File Size Uploaded Provenance Actions
verifyone-0.2.0.tar.gz 12.2 kB Without provenance Details for verifyone-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for verifyone 0.2.0
File Interpreter ABI Platform Actions
verifyone-0.2.0-py3-none-any.whl Python 3 none any Details for verifyone-0.2.0-py3-none-any.whl

Total release size: 22.4 kB

Release files / verifyone-0.2.0.tar.gz

Download URL verifyone-0.2.0.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6786326db3ab56a52f31a409f257c908b4d25e28be1b979fe5326b6bd34287c9
BLAKE2b-256 checksum
How to use checksums
c297b018aa08088b3443baaca0eaadbf5ce6eefdd19b1b205d9cffc504eb7d56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / verifyone-0.2.0-py3-none-any.whl

Download URL verifyone-0.2.0-py3-none-any.whl
Size 10.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
99143d84322a34c98d39521c2e5abad06308674adb7d4b8f08a951cfd4efe03a
BLAKE2b-256 checksum
How to use checksums
4a02b5fccc3818c5cb67f3de8330da33c4b7bd87da62801d409314e87bb29e8d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for verifyone 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page