@dbos-inc/dbos-bcrypt
v2.10.24
Published
DBOS bcrypt step library
Downloads
222
Readme
DBOS bcrypt Steps
This is a DBOS step for generating bcrypt hashes.
The reason that some bcrypt operations should be wrapped in a @DBOS.step is that they generate random numbers. By using a step, replayed or restarted workflows will get the recorded value and therefore have the same behavior as the original.
Available Functions
bcryptGenSalt(saltRounds?:number)
bcryptGenSalt produces a random salt. Optional parameter is the number of rounds.
bcryptHash(txt: string, saltRounds?:number)
bcryptHash generates a random salt and uses it to create a hash of txt.
Examples
It is suggested to use the BcryptStepV2 from this library. The functionality is the same, but invocation syntax is simpler.
import { BcryptStep } from '@dbos-inc/dbos-bcrypt';
//...
const hashedPassword = await BcryptStep.bcryptHash(password);
//...
const isValid = await BcryptStep.bcryptCompare(password, hashedPassword);Next Steps
- To start a DBOS app from a template, visit our quickstart.
- For DBOS programming tutorials, check out our programming guide.
- To learn more about DBOS, take a look at our documentation or our source code.
