Skip to content

Commit

Permalink
v0.3.0: CLI available
Browse files Browse the repository at this point in the history
  • Loading branch information
nicjansma committed Feb 13, 2020
1 parent 11a3bc6 commit e2d40b7
Show file tree
Hide file tree
Showing 7 changed files with 5,075 additions and 8 deletions.
30 changes: 27 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# saltthepass.js

v0.2.2
v0.3.0

Copyright 2017 Nic Jansma
Copyright 2020 Nic Jansma

http://nicj.net

Expand Down Expand Up @@ -42,7 +42,9 @@ Please see [SaltThePass.com](https://saltthepass.com/) for a description of how/
saltthepass.js depends on the [CryptoJS library](http://code.google.com/p/crypto-js/). SaltThePass is tested to work
with CryptoJS v3.1.2, which can be installed via the bower `cryptojslib` package.

You will need to load the following CryptoJS modules in this order prior to using `saltthepass.js`, if not using one of
When using the NPM package, CryptoJS is a package dependency.

If using this in the browser, you will need to load the following CryptoJS modules in this order prior to using `saltthepass.js`, if not using one of
the pre-built versions in `dist/` such as `saltthepass.withdeps.js` or `saltthepass.withdeps.min.js`:

* crypto-js/core
Expand Down Expand Up @@ -107,6 +109,27 @@ var saltthepass = require('saltthepass');
var saltedPassword = saltthepass.saltthepass('md5', 'mypassword', 'mydomain', 'myphrase');
```

### Command Line

You can install `saltthepass` as a command-line program via NPM:

npm install -g saltthepass

```shell
> saltthepass
Options:
--hash, -h Name of the hash, e.g. md5
[choices: "md5", "sha1", "sha2", "sha3", "ripemd160"] [default: "md5"]
--password, -p Master Password [required]
--domain, -d Domain Name [required]
--phrase, -r Domain phrase
--help Show help [boolean]
--version Show version number [boolean]

> saltthepass -h sha3 -p password -d domain -r phrase
_PwlhSzK8_Q1M73_woHVXi-f_-hQJ_ht8_SCx6KvOdKiMSaqmV4Dhagf-toiMIqsvW04gJkGWU9eGAuyDQtvzw
```

### Examples

#### Using SaltThePass
Expand Down Expand Up @@ -322,3 +345,4 @@ The tests can also be run in a web browser:
* v0.2.0 - 2013-07-16: `DomainNameRule` and `standardizeDomain()` added.
* v0.2.1 - 2013-07-17: `DomainNameRule.validregex` added
* v0.2.2 - 2013-07-17: `DomainNameRule.validregex` and `DomainNameRule.regex` are case-sensitive now
* v0.3.0 - 2020-02-12: CLI available
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "saltthepass.js",
"version": "0.2.2",
"version": "0.3.0",
"authors": [
"Nic Jansma <nic@nicj.net>"
],
Expand Down
44 changes: 44 additions & 0 deletions cli.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env node
/* eslint-env node */
/* eslint-disable no-console, no-implicit-globals */
//
// Imports
//
var yargs = require("yargs");
var SaltThePass = require("./src/saltthepass");
var hashes = SaltThePass.getHashes();

//
// Command-line args
//
var argv = yargs
.option("hash", {
alias: "h",
desc: "Name of the hash, e.g. md5",
default: "md5",
choices: hashes,
requiresArg: true
})
.option("password", {
alias: "p",
desc: "Master Password",
demandOption: true,
requiresArg: true
})
.option("domain", {
alias: "d",
desc: "Domain Name",
demandOption: true,
requiresArg: true
})
.option("phrase", {
alias: "r",
desc: "Domain phrase",
requiresArg: true
})
.help()
.strict()
.version()
.argv;

console.log(SaltThePass.saltthepass(argv.hash, argv.password, argv.domain, argv.phrase));
2 changes: 1 addition & 1 deletion dist/saltthepass.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/saltthepass.withdeps.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit e2d40b7

Please sign in to comment.