0

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

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

2 Answers 2

0

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:

https://documentation.b2c.commercecloud.salesforce.com/DOC1/topic/com.demandware.dochelp/DWAPI/scriptapi/html/api/package_dw_crypto.html?resultof=%22%63%72%79%70%74%6f%22%20

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.

0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .