@donation-alerts/api
Version:
Interact with Donation Alerts API.
12 lines (11 loc) • 420 B
JavaScript
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');
}