Bun.password.hash() to securely hash passwords. It’s built into Bun, with no third-party dependencies.
By default,
Bun.password.hash() uses the Argon2id algorithm. Pass a second argument to use a different algorithm or configure the hashing parameters.
Bun also implements the bcrypt algorithm. Specify
algorithm: "bcrypt" to use it.
Use
Bun.password.verify() to verify a password. The hash stores the algorithm and its parameters, so you don’t need to specify them again.
See
Bun.password.