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-disposition | attachment,文件名为 <hex>.pdf 或 <hex>.bin |
| etag | "<hex>",与摘要一致 |
| x-content-sha256 | sha256:<hex>,可用于校验下载完整性 |
| x-content-type-options | nosniff |
| 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.algorithm | ed25519 / ecdsa-p256 / pending |
| attestation.signature | 签名值 |
| attestation.publicKeyPem | 签名公钥(PEM) |
| attestation.statement | 被签名的声明内容 |
| attestation.signedAt | 签名时间(ISO 8601) |
| attestation.transparencyLog | 透明日志位置:index、entryDigest、previousEntryDigest |
| 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是服务端验签结果;如需独立验证,可取出publicKeyPem、signature与statement自行验签。