Generate Password is a generating random and unique passwords.

Overview

Generate Password

No Dependencies npm package GitHub Actions CI Coverage Status npm bundle size

Generate Password is a generating random and unique passwords.

Install

$ npm install @wcj/generate-password --save

Usage

import { generate, generateMultiple, validate } from '@wcj/generate-password';

generate(); // => dK0#vA3@fG
generate({ length: 23 }); // => bB1@aO7^bF0!aA0~aQ1%aE3
generateMultiple(2, { length: 8 }); // => [ 'aG6@aC2(', 'dH0{fQ0%' ]
validate('qK0#dQ3*gG'); // => 4  Strong :) Now it's safe!

Or manually download and link generate-password.js in your HTML, It can also be downloaded via UNPKG:

CDN: UNPKG | jsDelivr

<script src="https://unpkg.com/@wcj/generate-password/dist/generate-password.min.js"></script>
<script type="text/javascript">
  GeneratePassword.generate(); // => dK0#vA3@fG
  GeneratePassword.generate({ length: 23 }); // => bB1@aO7^bF0!aA0~aQ1%aE3
  GeneratePassword.generateMultiple(2, { length: 8 }); // => [ 'aG6@aC2(', 'dH0{fQ0%' ]
  GeneratePassword.validate('qK0#dQ3*gG'); // => 4,   Strong :) Now it's safe!
</script>

API

generate

Create a random password

import { generate } from '@wcj/generate-password';

generate(); // => dK0#vA3@fG
generate({ length: 23 }); // => bB1@aO7^bF0!aA0~aQ1%aE3
generate({ upperCase: false }); // => n6[a3_f0$k
generate({ lowerCase: false }); // => N0(B3,C4$I
generate({ numeric: false }); // => cX*rB|jP:j
generate({ numeric: false }); // => eD3rA0gL1b
generate({ special: false, numeric: false }); // => aCaLlGfSgI
generate({ special: false, lowerCase: false, upperCase: false }); // => 4020810127
generate({ special: false, lowerCase: false, numeric: false }); // => DEEBBCBYAO
generate({ lowerCase: false, upperCase: false, numeric: false }); // => !%:#_#*&^!

generateMultiple

Create a random set of passwords

import { generateMultiple } from '@wcj/generate-password';

generateMultiple();
// [
//   'qK0#dQ3*gG', 'rQ1#lB0#kE', 'mO1#dH1_tQ', 'gE1$rE2)aJ',
//   'eR6#eJ5|qE', 'rP3!cH1)aK', 'iE0#dB2$iE', 'bC0&mI1#hB',
//   'kB0(eG1!lD', 'bA7>hE4)kA'
// ]
generateMultiple(2, { length: 8 }); // => [ 'aG6@aC2(', 'dH0{fQ0%' ]

validate

symbols pass with lowercase and uppercase letters, numbers and special characters

import { validate } from '@wcj/generate-password';

validate('qK0#dQ3*gG'); // => 4  Strong :) Now it's safe!
validate('n6[a3_f0$k'); // => 3  Medium level. Enter more symbols!
validate('aCaLlGfSgI'); // => 2  Very Weak! It's easy to crack!
validate('4020810127'); // => 1  It's easy to crack!
validate(); // => 0

Options

export declare const LOWERCASE = 'abcdefghijklmnopqrstuvwxyz';
export declare const UPPERCASE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
export declare const NUMERIC = '0123456789';
export declare const SPECIAL_CHARACTER = '!@#$%^&*()_+~`|}{\\[\\]:;?>,.<-=\\/';
export declare type Option = {
  /**
   * Integer, length of password.
   * @default 10
   */
  length?: number;
  /** Boolean, put lowercase in password */
  lowerCase?: boolean;
  /** Boolean, use uppercase letters in password. */
  upperCase?: boolean;
  /** Boolean, put numbers in password. */
  numeric?: boolean;
  /** Special characters */
  special?: boolean;
};
/** Create a random password */
export declare function generate(opts?: Option): string;
/** Create a random set of passwords */
export declare function generateMultiple(length?: number, opts?: Option): string[];
/**
 * symbols pass with lowercase and uppercase letters, numbers and special characters
 * @return [0~4]
 *
 * `4` Strong :) Now it's safe!
 * `3` Medium level. Enter more symbols!
 * `2` Very Weak! It's easy to crack!
 * `1` It's easy to crack!
 */
export declare function validate(password?: string): number;

Example

import React, { useState } from 'react';
import { generate } from '@wcj/generate-password';

const Demo = () => {
  const [lowerCase, setLowerCase] = useState(true);
  const [upperCase, setUpperCase] = useState(true);
  const [numeric, setNumeric] = useState(true);
  const [special, setSpecial] = useState(true);
  const [length, setLength] = useState(8);
  const opts = { lowerCase, upperCase, numeric, special, length };
  const [password, setPassword] = useState(generate(opts));
  return (
    <div>
      <div>{password}</div>
      <button onClick={() => setPassword(generate(opts))}>Generate Password</button>
      <div>
        <label>
          <input type="range" min="8" max="50" value={length} onChange={(evn) => setLength(Number(evn.target.value))} />{' '}
          {length} length of password.
        </label>
        <br />
        <label>
          <input type="checkbox" checked={lowerCase} onChange={() => setLowerCase(!lowerCase)} /> Lower Case
          Letter(a..z)
        </label>
        <br />
        <label>
          <input type="checkbox" checked={upperCase} onChange={() => setUpperCase(!upperCase)} /> Upper Case
          Letter(A..Z)
        </label>
        <br />
        <label>
          <input type="checkbox" checked={numeric} onChange={() => setNumeric(!numeric)} /> Number (0..9)
        </label>
        <br />
        <label>
          <input type="checkbox" checked={special} onChange={() => setSpecial(!special)} /> Special characters
        </label>
      </div>
    </div>
  );
};

export default Demo;

Development

npm install      # Install dependencies

npm run build    # Build packages
npm run start    # Run Website

cd core          # Enter the `core` folder
npm run watch
npm run test

Contributors

As always, thanks to our amazing contributors!

Made with action-contributors.

License

Licensed under the MIT License.

Comments
Releases(v1.0.3)
  • v1.0.3(Jun 24, 2022)

    No Dependencies npm package

    Comparing Changes: https://github.com/jaywcjlove/generate-password/compare/v1.0.2...v1.0.3

    • 💄 chore(deps): update dependency kkt to v7.2.0 ef96cdc
    • 💄 chore(deps): Update dependency prettier to ~2.7.0 (#4) 3d8d275 @renovate-bot
    • 📄 Create LICENSE 5dd2b58

    Documentation v1.0.3: https://raw.githack.com/jaywcjlove/generate-password/6aaf702/index.html

    npm i @wcj/[email protected]
    
    Source code(tar.gz)
    Source code(zip)
  • v1.0.2(Jun 12, 2022)

    No Dependencies npm package

    Comparing Changes: https://github.com/jaywcjlove/generate-password/compare/v1.0.1...v1.0.2

    • 🌍 website: add github corners. 50128de
    • 🌍 website: fix github corners url error. 893a7b3
    • 📖 doc: Update example. e593bab
    • 🐞 fix: rename umd filename generate-password.min.js 24e2e93
    • 📖 doc: Update document. 8690e24

    Documentation v1.0.2: https://raw.githack.com/jaywcjlove/generate-password/ac4d3de/index.html

    npm i @wcj/[email protected]
    
    Source code(tar.gz)
    Source code(zip)
  • v1.0.1(Jun 12, 2022)

    No Dependencies npm package

    Comparing Changes: https://github.com/jaywcjlove/generate-password/compare/v1.0.0...v1.0.1

    • 💄 chore: create coverage badges. 578d7b2
    • 📖 doc: Update README.md 0a7a753
    • 💄 chore: update workspace config. 3e4d8ff
    • 🎨 style: optimize generateMultiple method. 08ccebb
    • 💄 chore: update workspace config. 6d1eeca
    • 💄 chore: add generate contributors image. 0047133
    • 📖 doc: Update document. e72bda3

    Documentation v1.0.1: https://raw.githack.com/jaywcjlove/generate-password/5ee1a68/index.html

    npm i @wcj/[email protected]
    
    Source code(tar.gz)
    Source code(zip)
Owner
小弟调调™
(͡·̮̃·̃) 如今撸码,像是早上起来需要刷牙一样的习惯。
小弟调调™
Library for generating unique, repeatable book covers on the fly 📚

Covers by ReadShape Summary What is this? So. Books have covers, right? Well, yes, but actually no. Books are tricky business. If the book is self pub

null 67 Jan 3, 2023
Piccloud is a full-stack (Angular & Spring Boot) online image clipboard that lets you share images over the internet by generating a unique URL. Others can access the image via this URL.

Piccloud Piccloud is a full-stack application built with Angular & Spring Boot. It is an online image clipboard that lets you share images over the in

Olayinka Atobiloye 3 Dec 15, 2022
NFT Art Generator made to create random unique art and their metadeta for NFTS.

Welcome to HashLips ?? All the code in these repos was created and explained by HashLips on the main YouTube channel. To find out more please visit: ?

Haadi Raja 2 Dec 11, 2022
A tiny isomorphic fast function for generating a cryptographically random hex string.

ZeptoID A tiny isomorphic fast function for generating a cryptographically random hex string. Accoding to this calculator one would have to generate i

Fabio Spampinato 9 Oct 24, 2022
Generate colorful and temporarily identifiable SVGs with unique urls.

reptiles.dev Generate colorful and temporarily identifiable SVGs with unique urls.

Tim Mikeladze 7 Dec 6, 2022
An easy-to-use library to make your life easier when working with random numbers or random choices in javascript.

vrandom An easy-to-use library to make your life easier when working with random numbers or random choices in javascript. Table of contents Installati

Valerio Cipolla 1 Aug 16, 2022
jQuery plugin to encourage strong user passwords

Naked Password¶ ↑ Simple jQuery plugin to improve security on passwords. Usage¶ ↑ Naked password is extremely easy to use. All thats needed is for you

Platform45 307 Nov 3, 2022
A free & open source project to save your passwords, notes & credit cards

Free & open source project to save your passwords, notes & credit cards with a clean console UI with multiples features such as show information/create information/delete information

null 4 Aug 8, 2022
Fully undetected stealer (steals wallets, passwords, cookies, modifies discord client like piratestealer etc.)

doenerium (CURRENTLY NOT WORKING BECAUSE OF OBFUSCATION; fixing later) Fully undetected stealer (0/67) I obfuscated this to prevent my stuff being ski

doener 363 Nov 12, 2022
🏴‍☠️ steal saved browser passwords 🔐

Steal Password From Browser Steal Get username & password from Browser. (Now Only Windows) Install Download the windows installer(.msi) from release p

迷渡 21 Oct 28, 2022
Fully undetected grabber (grabs wallets, passwords, cookies, modifies discord client etc.)

⚔️ TurkoRat ??️ Telegram server: https://t.me/turcoflex Discord server: https://discord.gg/v6xwtcgrQ5 ?? 〢 Content ?? Setting up ⚔️ Features ?? Screen

turco 24 Dec 20, 2022
Generate a password based off user inputs with speed ⚡

speedy-speedy-password Generate a password based off user inputs with speed ⚡ Install NPM npm i speedy-speedy-password Yarn yarn add speedy-speedy-pa

Brayden 5 Feb 2, 2022
Generate a secured base32 one time password to authenticate your user! 🔐

Django SOTP ?? Generate a secured base32 one time password to authenticate your user! Case Study ?? Before I mention why you should use django-sotp in

アブラム (Abram) 36 Dec 22, 2022
Generate random ethereum wallets & private keys and then check if they match a wallet that contains some kind of balance, so that you can take it. In Node.js

Ethereum-Stealer Generate random ethereum wallets & private keys and then check if they match a wallet that contains some kind of balance, so that you

Michał 74 Dec 24, 2022
A js program generate random 12 words metamask mnemonic and check the balance in the account.

Metamask-Mnemonic-Brute-Force A js program random generate 12 words metamask mnemonic and check the balance in the account. Requirement ethers web3 bi

Xeift 30 Dec 25, 2022
A bot that generate random french proverb images and post them on Twitter.

Proverbot This repository contains the source code of a bot that generate random french proverb images and post them on Twitter. (Inspired by InspiroB

Angel Uriot 14 Dec 11, 2022
🎡 Generate a random number, a list of them, or a generator with optional configuration

random_number Generate a random number, a list of them, or a generator with optional configuration Usage import randomNumber from "https://deno.land/x

Eliaz Bobadilla 7 Aug 7, 2022
Satyam Sharma 3 Jul 8, 2022
This package generates a unique ID/String for different browsers. Like chrome, Firefox and any other browsers which supports canvas and audio Fingerprinting.

Broprint.js The world's easiest, smallest and powerful visitor identifier for browsers. This package generates a unique ID/String for different browse

Rajesh Royal 68 Dec 25, 2022