kelektiv / node.bcrypt.js

bcrypt for NodeJs
MIT License
7.38k stars 510 forks source link

Download binaries like sharp #1022

Open root-io opened 6 months ago

root-io commented 6 months ago

I wish I could install bcrypt the way sharp does it: https://sharp.pixelplumbing.com/install#cross-platform

Example with npm: npm install --cpu=x64 --os=linux --libc=musl bcrypt


Edit: Sorry I was not clear enough about this improvement and I closed it because I found another alternative.

Let me explain:

I run Docker on a Apple silicon CPU (darwin arm64) with a linux container (arm64 musl) but my prod is linux x64 musl. That's 3 different os/arch/libc configuration.

I had issues installing your library and I think I'm not the only one and the easy fix is to install the javascript implementation alternative: bcryptjs but you take a hit on performance compared to your C++ implementation.

I ended up installing argon2 v0.40 which works well.

TL;DR: sharp (>=v0.33) and argon2 (>=v0.40) seem to have a better logic to install the right binaries.

recrsn commented 5 months ago

This is an interesting approach, we can probably implement this in a future release