Shifty is a tiny zero-dependency secrets generator, built for the web using TypeScript.
Shifty is a tiny zero-dependency secrets generator built for the web using TypeScript. Shifty is made for the browser and won't work with Node. You can use the built-in crypto module instead.
It provides a straightforward API to generate a secret of any length. To start using shifty, just install it using the package manager of your choice.
yarn add @deepsource/shifty
Using Shifty is quite straightforward. Just initialize the Shifty class with the defaults and use the generate method to generate secrets of any length. Shifty falls back to using Math.random if the crypto object is not present on window. It shows a warning on the developer console when using the fallback method.
import Shifty from '@deepsource/shifty' const shifty = new Shifty((harden = true), (defaultLength = 16)) shifty.generate((length = 12)) // G8qZt7PEha^s
Shifty is just a single TypeScript file. You can peek into the source code here. Give it a star if you like it!
I'll send an email only when I publish something on my blog, which is usually once month at best, and you can unsubscribe instantly at any time. So don't worry about spam. I use Buttondown to host this newsletter, It's trusted by many for it's privacy practices, you can read more here.
If you're interested, drop your email below