API 参考

证据与签名

按 SHA-256 摘要下载证据对象,读取执行证明并验证签名。

CiteArk 的证据对象与执行证明都按内容摘要寻址。两个端点的路径参数 digest 都是 64 位小写 hex(不带 sha256: 前缀),格式不符返回 400

鉴权

  • 公开仓库的对象与证明可直接访问,无需登录。
  • 私有仓库的对象与证明需要浏览器会话或 x-api-key 且具备读取权限,否则 403

GET /api/objects/{digest}

按内容摘要下载证据或获许可重新分发的对象。许可不允许重新分发的论文 PDF 仅 owner / 组织成员可下载,其余人得到 451 {"error": "论文许可不允许 CiteArk 重新分发,请访问原始来源"}

示例

curl -OJ https://citeark.com/api/objects/<64位hex摘>

响应

200 返回二进制流,响应头:

响应头说明
content-type对象原始 mediaType
content-length字节长度
content-dispositionattachment,文件名为 <hex>.pdf<hex>.bin
etag"<hex>",与摘要一致
x-content-sha256sha256:<hex>,可用于校验下载完整性
x-content-type-optionsnosniff
cache-control公开对象 public, max-age=31536000, immutable;私有对象 private, no-store

支持 If-None-Match 条件请求:携带匹配的 ETag 时返回 304

错误

状态码含义
400摘要格式无效
403无权读取这个对象
404对象不存在
451论文许可不允许重新分发
502对象完整性校验失败

GET /api/attestations/{digest}

按 statement 摘要读取一次运行的执行证明,并由服务端重新验签。

示例

curl https://citeark.com/api/attestations/<64位hex摘>

响应

200 返回 { "attestation": { ... }, "verified": true, "verificationMethod": "…" }:

字段说明
attestation.statementDigest声明摘要(sha256: 前缀)
attestation.nodeId签名节点 ID
attestation.keyId签名密钥 ID
attestation.algorithmed25519 / ecdsa-p256 / pending
attestation.signature签名值
attestation.publicKeyPem签名公钥(PEM)
attestation.statement被签名的声明内容
attestation.signedAt签名时间(ISO 8601)
attestation.transparencyLog透明日志位置:indexentryDigestpreviousEntryDigest
verified服务端现场验签结果
verificationMethod固定为 ECDSA P-256 over CiteArk canonical JSON
{
  "attestation": {
    "statementDigest": "sha256:…",
    "nodeId": "…",
    "keyId": "…",
    "algorithm": "ecdsa-p256",
    "signature": "…",
    "publicKeyPem": "…",
    "statement": { "…": "…" },
    "signedAt": "…",
    "transparencyLog": { "index": 12, "entryDigest": "sha256:…", "previousEntryDigest": "sha256:…" }
  },
  "verified": true,
  "verificationMethod": "ECDSA P-256 over CiteArk canonical JSON"
}

缓存:公开仓库 public, max-age=300;私有仓库 private, no-store

错误

状态码含义
400摘要格式无效
403无权读取这个执行证明
404执行证明不存在

备注

  • x-content-sha256 与 ETag 都来自服务端存储时登记的摘要,下载后可自行重算 SHA-256 比对,确认传输与存储未被篡改。
  • attestation 的 verified 是服务端验签结果;如需独立验证,可取出 publicKeyPemsignaturestatement 自行验签。