@@ -0,0 +1 @@ | |||
node_modules |
@@ -0,0 +1,5 @@ | |||
language: node_js | |||
node_js: | |||
- '6' | |||
- '5' | |||
- '4' |
@@ -0,0 +1,11 @@ | |||
<!-- CLICK "Preview" FOR INSTRUCTIONS IN A MORE READABLE FORMAT --> | |||
**Thank you for taking your time to fill out an issue.** | |||
To make it easier to manage, can you put this issue in LessPass super project ? | |||
https://github.com/lesspass/lesspass/issues | |||
:heart: | |||
Thanks |
@@ -0,0 +1,52 @@ | |||
#!/usr/bin/env node | |||
'use strict'; | |||
var meow = require('meow'); | |||
var lesspass = require('lesspass'); | |||
var cli = meow(` | |||
Usage | |||
$ lesspass <site> <login> <masterPassword> | |||
Options | |||
--lowercase, -l true or false (default true) | |||
--uppercase, -u true or false (default true) | |||
--symbols, -s true or false (default true) | |||
--numbers, -n true or false (default true) | |||
--length, -L int (default 12) | |||
--counter, -c int (default 1) | |||
Examples | |||
$ lesspass lesspass.com contact@lesspass.com 'my Master Password' --length=14 -s=false | |||
onAV7eqIM1arOZ | |||
`, { | |||
alias: { | |||
l: 'lowercase', | |||
u: 'uppercase', | |||
s: 'symbols', | |||
n: 'numbers', | |||
L: 'length', | |||
c: 'counter', | |||
} | |||
}); | |||
var lowercase = (cli.flags.lowercase || 'true').toLowerCase() === 'true'; | |||
var uppercase = (cli.flags.uppercase || 'true').toLowerCase() === 'true'; | |||
var symbols = (cli.flags.symbols || 'true').toLowerCase() === 'true'; | |||
var numbers = (cli.flags.numbers || 'true').toLowerCase() === 'true'; | |||
var site = cli.input[0]; | |||
var login = cli.input[1]; | |||
var masterPassword = cli.input[2]; | |||
var options = { | |||
counter: cli.flags.counter || 1, | |||
length: cli.flags.length || 12, | |||
lowercase: lowercase, | |||
uppercase: uppercase, | |||
numbers: numbers, | |||
symbols: symbols | |||
}; | |||
lesspass.encryptLogin(login, masterPassword).then(function (encryptedLogin) { | |||
var generatedPassword = lesspass.renderPassword(encryptedLogin, site, options); | |||
console.log(generatedPassword); | |||
}); |
@@ -0,0 +1,21 @@ | |||
The MIT License (MIT) | |||
Copyright (c) Guillaume Vincent <guillaume@oslab.fr> (guillaumevincent.com) | |||
Permission is hereby granted, free of charge, to any person obtaining a copy | |||
of this software and associated documentation files (the "Software"), to deal | |||
in the Software without restriction, including without limitation the rights | |||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |||
copies of the Software, and to permit persons to whom the Software is | |||
furnished to do so, subject to the following conditions: | |||
The above copyright notice and this permission notice shall be included in | |||
all copies or substantial portions of the Software. | |||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | |||
THE SOFTWARE. |
@@ -0,0 +1,34 @@ | |||
{ | |||
"name": "lesspass-cli", | |||
"version": "0.0.0", | |||
"description": "build LessPass passwords directly in command line", | |||
"license": "MIT", | |||
"repository": "lesspass/cli", | |||
"author": "Guillaume Vincent <guillaume@oslab.fr>", | |||
"bin": { | |||
"lesspass": "cli.js" | |||
}, | |||
"engines": { | |||
"node": ">=4" | |||
}, | |||
"scripts": { | |||
"test": "ava" | |||
}, | |||
"files": [ | |||
"cli.js" | |||
], | |||
"keywords": [ | |||
"cli-app", | |||
"cli", | |||
"password", | |||
"lesspass" | |||
], | |||
"dependencies": { | |||
"lesspass": "^4.0.4", | |||
"meow": "^3.3.0" | |||
}, | |||
"devDependencies": { | |||
"ava": "^0.16.0", | |||
"execa": "^0.5.0" | |||
} | |||
} |
@@ -0,0 +1,49 @@ | |||
> build LessPass passwords directly in command line with nodejs | |||
## Install | |||
``` | |||
$ npm install --global lesspass-cli | |||
``` | |||
## Usage | |||
``` | |||
$ lesspass --help | |||
build LessPass passwords directly in command line | |||
Usage | |||
$ lesspass <site> <login> <masterPassword> | |||
Options | |||
--lowercase, -l true or false (default true) | |||
--uppercase, -u true or false (default true) | |||
--symbols, -s true or false (default true) | |||
--numbers, -n true or false (default true) | |||
--length, -L int (default 12) | |||
--counter, -c int (default 1) | |||
Examples | |||
$ lesspass lesspass.com contact@lesspass.com 'my Master Password' --length=14 -s=false | |||
onAV7eqIM1arOZ | |||
``` | |||
## FAQ | |||
How can I generate a password if I have a quote (`'`) in my master password ? | |||
Escape the quote like this : | |||
lesspass lesspass.com contact@lesspass.com 'my parents'\'' house is great' | |||
Replace `'` by `'\''` | |||
## License | |||
MIT © [Guillaume Vincent](http://guillaumevincent.com) |
@@ -0,0 +1,81 @@ | |||
import test from 'ava'; | |||
import execa from 'execa'; | |||
test('default options', async t => { | |||
const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password']); | |||
t.is(stdout, 'azYS7,olOL2]'); | |||
}); | |||
test('length', async t => { | |||
const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '--length=14']); | |||
t.is(stdout, 'azYS7,olOL2]iz'); | |||
}); | |||
test('length shortcut', async t => { | |||
const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '-L=14']); | |||
t.is(stdout, 'azYS7,olOL2]iz'); | |||
}); | |||
test('counter', async t => { | |||
const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '--counter=2']); | |||
t.is(stdout, 'obYT2=olOV9='); | |||
}); | |||
test('counter shortcut', async t => { | |||
const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '-c=2']); | |||
t.is(stdout, 'obYT2=olOV9='); | |||
}); | |||
test('no lowercase', async t => { | |||
const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '--lowercase=false']); | |||
t.is(stdout, 'AZ3[EQ7@OL2]'); | |||
}); | |||
test('no lowercase shortcut', async t => { | |||
const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '-l=false']); | |||
t.is(stdout, 'AZ3[EQ7@OL2]'); | |||
}); | |||
test('boolean option case insensitive', async t => { | |||
const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '--lowercase=FalSe']); | |||
t.is(stdout, 'AZ3[EQ7@OL2]'); | |||
}); | |||
test('boolean option case insensitive', async t => { | |||
const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '--lowercase=TrUe']); | |||
t.is(stdout, 'azYS7,olOL2]'); | |||
}); | |||
test('no uppercase', async t => { | |||
const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '--uppercase=false']); | |||
t.is(stdout, 'az3[eq7@ol2]'); | |||
}); | |||
test('no uppercase shortcut', async t => { | |||
const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '-u=false']); | |||
t.is(stdout, 'az3[eq7@ol2]'); | |||
}); | |||
test('no numbers', async t => { | |||
const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '--numbers=false']); | |||
t.is(stdout, 'azYS&uwAW@at'); | |||
}); | |||
test('no numbers shortcut', async t => { | |||
const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '-n=false']); | |||
t.is(stdout, 'azYS&uwAW@at'); | |||
}); | |||
test('no symbols', async t => { | |||
const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '--symbols=false']); | |||
t.is(stdout, 'azYS7uwAW8at'); | |||
}); | |||
test('no symbols shortcut', async t => { | |||
const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'password', '-s=false']); | |||
t.is(stdout, 'azYS7uwAW8at'); | |||
}); | |||
test('test space in password', async t => { | |||
const {stdout} = await execa('./cli.js', ['lesspass.com', 'contact@lesspass.com', 'my Master Password']); | |||
t.is(stdout, 'onAV7&uvEC2='); | |||
}); |