You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

10 lines
472 B

import { createHash } from "node:crypto";
import type { FlockQuoteInput } from "@/workers/rpa/flock/types";
/** Flock 输入稳定哈希(含 provider 前缀,避免与 MotherShip 串缓存) */
export function hashFlockInput(input: FlockQuoteInput): string {
const payload = { provider: "flock", ...input };
const stable = JSON.stringify(payload, Object.keys(payload).sort());
return `flock_${createHash("sha256").update(stable).digest("hex").slice(0, 26)}`;
}