diff --git a/src/lib/serverUtils.ts b/src/lib/serverUtils.ts new file mode 100644 index 0000000..9dca22f --- /dev/null +++ b/src/lib/serverUtils.ts @@ -0,0 +1,7 @@ +import crypto from 'crypto'; + +export const hashObj = (obj: { [key: string]: any }) => { + const json = JSON.stringify(obj, Object.keys(obj).sort()); + const hash = crypto.createHash('sha256').update(json).digest('hex'); + return hash; +};