-
Notifications
You must be signed in to change notification settings - Fork 11
feat: add create hmac signature #500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I am not very happy to see any additional dependencies in the utilities package. We use that in many places (crawlee core and Apify CLI to begin with), and they will now all get a new dependency, even though it will be used in only the SDK and apify-core. The function seems too trivial to justify this. I know it's really a small dependency, but at the same time the new helper is just a 5 lines of code. |
|
@B4nan is it really such an issue? I feel like you're overoptimizing, the additional complexity from sharing the helper in multiple places is not worth 0.02% of savings in Crawlee. > npx howfat crawlee
[email protected] (575 deps, 95.66mb, 19921 files, ©Apache-2.0)
> npx howfat @apify/utilities
@apify/[email protected] (3 deps, 695.66kb, 33 files, ©Apache-2.0)
> npx howfat base62
[email protected] (25.88kb, 18 files, ©MIT) |
|
I am just pointing out a bad practice, especially when it comes to public packages. You picked the fattest library we have for your comparison. Btw you say I am overoptimizing, I say you are over-engineering. Pick your poison :] Anyway, I am fine with this, I just don't like it. |
|
The encode function is pretty simple. I copied it from https://github.com/base62/base62.js/blob/master/lib/ascii.js to avoid new dependency. Hope everyone is ok with that |
fnesveda
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm afraid this won't work correctly. if the signature is 30 hex characters, and you parse it to an integer, it's max possible value is 2^120, which is far larger than the max safe integer in JavaScript (Number.MAX_SAFE_INTEGER , equal to 2^53 - 1).
You'll have to use BigInts for this.
fnesveda
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, one last tiny thing
This PR adds new function to the utility package.
Function
createHmacSignature()will be used in Apify SDK as well as in Apify Core repositories