Describe the need
I think there is a significant performance loss happening in this module.
Lets say we run the webhook middleware not in a cloud function. We get the payload, is a buffer and transform it as a string. Then we pass it to the hashing function, which is basically transforming it back to a buffer to hash it. When we validated, we do a JSON.parse.
What we could do is to keep them buffers, till we need it to be a string for JSON.parse.
In gcf we have request.body and request.rawBody. So we dont need to call JSON.parse.
Thats what I wanted to achieve in #936
Yes having a "getPayload" function is nice to encapsulate, but it is a potential performance bottleneck.
SDK Version
No response
API Version
No response
Relevant log output
No response
Code of Conduct
Describe the need
I think there is a significant performance loss happening in this module.
Lets say we run the webhook middleware not in a cloud function. We get the payload, is a buffer and transform it as a string. Then we pass it to the hashing function, which is basically transforming it back to a buffer to hash it. When we validated, we do a JSON.parse.
What we could do is to keep them buffers, till we need it to be a string for JSON.parse.
In gcf we have request.body and request.rawBody. So we dont need to call JSON.parse.
Thats what I wanted to achieve in #936
Yes having a "getPayload" function is nice to encapsulate, but it is a potential performance bottleneck.
SDK Version
No response
API Version
No response
Relevant log output
No response
Code of Conduct