Files
Jyotisha/frontend/src/lib/hash.ts
T
jesse-uxandGrok (agent loop) d2296c2654 把前后端共用的请求契约和小工具收成一份,避免再各抄一份。
报告创建请求、校正入口和同名类型改从 contracts 推导;同义的对象判断与 sha256 改走共享函数。调用处用 import 别名保留原名,使 diff 低于 1500 行。行为、哈希和状态字符串不变。

Co-Authored-By: Grok (agent loop)
2026-10-15 22:22:44 +08:00

10 lines
289 B
TypeScript

/**
* SHA-256 hex digest.
* Imports node:crypto. Server modules only — do not import this file from client components.
*/
import { createHash } from "node:crypto";
export function sha256Hex(text: string): string {
return createHash("sha256").update(text).digest("hex");
}