import { timingSafeEqual , createHash , createHmac } from "crypto" ; export const safeEqual = ( a , b ) => { const aBuff = Buffer . from ( a ) ; const bBuff = Buffer . from ( b ) ; return aBuff . length === bBuff . length && timingSafeEqual ( aBuff , bBuff ) ; } ; export const hmacSha256 = ( plaintext , key ) => createHmac ( "sha256" , key ) . update ( plaintext ) . digest ( "hex" ) ; export const compress = ( str ) => str . replace ( /\s{2,}/g , "" ) ;