I am new to Salesforce B2C. I need to use the bcrypt dependency in a Controller, but I can't get it installed on the cartridge. I am not sure if this is possible. If it is not possible. Is there a Salesforce dependency that allows me to do what the "bcrypt.hash (pass, salt)" function would do? Thanks and sorry if there is something misspelled, I don't speak too much English

  • Out of the box - no, you'll have to roll your own cartridge.
    – identigral
    Jun 17 '21 at 16:31

You have to use sgmf-scripts: https://www.npmjs.com/package/sgmf-scripts. It's a package for SFCC that allows to build a custom SFRA cartridge app with node.js.

So you can create an app with node.js + bcrypt + sgmf-scripts. Just make sure the app is designed to override the core/default scripts where you need bcrypt.


Unfortunately, bcrypt is written in C++. Node.JS can work with this, but not the server-side engine (Rhino) that Salesforce Commerce Cloud B2C runs on.

All supported functions related to cryptography is located in these packages:


Note: It might be possible to re-engineer, but start from a Java example as SFCC runs in Java with a JS -> Java interpreter (Rhino) in between.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.