Coder Social home page Coder Social logo

philipmw / phrase.shop Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 3.0 3.79 MB

A web app to generate secure yet memorable passphrases

Home Page: https://phrase.shop

License: MIT License

JavaScript 0.71% TypeScript 98.93% Shell 0.36%
passphrase-generator dice entropy hacktoberfest

phrase.shop's Introduction

phrase.shop

phrase.shop is a web app to generate secure yet memorable passphrases.

Purpose and inspiration

Features

While there are several passphrase generators online, this one has the following strengths:

  • It aims to make phrases grammatically correct, not just words strung together.
  • You can make the phrase more or less complex. You are not limited to five rolls of six-sided dice.
  • It uses Voice Of America's Learning English vocabulary of core English words.
  • If you don’t want to use your computer’s random number generator, you can roll physical dice and submit the rolls to the app to collect entropy. There’s a progress bar showing how much entropy you’ve collected, and you can generate the passphrase only once you’ve rolled enough times. What this feature lacks in practicality it makes up for in educational and entertainment value!
  • The app is open-source, and contributions are welcome.
  • The app's only motivations is making you good passphrases. Its only customer is you. There are no ads and no data collection.

Design principles

  • Strong passphrases are for everyone, including those who don't care about or understand entropy, and including those with limited English.
  • App is engaging and educational for those who understand, or want to learn, about entropy.
  • Shop theme: you are buying passphrase components, paying for them with entropy.

Dice

While any modern computer's randomness is just fine, using physical dice is more fun.

I like hexadecimal (16-sided) dice from Gamescience. I have three of these, bought specifically for this project. I roll all three at a time, for 12 bits of entropy per roll. This makes generating even the longest passphrase a breeze.

Gamescience also sells a 100-sided monster of a dice, which would yield a massive 6 bits of entropy per roll.

Developing

Continuous Integration status Coverage status

I welcome your contributions. In particular, I'm very supportive of newbie developers.

This app is written in TypeScript and uses Preact as the web framework. For unit tests, it uses Jest and Enzyme.

If you are new to developing web applications, I recommend the book Test-Driven React, which will introduce you to React, Jest, Enzyme, and Wallaby.js.

The workflow I propose:

  1. Decide what to work on. There are a number of open issues that you're welcome to resolve, or you can scratch your own itch. Before starting development, please open an issue for your desired change so we can discuss it and align on whether it needs to be addressed and how to address it. If you don't lead with an issue, you risk wasting your time developing something I'll disagree with and won't accept.

  2. Work on your changes. See next sections for how to run this project locally.

  3. Run npm run build before submitting a pull request and resolve any linter and unit test errors.

  4. Submit a pull request on GitHub. Check that your change passes the Continuous Integration workflow. I'll review your contribution, and we'll either have a discussion, or I'll accept your change as-is.

  5. You'll see your contribution on https://phrase.shop!

UX flow

flowchart TB
    init([App start])
    generating[/Generating.../]
    viewResult(View generated passphrase)

    init-->generating
    generating-- consume entropy -->viewResult
    viewResult-- change/seed entropy -->viewResult
    viewResult-- change complexity -->generating

UI component architecture

classDiagram

class App {
  entropyBitsAvailable
  entropySource
  phraseParts
}

class PhrasePartUi {
  type
}

class PhraseStruct {
  phraseParts
  order
  dependencyTree
}

App o-- PhrasePartUi

Running phrase.shop locally

Install npm using whatever means is most convenient for you, such as Homebrew on macOS.

Initialize:

$ npm install

This creates a node_modules directory.

Run unit tests:

$ npm test

Run the app locally:

$ npm start

This supports hot-reloading, so feel free to edit Javascript and see your changes in the browser immediately.

Run linter and generate final artifacts:

$ npm run build

This produces the app bundle Javascript, in ./docs, that's served to real customers. If any part of this process fails, please fix any issues before submitting a pull request.

why some things are the way they are

React/TS template

The React/TS template for this web app came from https://github.com/philipmw/spa-template.

favicon

I made the favicon with Inkscape 1.0, with all the creativity that I could muster.

phrase.shop's People

Contributors

charliewhiskeypapa avatar philipmw avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

phrase.shop's Issues

Find a way to incorporate capital letters into phrase

Capital letters are required for many passphrases, but phrase.shop's attitude toward that is, "just capitalize it yourself." But maybe customers want a capitalized phrase delivered?

Some options are to randomly capitalize the start of each word, to randomly capitalize the first word, or even randomly capitalize any letter.

Persisting/clearing policy for generated phrases

Right now, the app displays the last generated phrase indefinitely, but it does not persist it in any local storage.

This means we don't control if/when the phrase disappears from the customer. It depends on the browser. For mobile devices, it depends on memory pressure.

The customer may want us to clear the phrase more aggressively. They can already close the tab/window, but maybe they forgot and hand the device to someone else who can unintentionally see the phrase.

Or the customer may want us to be conservative and persist the phrase until they explicitly clear it. I've had it happen that I generate a phrase, set it as the password on an important system, then forget it-- and it was already gone by then.

I see three possible approaches:

  1. Clear phrase after X time (optimize for security).
  2. Keep current behavior. Let the browser manage it. (optimize for simplicity).
  3. Persist phrase in local storage until explicit customer action. (optimize for data integrity).

I don't have a clear answer.

Set up a canary

Set up a canary to alert me if the site ever goes down or breaks.

Improve verb conjugation

Today, making a verb plural uses a home-brewed algorithm that's often wrong. Wrong pluralization is confusing, distracting, and makes phrases less readable and memorable.

I do not want to rely on a 3rd party library (or worse, a service) to pluralize, since phrase.shop has minimal dependencies today and that's a virtue.

Let's also consider other conjugations for verbs, to make phrases more expressive and increase entropy.

Saved parts

I would like to be able to create my own custom preset

It would appear that an update has removed the ability to choose your own parts
I would like the ability to choose my own and then save that set of parts as a custom preset

So where there are currently 3 buttons, a fourth choice could be added for the user's custom preset that could be used when returning to the site

Add support for light mode and dark mode

Right now the app is very dark, which is good for dark mode, but maybe not so good for light mode. Let's have two styles, one for light and one for dark modes.

Incorporate favicon into UI

For brand recognition, let's put the favicon into the UI somehow. My latest thinking is to put it into the buttons.

Remember phrase configuration

Once I configure my perfect <verb> <noun> <digit> <digit> <adjective> <noun>, I want the app to remember this, or I want to be able to bookmark this configuration.

Conjugate words

Now: <noun> <verb> => fish defeat

Wanted: <noun> <verb> => fish defeats or fish defeated

This will improve memorability.

Improve the dark UI

The UI right now looks very high contrast and alarming. I have some ideas for how to improve it.

Improve SEO

  1. Add an H1 tag
  2. Add sitemap.xml (how)
  3. Lengthen TITLE tag
  4. Lengthen meta description to 70--320 characters
  5. Add robots.txt

Don't jerk UI during animation

Right now, while the phrase is animating, everything below it (disabled buttons, text) is jumping around. This is especially pronounced on mobile.

Redesign the UI so there is no jerking. One idea is to fade out everything below the animation, then bring it back once the animation is done.

Improve color-coding of phrase parts

Right now almost all parts of phrase are black, except for color type which is intense blue.

Let's give subtle coloring to nouns vs verbs to cue the reader to understand phrases easier that have ambiguous words.

Ability to type dice values

It can become tedious to manually enter each dice value with a click on a button.
Especially when those first 6 dice have icons that are very hard to see without squinting.

Please add a text entry box that allows multiple dice values to be entered at once using a space or comma etc, to separate the values.

This way a user can throw multiple dice and type the values instead of matching them to values on a screen that need to be clicked (it's more optimized to enter them on a keyboard where the user may already know the positions of the keys such as the Numpad)

Additionally, they could potentially copy and paste the values from a premade CSV string of their dice results - making it much faster to enter dice rolls as opposed to generated ones (making it less likely a user will choose the generated option for convenience reasons - which is less secure)

During animation, mask all final plaintext

Right now, during phrase animation, sometimes real plaintext shines through. The real plaintext is visually distinct from animation temp plaintext, so it is distracting. Plus we don't want to reveal the plaintext til animation is finished.

This seems to happen in the beginning of animation and is especially visible with long phrases.

I suspect it is because we generate temp plaintext for each slot incrementally, and before we generate the temp plaintext for a slot, it defaults to displaying its real plaintext. If so, we can solve it by generating temp plaintext for all slots at animation start, before the incremental algorithm starts.

Fix interaction between sentence templates and dice entropy

In phrase.shop v1, you'd first build a phrase from parts (which requires no entropy), then generate it (which does). With dice entropy, the app would let you build the phrase but keep the Generate button disabled until you roll the dice enough times. This ensured we don't try to generate the phrase until we have enough entropy.

In v2, building and generating are combined into one step, but the entropy check now happens at the wrong time and for the wrong amount.

Add Fry words

Fry words are an alternative to Voice of America.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.