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

generate-passphrase-id

v1.2.0

Published

Zero dependency module - Secure random passphrase in Indonesian language

Downloads

30

Readme

Generate Passphrase

npm npm npm bundle size Codecov GitHub branch checks state GitHub

✨Zero dependency module for generating passphrase.

An Indonesian language fork of (also my repository) generate-passphrase.

  • 🚀 Simple passphrase generator with simple config
  • ✨ ESM support
  • 🔑 Cryptographically secure
  • 📕 Built-in Typescript typings
  • 🎊 Supports Node.js 10 and higher

The code is close to node generate-password repo. But this is for a passphrase, with Indonesian language.

ProtonMail has a decent article explaining about password vs passphrase.

Is this secure? Yes. I don't use Math.floor, I used the crypto module.

Why is this repo heavy? I'm using scraped words list from KBBI for fetching the Indonesian word list. If you have a better idea/workaround for this, feel free to open up an issue and file a PR! I'll gladly accept any feedbacks.

Installation

$ npm install generate-passphrase-id
# or
$ yarn add generate-passphrase-id
# or basically any package manager you like.

How to use this?

import { generate, generateMultiple } from 'generate-passphrase-id'
// or
const { generate, generateMultiple } = require('generate-passphrase-id')

const passphrase = generate();
// 'spionase-syahwat-41-neolitikum'
const anotherPassphrase = generate({ length: 3, separator: '.', titlecase: true }) 
// see available options below

const multiplePassphrase = generateMultiple(3)
// ['pomologi-jerojol-kalau-senandika', 'kakek-meristem-89-emigras', ... ]
const anotherMultiplePassphrase = generateMultiple(10, { length: 2, uppercase: true, numbers: false })

I know some of us need to generate it fast just for the sake of it, you can add fast as a parameter. (It defaults to false). Please bear in mind, this would make the returning random passphrase not cryptographically secure

const fast = generate({ fast: true })
// cultivars-strigose-avisements-58

const extraFast = generateMultiple(5, { fast: true })
// ['extrorsal-169-resultlessness-168', 'postmodern-kolkhozniki-skulkers-99', ... ]

Options

| Key | Type | Default | | --- | --- | --- | | length | integer | 4 | | separator | string | '-' | | numbers | boolean | true | | uppercase | boolean | false | | titlecase | boolean | false | | pattern | string | null |

A few things to note:

  • Uppercase is more prioritized than titlecase. So if you have both options set to true, it will be words full of uppercase.
  • Pattern option is more prioritized than length, because you've set the passphrase pattern, hence the module is using the length from your pattern.

Benchmark a.k.a How slow is this?

TL;DR: It's slow.

I'm using:

  • Asus ROG GL553VE
  • Windows 10 Home 64-bit (10.0 Build 18363)
  • Intel Core i7-7700HQ @ 2.80GHz, 8 CPUs
  • 16 GB RAM

Benchmark for single passphrase/password:

| Module | Ops/sec | Accuracy | Runs sampled | | --- | --- | --- | --- | | generate-passphrase-id | 107,649 | ±1.89% | 407 | | generate-passphrase (fast enabled) | 503,082 | ±1.26% | 438 | | generate-password | 401,664 | ±1.33% | 335 | | niceware | 268,618 | ±1.95% | 319 | | randomatic | 7,870 | ±3.16% | 307 |

Benchmark for multiple passphrase/password (generateMultiple function):

| Module | Ops/sec | Accuracy | Runs sampled | | --- | --- | --- | --- | | generate-passphrase-id | 11,714 | ±1.37% | 425 | | generate-passphrase-id (fast enabled) | 50,090 | ±2.54% | 432 | | generate-password | 40,261 | ±2.26% | 332 |

Contributing

Yes please.

License

MIT