Digest in requests

I’m trying to build an ActivityPub server. When I receive a post request on my inbox, the way I verify the hash is simple. I use JSON.stringify(body), then I hash the body, take the digest and verify it’s the same as the one provided in the headers. When I receive follow requests, it works fine. But when I receive a Create activity with a Note object, the digest aren’t the same.

So are you parsing the body as JSON, then converting it back to a string? That’s not guaranteed to give you a result that’s identical to the original body.

Try hashing the original body that you received from the wire, before you parse it.

2 Likes

Yes. Yes. IT WORKS !!! Thank you so much !

1 Like