回调签名改为与开放 API 一致的字典序拼接风格

- 签名串由 timestamp+换行+bodyhash 改为 body_sha256=<hash>&timestamp=<unix秒>(ASCII 字典序 & 拼接)
- 同步更新对接文档
This commit is contained in:
yml2213
2026-08-03 11:48:10 +08:00
parent 3e8526d5d7
commit ef8b8a7213
2 changed files with 8 additions and 4 deletions
+2 -2
View File
@@ -615,7 +615,7 @@ function CallbackSignSection() {
<Text code>sha256hex(body)</Text> —— 原始请求体字节的 SHA256 十六进制(小写)
</Descriptions.Item>
<Descriptions.Item label="签名串">
<Text code>timestamp + "\n" + sha256hex(body)</Text>,换行符拼接
<Text code>body_sha256=&lt;hash&gt;&amp;timestamp=&lt;unix秒&gt;</Text>,按 ASCII 字典序 <Text code>&amp;</Text> 拼接(与开放 API 鉴权同一风格)
</Descriptions.Item>
<Descriptions.Item label="X-Sign">
<Text code>hex( HMAC-SHA256( secret, 签名串 ) )</Text>,小写十六进制
@@ -624,7 +624,7 @@ function CallbackSignSection() {
</Card>
<Card className="api-docs__card" size="small" title="校验伪代码">
<pre className="api-docs__pre">{`bodyHash = sha256Hex(rawBody)
content = timestamp + "\\n" + bodyHash
content = "body_sha256=" + bodyHash + "&timestamp=" + timestamp
expected = hmacSHA256Hex(secret, content)
ok = (X-Sign == expected)`}</pre>
</Card>