UNPKG

@donation-alerts/api

Version:
12 lines (11 loc) 420 B
import { flattenObject } from '@stimulcross/shared-utils'; import { sha256 } from 'cross-sha256'; /** @internal */ export function createSha256SignatureFromParams(params, secret) { const valuesString = Object.values(flattenObject(params)) .filter(v => v !== undefined) .map(e => String(e)) .toSorted() .join(''); return new sha256().update(valuesString + secret).digest('hex'); }