https://github.com/howsecureismypassword/modules-purescript
A purescript rewrite of the core HSIMP modules
https://github.com/howsecureismypassword/modules-purescript
Last synced: 6 months ago
JSON representation
A purescript rewrite of the core HSIMP modules
- Host: GitHub
- URL: https://github.com/howsecureismypassword/modules-purescript
- Owner: howsecureismypassword
- Archived: true
- Created: 2017-10-03T21:20:58.000Z (over 7 years ago)
- Default Branch: develop
- Last Pushed: 2020-07-02T15:00:10.000Z (almost 5 years ago)
- Last Synced: 2024-04-27T05:05:11.665Z (about 1 year ago)
- Language: PureScript
- Size: 266 KB
- Stars: 17
- Watchers: 5
- Forks: 9
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# How Secure Is My Password?
These modules are written using [PureScript](http://www.purescript.org) and then transpiled into JavaScript. You **do not** need to know PureScript to use the built versions of the code as it functions as a standard JS library.
## Usage
Using ES6 modules:
```javascript
// import the hsimp-purescript module
import setup from "hsimp-purescript";import language from "hsimp-purescript/language/english";
import characterSets from "hsimp-purescript/data/character-sets";
import common from "hsimp-purescript/data/common/top10k";
import patterns from "hsimp-purescript/data/patterns";// create the hsimp function
// if passed valid config, setup will return a function
const hsimp = setup({
// the number of calculations per second a computer can do
calculationsPerSecond: 40e9,// whether to display named numbers
namedNumbers: true,// a language file
language,// different checks
checks: {
// character sets to check
characterSets,// common passwords to check
common,// patterns to check
patterns,
}
});// to run
const result = hsimp("HowSecureIsMyPassword?");
```You will get back an object with the following structure:
```javascript
{
// how long it would take to crack the password as a human readable string
time: "42 minutes",// the highest level of check (e.g. insecure, warning, notice - see below)
level: "notice",// the checks - in level of importance
checks: [
{
name: "Character Variety: No Symbols",
message: "Your password only contains numbers and letters. Adding a symbol can make your password more secure. Don\'t forget you can often use spaces in passwords.",
level: "notice",
},
// ...and so on
]
}
```See `dist/test.js` for a fully working version of the code in Node.
### Levels
There are five levels:
- `insecure`: a really bad password, probably very common
- `warning`: might be ok, but things to be aware of
- `easter-egg`: they've found something silly
- `notice`: nothing major
- `achievement`: something to be proud of## Building
To build the code you'll require [`spago`](https://github.com/spacchetti/spago). Then just run `make`. However, the latest build should always be available in the `dist` directory.