npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

hsimp-purescript

v0.2.1

Published

How Secure Is My Password? written in PureScript

Downloads

43

Readme

How Secure Is My Password?

These modules are written using PureScript 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:

// 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:

{
    // 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. Then just run make. However, the latest build should always be available in the dist directory.