@gguf/claw
Version:
Multi-channel AI gateway with extensible messaging integrations
11 lines (9 loc) • 394 B
JavaScript
import { createHash, timingSafeEqual } from "node:crypto";
//#region src/security/secret-equal.ts
function safeEqualSecret(provided, expected) {
if (typeof provided !== "string" || typeof expected !== "string") return false;
const hash = (s) => createHash("sha256").update(s).digest();
return timingSafeEqual(hash(provided), hash(expected));
}
//#endregion
export { safeEqualSecret as t };