@systemix/passphrase

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

Installation

ts
pnpm add @systemix/passphrase

Basic Usage

ts
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[]EFF large (7,776 words)Custom word list
useTitleCasebooleanfalseCapitalize each word
useUpperCasebooleanfalseUPPERCASE all words
includeNumberbooleanfalseInject random digit into words
randomSeparatorbooleanfalseRandom separator per word pair

Examples

Title case with custom separator

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

Entropy calculation

ts
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.