EdgeCron API Docs

认证签名

EdgeCron 客户侧 API 的 HMAC-SHA256 签名规则。

客户侧 API 按固定中间件顺序处理请求:

RequestID -> APIKey -> Signature -> RateLimitApp -> BillingMiddleware

必填请求头

HeaderTypeDescription
X-Key-IDstringAPI Key ID,例如 ak_...
X-TimestampintegerUnix 秒级时间戳。
X-SignaturestringHMAC-SHA256 小写十六进制签名。
Content-Typestring带 JSON 请求体时使用 application/json

签名 payload

签名输入为:

timestamp + "\n" + payload

payload 的规则:

  • 查询参数按 key 排序后拼接。
  • 有请求体时使用原始 body 字符串。
  • 查询和 body 同时存在时,使用 sorted_query + "&" + raw_body

Node.js 示例

import crypto from 'node:crypto';

function sign(secret: string, timestamp: number, payload: string) {
  return crypto
    .createHmac('sha256', secret)
    .update(`${timestamp}\n${payload}`)
    .digest('hex');
}

本页目录