| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
yarn add @deepsource/shiftyShifty is built for the browser and won't work with Node. You can use the built-in crypto module instead.
import Shifty from "@deepsource/shifty";
const shifty = new Shifty((harden = true), (defaultLength = 16));
shifty.generate((length = 12)); // G8qZt7PEha^s| Parameter | Default | Description |
|---|---|---|
| harden | true | This flag enables adding special characters in the generated secret |
| defaultLength | 16 | Set the default length of the secrets generated |
| Parameter | Default | Description |
|---|---|---|
| length | Shifty.defaultLength | Length of the secret to be generated |
The Web Crypto API is an interface allowing a script to use cryptographic primitives in order to build systems using cryptography. This library leverages the Web Crypto API to generate secrets and passwords for the web.
In case the browser does not support the Web Crypto API, the library uses a fallback, it generates the string using Math.random(). This is not cryptographically safe, but is still usable.
The algorithm for generating the password is quite simple
| Back | FazBrowse Home | New Git URL |