Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nicepass

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nicepass - npm Package Compare versions

Comparing version 1.0.1 to 2.0.0

63

cli.js

@@ -8,41 +8,50 @@ #!/usr/bin/env node

Usage
$ nicepass <size> [...]
$ nicepass <number|hex|phrase>
Options
--passphrase Convert a phrase back into the original byte array
--pretty Output the result as a string
Examples
$ nicepass
[ 'plummet', 'observed', 'electra', 'dripping' ]
$ nicepass 8
plummet observed electra dripping
$ nicepass --passphrase='selfheal katzenjammer ambidexterity correcter puffer discern'
<Buffer c5 a5 75 a0 03 fd 2b ea ac bc 3a 65>
`, {
boolean: 'pretty'
});
$ nicepass 05bd809ef433872f
annoying malleably vapory mirk
$ nicepass 'wigglier singing bicyclist clasher barrow haltering twirler asap'
fba4cb24113123240d975fcfea1d085d
`);
const input = cli.input[0];
try {
if (cli.flags.passphrase) {
const str = cli.flags.passphrase.replace(/['"]+/g, '');
console.log(niceware.passphraseToBytes(str.split(' ')));
if (!input || typeof input === 'number') {
const size = input || 8;
const arr = niceware.generatePassphrase(size);
console.log(arr.join(' '));
} else {
let size = 8;
const arr = input.split(' ');
if (cli.input.length > 0) {
size = cli.input[0];
if (arr.length === 1) {
const str = input.toLowerCase().replace(/[,\s]/g, '');
const buffer = Buffer.from(str, 'hex');
const arr = niceware.bytesToPassphrase(buffer);
if (typeof size === 'string') {
throw new TypeError('Expected a number');
}
}
console.log(arr.join(' '));
const passphrase = niceware.generatePassphrase(size);
} else {
const str = input.toLowerCase().replace(/['"]+/g, '');
const byteArray = niceware.passphraseToBytes(str.split(' '));
let output = '';
if (cli.flags.pretty) {
console.log(passphrase.join(' '));
for (let i = 0, j = byteArray.length; i < j; i++) {
let char = byteArray[i].toString(16);
} else {
console.log(passphrase);
if (char.length === 1) {
char = `0${char}`;
}
output += char;
}
console.log(output);
}

@@ -49,0 +58,0 @@ }

{
"name": "nicepass",
"version": "1.0.1",
"version": "2.0.0",
"description": "Generate human-readable passphrases",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -5,3 +5,3 @@ # nicepass [![Build Status](https://travis-ci.org/awcross/nicepass.svg?branch=master)](https://travis-ci.org/awcross/nicepass)

Uses [niceware](https://github.com/diracdeltas/niceware) underneath to generate or convert random bytes into passphrases.
This is a CLI that uses [niceware](https://github.com/diracdeltas/niceware) to generate readable passwords or convert random bytes into a passphrase.

@@ -22,25 +22,23 @@

Usage
$ nicepass <size> [...]
$ nicepass <number|hex|phrase>
Options
--passphrase Convert a phrase back into the original byte array
--pretty Output the result as a string
Examples
$ nicepass
[ 'plummet', 'observed', 'electra', 'dripping' ]
$ nicepass 8
plummet observed electra dripping
$ nicepass --passphrase='selfheal katzenjammer ambidexterity correcter puffer discern'
<Buffer c5 a5 75 a0 03 fd 2b ea ac bc 3a 65>
$ nicepass 05bd809ef433872f
annoying malleably vapory mirk
$ nicepass 'wigglier singing bicyclist clasher barrow haltering twirler asap'
fba4cb24113123240d975fcfea1d085d
```
## Related
## Thanks
- [niceware](https://github.com/diracdeltas/niceware) - API for this module
All credit goes to [yan](https://diracdeltas.github.io/) for creating [niceware](https://github.com/diracdeltas/niceware), the API for this module.
## License
MIT © [Alex Cross](http://alexcross.io)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc