opencode / packages /console /core /src /util /crypto.ts
SaylorTwift's picture
SaylorTwift HF Staff
Add files using upload-large-folder tool
116a473 verified
Raw
History Blame Contribute Delete
290 Bytes
import { timingSafeEqual } from "node:crypto"
export function safeEqual(a: string, b: string): boolean {
const encoder = new TextEncoder()
const aBytes = encoder.encode(a)
const bBytes = encoder.encode(b)
return aBytes.length === bBytes.length && timingSafeEqual(aBytes, bBytes)
}