@systemix/passphrase

A secure, memorable passphrase generator using cryptographically strong random values.

Installation

pnpm add @systemix/passphrase

Basic Usage

import { generatePassphrase } from '@systemix/passphrase';

const passphrase = generatePassphrase();
// Default: 4 words, space-separated

Options

PropertyTypeDefaultDescription
wordCountnumber4Number of words (1–100)
separatorstring" "Separator between words
wordListstring[]Built-inCustom word list
useTitleCasebooleanfalseCapitalize each word
useUpperCasebooleanfalseUPPERCASE all words
includeNumberbooleanfalseInject random digit into words
randomSeparatorbooleanfalseRandom separator per word pair

Examples

Title case with custom separator

const passphrase = generatePassphrase({
  wordCount: 5,
  separator: '-',
  useTitleCase: true,
});
// e.g. "Correct-Horse-Battery-Staple-Valid"

Entropy calculation

import { calculatePassphraseEntropy } from '@systemix/passphrase';

const entropy = calculatePassphraseEntropy(4, 7776); // wordCount, list size
console.log(`Entropy: ${entropy.toFixed(1)} bits`);

Try it

Open the Passphrase Generator demo to experiment interactively.