Introducing a new way to review your PRs.

Read the announcement

fwdai / rowel

🔑 Local-first Secrets Manager

View on GitHub

23 documents · Updated Oct 9, 2026

docs / password-generation-and-strength

Password generation and strength

Password generation helps people create new secrets for vault entries or for use outside the vault. It offers random character passwords and wordlist-backed memorable passwords, shows an entropy estimate, checks password strength where a password is chosen, and limits clipboard exposure after copying. See credential management, credential entry models, and secure sharing for the surrounding vault flows.

Password generation

The generator is a shared product flow that can stand alone or attach to a password field. It keeps the value on screen until the user applies it, copies it, or regenerates it. The same generator settings also provide the starting defaults for new generated passwords in Security settings.

Generator entry points

The generator opens from the global shortcut or from the Add flow when no field is waiting for a value. It also opens from a login password field with an apply action, so the generated value can fill that draft without a separate copy and paste step. In a standalone flow, “Use” copies the value and does not save it automatically.

The user can regenerate the current value without changing its options. Any change to the active options also produces a new value. The action that ends the dialog stays unavailable while that new value is being drawn or when the draw fails. This keeps the displayed secret and the confirm action aligned with the current settings.

References: src/…/ui.ts• L245-252 src/…/index.tsx• L1-12 src/…/Attached.tsx• L4-17 src/…/GenerateAction.tsx• L5-33 src/…/useGenerator.ts• L10-47 src/…/useGeneratorDialog.ts• L44-62 src/…/Actions.tsx• L5-23

Random passwords

Random mode creates a password from selected character classes. The available classes are uppercase letters, lowercase letters, numbers, and symbols. The user chooses a length from 8 to 48 characters, and the generator requires at least one class to remain active.

The “No look-alikes” option removes characters that are easy to confuse, such as O and 0. The generator uses a secure random source and strict generation so every selected class appears in the result. The service and native command keep their character pools aligned with the entropy estimate shown to the user.

References: src/…/generator.ts• L17-43 src/…/generator.ts• L90-124 src/…/Amount.tsx• L14-43 src/…/Charset.tsx• L6-15 src/…/Toggles.tsx• L14-22 src-tauri/…/generator.rs• L10-75

Memorable passwords

Memorable mode joins randomly selected words with hyphens. It supports three to eight words, optional capitalization, and an optional two-digit suffix. The words come from a fixed list of 256 short lowercase words chosen to avoid unclear characters.

The wordlist size makes each word contribute eight bits to the entropy estimate. The estimate can also include the two-digit suffix when numbers are enabled. The result is easier to read than a full character password, but its strength depends on the number of words and the size of the list.

References: src/…/wordlist.ts• L1-4 src/…/wordlist.ts• L30-39 src/…/generator.ts• L46-53 src/…/generator.ts• L127-148 src/…/Amount.tsx• L14-43 src/…/Toggles.tsx• L14-22

Generator defaults

Generator defaults are shared between the Security settings page and the generator dialog. The shared settings cover random-password length, character classes, and look-alike exclusion. A change in either place becomes the starting point for the next generated password.

The current mode, memorable word count, and capitalization are session choices for the dialog rather than shared defaults. The SSH view is another generator face, not a password mode, so it does not become a password default.

References: src/…/prefs.ts• L35-55 src/…/generator.ts• L71-102 src/…/GeneratorGroup.tsx• L10-47 src/…/Tabs.tsx• L6-17 src/…/useGeneratorDialog.ts• L27-40

Strength calculation

Strength calculation serves two related needs: it gives feedback while a password is typed, and it decides whether a new master password can be accepted. The calculation uses a five-level score from 0 to 4 and combines that score with a direct minimum-length rule for master passwords.

Password score

The score comes from zxcvbn-style pattern analysis rather than from simple character-composition rules. The score ranges from very weak through very strong. The meter and label use the same scale wherever a stored password or a new master password is shown.

The strength service also returns a warning and suggested actions. The user sees the length message first when the password is shorter than 12 characters. Once it is long enough, the interface shows the score feedback that is available.

References: src/…/strength.ts• L3-16 src/…/strength.ts• L30-41 src/…/levels.ts• L1-15 src/…/PasswordStrength.tsx• L19-53 src/…/StrengthBar.tsx• L7-19

Master password acceptance

Master-password acceptance requires at least 12 characters and a score of at least 2. The length rule is separate from the score because a password can meet one condition and fail the other. The setup and password-change flows use the same rules so a password receives the same answer at each entry point.

The setup flow reveals confirmation after the password reaches the minimum length. Submission then checks strength, checks that both fields match, and only then passes the password to the vault flow. A failed strength-engine load reports an error instead of silently accepting an unchecked master password.

References: src/…/strength.ts• L3-9 src/…/strength.ts• L43-57 src/…/index.tsx• L38-107 src/…/MasterPasswordRow.tsx• L18-69

Deferred strength feedback

Strength scoring is deferred until after the field paints so typing stays responsive. The dictionary data loads on demand and is reused after the first successful load. If a password changes while a score is being calculated, the old result is ignored.

The meter can therefore be empty for a short time after input starts. The password field remains usable during that gap, and a failed load does not block normal field editing. The next password change can request the score again.

References: src/…/strength.ts• L18-28 src/…/strengthEngine.ts• L1-12 src/…/useStrength.ts• L5-39

Strength presentation

The interface presents strength as a compact five-segment meter with a text label. It uses one visual scale for measured password scores and for the generator’s entropy estimate, while keeping the underlying meaning clear: password fields show a score and generator output shows estimated bits.

Password field feedback

Login password fields show the meter when a value exists. The field can also show how long the password has been in place, which gives rotation context without changing the strength result. Master-password setup and change screens use the fuller strength line so they can show one actionable hint or the current validation error.

The display avoids stacking duplicate messages. A form error replaces the normal hint on the strength line, while a confirmation mismatch appears with the confirmation field because it describes the pair of inputs rather than the password’s strength.

References: src/…/PasswordField.tsx• L31-73 src/…/PasswordStrength.tsx• L9-55 src/…/MasterPasswordRow.tsx• L82-110 src/…/index.tsx• L118-147

Generator entropy display

Generator output shows an estimated entropy value in bits beside the same five-segment meter. Random mode estimates bits from password length and the active character set. Memorable mode estimates bits from word count and the optional two-digit suffix.

The meter thresholds map the estimate to very weak, weak, fair, strong, or excellent. This is guidance about the generated options. It is not the same as the zxcvbn score used to accept a user-chosen master password.

References: src/…/generator.ts• L49-53 src/…/generator.ts• L141-149 src/…/Output.tsx• L9-31 src/…/Sample.tsx• L31-65 src/…/Meter.tsx• L1-19

Clipboard interactions

Copying is the handoff between generated secrets and other applications. The shared copy service sends the value to the native clipboard command and raises the app’s copied notification. The clipboard policy then limits how long that value remains available.

Generated value application

When the generator is attached to a password field, “Use & copy” fills the field and copies the same value. When it is standalone, the value has no destination field, so the copy is the only external handoff and the notification confirms the action. This separation keeps generation from saving a secret unless the user continues through the relevant entry flow.

The shared action bar enables this confirm only when the generated value is ready. A settings change or regeneration therefore cannot copy or fill the previous value while the replacement is in flight.

References: src/…/useGeneratorDialog.ts• L44-66 src/…/Actions.tsx• L5-23 src/…/copy.ts• L1-10 src/…/GenerateAction.tsx• L5-33 src/…/index.tsx• L12-28

Clipboard clearing

Security settings offer 15 seconds, 30 seconds, 60 seconds, or Never for copied secrets. The default is 30 seconds. A lock clears the app’s last copied secret before the normal timeout when the platform supports safe comparison.

The native clipboard service clears a value only when the clipboard still contains the exact value that the app wrote. A later user copy is therefore preserved. Repeated app copies replace the pending clear so an earlier timer cannot remove a newer value. On iOS, the pasteboard uses a write-time expiry and a one-day maximum even when the user selects Never.

Copied secrets are also marked to avoid clipboard history, monitoring, and cloud clipboard features where the platform supports those markers. The exact protection depends on the operating system’s clipboard support.

References: src/…/SessionGroup.tsx• L17-71 src/…/prefs.ts• L35-55 src/…/copy.ts• L4-9 src-tauri/…/clipboard.rs• L13-24 src-tauri/…/clipboard.rs• L108-182 src-tauri/…/clipboard.rs• L187-214 src-tauri/…/clipboard.rs• L302-341

Supporting utility behavior

The password services keep user-facing state and native secret operations separate. The frontend owns the options, wordlist mode, entropy estimate, and display timing. The native layer owns secure random password generation and platform clipboard behavior.

Generation boundaries

The frontend asks the native generator for random character passwords with the selected pools and strict inclusion enabled. The native side validates the available pools, limits the requested length, and returns a generated value. Memorable passwords stay in the frontend because they need the bundled wordlist and its matching entropy calculation.

This boundary gives both modes a common dialog while allowing each mode to use the source best suited to its job. It also means the entropy calculation must continue to match the pools and word count used for generation.

References: src/…/generator.ts• L1-15 src/…/generator.ts• L104-139 src-tauri/…/generator.rs• L18-75 src/…/tools.ts• L3-15

Request freshness

Generation and strength checks are asynchronous from the user’s point of view. The generator keeps only the result for its current settings, and the strength hook keeps only the result for its current password. This prevents a slower old request from replacing a newer value on screen.

While a generation request is active, the generator marks its result as not ready. A stale request cannot restore readiness because its result is ignored after cleanup. If generation fails, the action remains unavailable instead of using an unchecked or older value.

The same rule applies when the strength dictionary fails to load: the failure is not cached forever. A later request can try again, while the input and generator controls continue to work.

References: src/…/useGenerator.ts• L10-47 src/…/Actions.tsx• L13-23 src/…/useStrength.ts• L14-37 src/…/strength.ts• L18-28

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the random character pools in src/…/generator.ts and src-tauri/…/generator.rs aligned, or the displayed entropy estimate will not describe the generated value.
  • Keep the wordlist size and memorable-password entropy formula aligned, or the bit count will become misleading.
  • Preserve the distinction between generator entropy labels and zxcvbn master-password acceptance when changing shared meter styles or labels.
  • Keep the copy service’s 0 handling aligned with the native command’s optional timeout meaning, or “Never” can become an immediate clear.
  • Review lock behavior and platform-specific clipboard limits together when changing clipboard retention or concealed-write rules.
  • Keep generator defaults and the Security settings shape compatible when adding or renaming a generator option, including older stored settings.
  • Keep the generator’s ready state tied to the current draw when changing confirm actions, or a settings change can copy or fill an older value.

Important failure modes

TriggerConsequenceGuard
All random character classes are disabledNo valid character pool exists and generation failsThe character controls keep the final active class enabled; the native command also rejects an empty pool.
A generated random password uses pools that differ from the entropy calculationThe displayed bit count does not describe the actual resultThe frontend mirrors the native pools and passes strict generation options.
A generated value is confirmed while a new draw is in flightThe user copies or fills a value that does not match the current settingsThe generator exposes readiness only after the current draw succeeds; the shared action stays disabled until then.
Strength scoring returns after the password has changedThe meter can show feedback for an older passwordThe strength hook drops results after cleanup.
A stale clipboard timer clears without checking the current valueA later user copy can be lostThe native clear compares the exact written value and tracks the latest copy generation.
“Never” is passed as a zero-millisecond timeoutA copied secret can be cleared immediatelyThe copy service converts zero to an omitted timeout before calling the native command.
The strength dictionaries fail to load during master-password submissionThe form cannot safely decide whether to accept the passwordSubmission reports an error and leaves the password unchecked rather than accepting it.

Key files

FileWhy to read it
src/…/generator.tsDefines generator modes, shared settings, entropy estimates, and the boundary between random and memorable generation.
src/…/wordlist.tsDefines the fixed word source used by memorable passwords.
src/…/useGenerator.tsKeeps generator settings, generated output, readiness, regeneration, and persisted defaults in sync.
src/…/useGeneratorDialog.tsConnects generator output to field filling, copying, regeneration, and confirmation.
src/…/Actions.tsxProvides the shared cancel and confirm actions and prevents confirmation before output is ready.
src/…/Panel.tsxShows the common generator body and its mode-specific controls.
src/…/GeneratorGroup.tsxShows how generator defaults are configured and shared with the dialog.
src/…/strength.tsDefines the master-password length and score rules.
src/…/useStrength.tsDefines deferred strength feedback and protection against stale results.
src/…/PasswordStrength.tsxShows how score, hints, and form errors are presented together.
src/…/copy.tsProvides the common copy-and-notify path for secrets.
src-tauri/…/clipboard.rsDefines timeout, lock, platform, concealed-write, and compare-before-clear behavior.
src/…/SessionGroup.tsxDefines the user-facing clipboard retention choices.