Merge branch 'main' of github.com:dmuth/diceware into main

This commit is contained in:
Douglas Muth 2021-07-23 20:18:53 -04:00
commit 873cd43e1c
11 changed files with 4297 additions and 2568 deletions

3
.gitattributes vendored Normal file
View file

@ -0,0 +1,3 @@
src/index.js ident

3
.github/FUNDING.yml vendored Normal file
View file

@ -0,0 +1,3 @@
# These are supported funding model platforms
ko_fi: dmuth

View file

@ -1,10 +1,11 @@
language: node_js language: node_js
node_js: node_js:
- "6"
- "8"
- "9"
- "lts/*" - "lts/*"
- "15"
- "14"
- "13"
- "12"
# #
# Cache the node_modules directory # Cache the node_modules directory

View file

@ -1,8 +1,9 @@
# Diceware # Diceware
Current build/test status in Travis CI: [![Build Status](https://travis-ci.org/dmuth/diceware.svg?branch=master)](https://travis-ci.org/dmuth/diceware) <img src="./dice.jpg" width="250" align="right" />
Current build/test status in Travis CI: [![Build Status](https://travis-ci.org/dmuth/diceware.svg?branch=main)](https://travis-ci.org/dmuth/diceware)
First, feel free to check out the live demo, running at [https://www.dmuth.org/diceware/](https://www.dmuth.org/diceware/) First, feel free to check out the live demo, running at [https://diceware.dmuth.org/](https://diceware.dmuth.org/)
Weak passwords are a big flaw in computer security due to a lack of "entropy" or randomness. For example, how many times have you used the name of a pet or relative or street in a password, or perhaps the number "1". Not very random, is it? :-) Worse still, if passwords are reused between services, that increases your security risk. Weak passwords are a big flaw in computer security due to a lack of "entropy" or randomness. For example, how many times have you used the name of a pet or relative or street in a password, or perhaps the number "1". Not very random, is it? :-) Worse still, if passwords are reused between services, that increases your security risk.
@ -21,7 +22,7 @@ For more information on Diceware:
Yes. Feel free to clone this repo with `git clone https://github.com/dmuth/diceware.git` and run it Yes. Feel free to clone this repo with `git clone https://github.com/dmuth/diceware.git` and run it
from a local directory on your computer. from a local directory on your computer.
You can also set up a webserver on Mac/Linux boxes by running `python -m SimpleHTTPServer 8000`. You can also set up a webserver on Mac/Linux boxes by running `python3 -m http.server 8000`.
You will then able to access DiceWare at http://localhost:8000/. You will then able to access DiceWare at http://localhost:8000/.
@ -52,13 +53,26 @@ design feature of this app--I want it to be as easy to get up and running as pos
A local webserver can be set up by running `npm install http-server -g` to install it, then `http-server` to listen on http://localhost:8080/ A local webserver can be set up by running `npm install http-server -g` to install it, then `http-server` to listen on http://localhost:8080/
In summary: ## In summary:
- `npp run clean` - Cleanup after a previous run
- `npm install` - Install NPM packages used by Diceware - `npm install` - Install NPM packages used by Diceware
- `webpack --watch --mode development` - Pack Javscript files - `npm run dev-build` - Run webpack to pack Javascript files and watch for changes.
- `http-server` - `http-server`
- `vim src/lib.js src/index.js`
- `rm -fv src/index.js && git co src/index.js` - Get the new SHA1 hash that will be displayed in debug messages.
- `npm test` - Make sure you didn't break any of the core logic! - `npm test` - Make sure you didn't break any of the core logic!
- `webpack` - Pack Javscript files in production mode (smaller file but takes longer) - `npm run build` - Webpack Javscript files in production mode (smaller file but takes longer)
- `./go-sync-to-s3.sh` - Do this if you're me, to upload to S3. If you're not me, you'll need to do something else, or possibly nothing at all.
## In practice:
- `npm run clean; npm run dev-build` - Run webpack in dev mode while working on Javascript
- `http-server` - Stand up a local HTTP server
- `vim src/lib.js src/index.js`
- `rm -fv src/index.js && git co src/index.js`
- `npm run clean; npm run build` - Run webpack in prod mode to produce final Javascript bundle
- `./go-sync-to-s3.sh` - Do this if you're me, to upload to S3. If you're not me, you'll need to do something else, or possibly nothing at all. - `./go-sync-to-s3.sh` - Do this if you're me, to upload to S3. If you're not me, you'll need to do something else, or possibly nothing at all.
@ -69,7 +83,7 @@ My name is Douglas Muth, and I am a software engineer in Philadelphia, PA.
There are several ways to get in touch with me: There are several ways to get in touch with me:
- Email to doug.muth AT gmail DOT com or dmuth AT dmuth DOT org - Email to doug.muth AT gmail DOT com or dmuth AT dmuth DOT org
- [Facebook](https://facebook.com/dmuth) and [Twitter](http://twitter.com/dmuth) - [Facebook](https://facebook.com/dmuth) and [Twitter](http://twitter.com/dmuth)
- [LinkedIn](http://localhost:8080/www.linkedin.com/in/dmuth) - [LinkedIn](https://linkedin.com/in/dmuth)
Feel free to reach out to me if you have any comments, suggestions, or bug reports. Feel free to reach out to me if you have any comments, suggestions, or bug reports.

10
dist/bundle.js vendored

File diff suppressed because one or more lines are too long

35
dist/bundle.js.LICENSE.txt vendored Normal file
View file

@ -0,0 +1,35 @@
/* @preserve
* The MIT License (MIT)
*
* Copyright (c) 2013-2018 Petka Antonov
*
* 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.
*
*/
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */

View file

@ -163,7 +163,7 @@
Weak passwords are a big flaw in computer security due to a lack of "entropy" Weak passwords are a big flaw in computer security due to a lack of "entropy"
or randomness. For example, how many times have you used the name of a pet or relative or street or randomness. For example, how many times have you used the name of a pet or relative or street
in a password, or perhaps the number "1"? Not very random, is it? :-) in a password, or perhaps the number "1"? Not very random, is it? 😃
Worse still, if Worse still, if
passwords are reused between services, <a href="http://www.businessinsider.com/biggest-password-mistake-2014-8" passwords are reused between services, <a href="http://www.businessinsider.com/biggest-password-mistake-2014-8"
>that increases your security risk</a>. This is not theoretical, <a href="http://www.techspot.com/news/65255-hackers-access-github-accounts-reusing-passwords-previous-leaks.html" >that increases your security risk</a>. This is not theoretical, <a href="http://www.techspot.com/news/65255-hackers-access-github-accounts-reusing-passwords-previous-leaks.html"
@ -340,13 +340,12 @@ There are several ways to get in touch with me:
<li><a href="https://github.com/dmuth/diceware/issues">Opening an Issue in GitHub</a> <li><a href="https://github.com/dmuth/diceware/issues">Opening an Issue in GitHub</a>
</ul> </ul>
Feel free to reach out to me if you have any comments, suggestions, bug reports, or wish to buy me a beer. :-) Feel free to reach out to me if you have any comments, suggestions, bug reports, or wish to buy me a beer. 😃🍻
<br/> <br/>
<br/> <br/>
<br/> <br/>
<br/> <br/>
</div> </div>
</div> </div>

6716
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -7,7 +7,10 @@
"test": "tests" "test": "tests"
}, },
"scripts": { "scripts": {
"test": "mocha ./tests/test.js" "test": "mocha ./tests/test.js",
"clean": "rm -rfv dist/*bundle.js* node_modules package-lock.json",
"build": "npm install; webpack --mode production",
"dev-build": "npm install; webpack --watch --mode development"
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -21,12 +24,17 @@
}, },
"homepage": "https://github.com/dmuth/diceware#readme", "homepage": "https://github.com/dmuth/diceware#readme",
"devDependencies": { "devDependencies": {
"mocha": "^4.0.1", "mocha": "^8.3.2",
"should": "^13.1.3", "should": "^13.1.3",
"webpack": "^3.8.1" "webpack": "^5.25.0",
"webpack-cli": "^4.5.0"
}, },
"dependencies": { "dependencies": {
"bluebird": "^3.5.1", "buffer": "^6.0.3",
"random-number-csprng": "^1.0.2" "crypto-browserify": "^3.12.0",
"process": "^0.11.10",
"random-number-csprng": "^1.0.2",
"stream-browserify": "^3.0.0",
"vm-browserify": "^1.1.2"
} }
} }

View file

@ -175,7 +175,7 @@ Diceware.is_mobile = function() {
/** /**
* Do some preliminary work, such as clearing out results and scrolling. * Do some preliminary work, such as clearing out results and scrolling.
*/ */
Diceware.rollDiceHanlderPre = function() { Diceware.rollDiceHandlerPre = function() {
// //
// Clear out more space when mobile // Clear out more space when mobile
@ -212,7 +212,12 @@ Diceware.rollDiceHanlderPre = function() {
*/ */
Diceware.rollDiceHandler = function(e) { Diceware.rollDiceHandler = function(e) {
Diceware.rollDiceHanlderPre(); //
// Disable our button while generating results
//
jQuery("#roll_dice").prop("disabled", true);
Diceware.rollDiceHandlerPre();
// //
// Make our dice rolls // Make our dice rolls
@ -250,7 +255,7 @@ Diceware.rollDiceHandler = function(e) {
}); });
Diceware.rollDiceHanlderPost(rolls, passphrase, num_passwords); Diceware.rollDiceHandlerPost(rolls, passphrase, num_passwords);
}); });
@ -260,7 +265,7 @@ Diceware.rollDiceHandler = function(e) {
/** /**
* Our post work, of displaying the results of our dice rolls. * Our post work, of displaying the results of our dice rolls.
*/ */
Diceware.rollDiceHanlderPost = function(rolls, passphrase, num_passwords) { Diceware.rollDiceHandlerPost = function(rolls, passphrase, num_passwords) {
// //
// Populate our results by cloning the hidden base rows which // Populate our results by cloning the hidden base rows which
@ -335,13 +340,21 @@ Diceware.rollDiceHanlderPost = function(rolls, passphrase, num_passwords) {
// //
var height = jQuery(".results").height(); var height = jQuery(".results").height();
jQuery(".results").css("height", "auto"); jQuery(".results").css("height", "auto");
var new_height = jQuery(".results").height(); var new_height = jQuery(".results").height();
jQuery(".results").height(height); jQuery(".results").height(height);
jQuery(".results").animate({height: new_height}, 400); jQuery(".results").animate({height: new_height}, 400);
//
// All done with our results, re-enable the button!
//
jQuery("#roll_dice").prop("disabled", false);
}); });
}); });
} // End of rollDiceHandlerPost() } // End of rollDiceHandlerPost()
@ -385,6 +398,8 @@ Diceware.go = function() {
console.log("Thanks for checking out my code! You can find the Git repo at https://github.com/dmuth/diceware, my blog at https://www.dmuth.org/, or you can bug me on Twitter at https://twitter.com/dmuth"); console.log("Thanks for checking out my code! You can find the Git repo at https://github.com/dmuth/diceware, my blog at https://www.dmuth.org/, or you can bug me on Twitter at https://twitter.com/dmuth");
console.log("TEST2: $Id$");
Diceware.get_data = Diceware.extractGetData(location.search); Diceware.get_data = Diceware.extractGetData(location.search);
console.log("GET Data: " + JSON.stringify(Diceware.get_data)); // Debugging console.log("GET Data: " + JSON.stringify(Diceware.get_data)); // Debugging

View file

@ -4,6 +4,8 @@
// //
var path = require('path'); var path = require('path');
const webpack = require('webpack')
// //
// Compile main.js (and its dependencies) into dist/bundle.js. // Compile main.js (and its dependencies) into dist/bundle.js.
// //
@ -12,6 +14,19 @@ module.exports = {
output: { output: {
filename: 'bundle.js', filename: 'bundle.js',
path: path.resolve(__dirname, 'dist') path: path.resolve(__dirname, 'dist')
} },
resolve: {
fallback: {
"crypto": require.resolve("crypto-browserify"),
"stream": require.resolve("stream-browserify"),
"vm": require.resolve("vm-browserify")
}
},
plugins: [
new webpack.ProvidePlugin({
Buffer: ['buffer', 'Buffer'],
process: 'process/browser.js'
})
]
}; };