Password Generator using Sails.js


Sail.js pretty awesome squid…

Was reading a piece on how a girl started a service of selling $2 cryptologically secure human memorizable passwords. This got me wondering on how she did it. Turns out she uses a dictionary of sorts where each five digit number corresponds to a word. So she will throw 5 dice and look up the word from the dictionary. Pretty awesome…

So here I started wondering if a software can do the same thing… I needed a fast way to develop it because I didn’t want spend too much time. I also wanted to create a REST API as a service for people that might want to plug this in to their own applications.

I decided to use NodeJS because I wanted to try out NodeJS version 5. Turns out it is pretty awesome with lots of new and cool utilities. But I digress…

I didn’t want to write too much stuff though. So I started looking for a framework to use. Sail.js got my attention because of the following paragraph:

Auto-generate REST APIs.
Sails comes with blueprints that help jumpstart your app’s backend without writing any code. Just run sails generate api dentist and you’ll get an API that lets you search, paginate, sort, filter, create, destroy, update, and associate dentists. Since these blueprint actions are built on the same underlying technology as Sails, they also work with Websockets and any supported database out of the box. –Sails.js

Turns out it was good choice for a weekend project. Creating a cool website has never been easier.

The important part of this API is it uses the Crypto library by NodeJS. So some sample code below for the controller part of the API.

The important part is the usage of crypto.randomBytes which allows us to develop random numbers.

Oh and one more thing you can find the site :

You can find the code @

Have fun!