XKPassword (xkpassword v0.1.0)

Copy Markdown View Source

Generates memorable passwords from the dictionary bundled with the Ruby gem.

Each word is drawn independently by choosing a length and then a word of that length. The default preset, :xkcd, produces four hyphen-separated words.

Summary

Functions

Generates one password from a keyword list or an atom-keyed map of options.

Functions

generate(options \\ [])

@spec generate(keyword() | map() | nil) :: String.t()

Generates one password from a keyword list or an atom-keyed map of options.

The options are :preset, :words, :min_length, :max_length, :separator, and :case_transform. Explicit options override the preset. Preset names and case transforms may also be given as strings.

The case transforms are :upcase, :downcase, and :capitalize. Use nil to choose lowercase or uppercase independently for each word. A nil separator joins the words directly.

Raises ArgumentError for invalid options.