Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including @hellotoby/secrets with all npm packages installed. Try it out:

var secrets = require("@hellotoby/secrets")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@hellotoby/secrets v1.0.1

△ Secrets

Secrets is a tiny 2kb library for generating secure passwords.


yarn add @hellotoby/secrets


Simply instantiate a new Secret and pass the following parameters:

  • (int) Length of string you'd like to return
  • (bool) Use numeric characters
  • (bool) Use special characters

Turning off numbers and special characters will default to a random string of upper and lower case English letters.

Defaults to: new Secrets(32, true, true);


import Secrets from '@hellotoby/secrets';

const secret = new Secrets(32, true, true).generate();


const Secrets = require('@hellotoby/secrets');

const secret = new Secrets(32, true, true).generate();

In the browser

Import the file ./dist/secrets.min.js.

eg. <script src="secrets.min.js"></script>

Then in your javascript code use: const secret = new Secrets(64, true, true).generate();.


Secrets doesn't have any protection to stop it from generating naughty words. It's possible that something bad might come up in the generated password.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free