Generating a random digest

Inside our code bundle, there is a createUser function that we use to generate dummy users for our tests. At the moment, it is using the crypto.randomBytes() method to generate a random 32-character hexadecimal string to use as the password. To produce a digest from this password, we can use a package from the npmjs.com registry.

Get Building Enterprise JavaScript Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.