Securing your Action Menu Items

Hello friends

I am a newbie here so please excuse me in advance

I found this article here
Securing your Action Menu Items – Shotgun Support

and I am very keen to do this in NodeJS however I am doing something wring clearly as the hash that gets generated with code below doesn’t seem to match signature

    for (const key of Object.keys(payload)) {
        value = (payload as AnyObject)[key] as string
        if(key !== 'signature'){
            const term = `${key}=${value}`
    const payload_to_verify = sorted_params.join()
    const hmac = crypto.createHmac('sha1', 'MySecret').update(Buffer.from(payload_to_verify, 'hex')).digest('hex')
    console.log('incoming payload signature=', _.get(payload,'signature'))

incoming payload signature= d570a65822e343b5398b651d04d21e60e88632bd
hmac= 343b0f69123052ed059f53b31f05d775e757dc61