V3 signature validation doesn't work for space

I am following this link to implement v3 signature validation: Validating Requests - HubSpot docs

The problem I am facing is that if the “x-hubspot-signature-v3” includes a space, the generated hashedString will have a plus sign. That will make the signature mismatch. For example, I got a signature:
“X-HubSpot-Signature-v3”:“s9fg/l7gop54ZS/srjGtdZr4E Gn4LNDdUEFKy6/Dlo=”

The code crypto.createHmac(“sha256”, process.env.CLIENT_SECRET).update(rawString).digest(“base64”) gives me “s9fg/l7gop54ZS/srjGtdZr4E+Gn4LNDdUEFKy6/Dlo=”.

As you can see the space is replaced by a “+” sign. How do I handle this case?

Hey @JZhao,
Thanks for posting in the Community!
I’d like to tag in some experts to see what insight they may have on how to approach this use case. @Anton, @Teun, and @alyssamwilie - any thoughts here?
Shane, Senior Community Moderator