Hi Patrick,
I need bcrypt to maintain backwards compatibility with an existing Laravel app database.
I’m re-creating this web app in Wappler, but I would probably keep using bcrypt for a while just in case I need to temporarily rollback to the Laravel app in case of a bug appears or similar situation.
For now, I’ve just managed to create a custom module for Wappler. The bcrypt hash/verification is different from PHP’s implementation, so I had to apply a couple of workarounds to maintain PHP compatibility:
// Verify
hash = hash.replace(/^\$2y(.+)$/i, '$2a$1'); // PHP to NodeJS bcrypt
// Hash
hashed = hashed.replace('$2a$', '$2y$'); // NodeJS to PHP bcrypt
hashed = hashed.replace('$2b$', '$2y$'); // NodeJS to PHP bcrypt
The .hjson part of the custom module was hell (seriously, it’s too confusing for newcomers, even following the documentation), I had to steal @JonL’s Argon2 .hjson - and I probably forgot to use async, guess I need to change that
If there’s anyone interested in this, I suppose I could publish it on Wappler extensions after I finish it