npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

keys-to-password

v1.2.4

Published

Generate and recover passwords from private and public keys.

Downloads

37

Readme

keys-to-password

Generate and recover passwords via private and public keys.

Features

  • Use of the private and public key concept to secure password recovery only by the private key owner.
  • Generate passwords with unlimited length.
  • Randomly generate passwords.
  • Password can be modified easily in advance (see examples below).
  • Option for using patterns (see more details below).

Browser Support

| | | | | --- | --- | --- | --- | --- | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ | Latest ✔ |

Installation

npm i keys-to-password

yarn add keys-to-password

import

CommonJS

const { Password } = require("keys-to-password");

ES6

import { Password } from "keys-to-password";

Default usage

const password = new Password("your-private-key");
password.setKeyboard(); // Password can contain all keyboard characters
password.generate(); // Default password-length = 12
password.getPassword(); // => '?gj39?GdA_gkf'

const publicKey = password.getPublicKey(); // save into user storage
const passwordRecover = new Password("your-private-key", publicKey);
passwordRecover.setKeyboard();
passwordRecover.generate();
passwordRecover.getPassword(); // => '?gj39?GdA_gkf'

Visual Demonstration Of The Package Concept

Generic example

1) Generate password

const password = new Password("your-private-key");
password.setKeyboard();
password.generate({ passLength: 20 });
password.getPassword(); // => 'QS'-Z+8Z,:^1c%56`6h7'

2) Get password's public-key from the generated password

const publicKey = password.getPublicKey();

3) Recover password by the private and public keys

const passwordRecover = new Password("your-private-key", publicKey);
passwordRecover.setKeyboard();
passwordRecover.generate({ passLength: 20 });

4) Retrieve the password

passwordRecover.getPassword(); // => 'QS'-Z+8Z,:^1c%56`6h7'

Modify password using arguments

1) Modify keyboard

const password = new Password('your-private-key');
// The keyboard holds the characters from which you can generate passwords
const keyboardConfig = {
    avoidChars: "1a$",  // Characters 1,a,$ will not be in the generated password
    isContainDigits: true,
    isContainUpperCase: false, // Uppercase letters will not be in the generated password
    isContainLowerCase: true,
    isContainSymbols: true,
    mustContainChars: "d3", // Assign d,3 characters to the keyboard
}

password.setKeyboard(keyboardConfig);

2) Extra generation options

const generateConfig = {
  passLength: 20,
  passStartsWith: "abc", // Generated password will start with the string 'abc'
  passEndsWidth: "xyz" // Generated password will end with the string 'abc'
}

password.generate(generateConfig);

3) Retrieve the password

password.getPassword(); // => 'abc3s:#dfs$2kl~d3xyz'

4) To recover your password keep your config objects as well as your public-key stored

const publicKey = password.getPublicKey();

5) Recover the password

const passwordRecover = new Password("your-private-key", publicKey);
passwordRecover.setKeyboard(keyboardConfig);
passwordRecover.generate(generateConfig);
passwordRecover.getPassword(); // => 'abc3s:#dfs$2kl~d3xyz'

Modify password using pattern function only

const password = new Password("your-private-key");
password.generateFromPattern("A_\\d{10}-PASS");
password.getPassword(); // => 'A_2563495820-PASS'
  • To recover your password keep your pattern string as well as your public-key stored.

Pattern's syntax options:

  • All keyboard characters.
  • \d{n} => assign n digits.
  • \u{n} => assign n uppercase letters.
  • \l{n} => assign n lowercase letters.
  • \s{n} => assign n symbol characters.