Files
skills/docs/security-stack/security/password-strength/src/dicts/es/wikipedia.md
2026-05-29 08:20:56 +01:00

2.3 KiB

es/wikipedia — Spanish Wikipedia frequency dictionary

(no submodules)

Purpose

Frequency-ranked dictionary of the most common Spanish tokens observed in Wikipedia. Plugs into assess for Spanish-locale strength evaluation.

Features

  • Frozen ReadonlyMap<string, number> keyed by lowercase token
  • Covers high-frequency Spanish stopwords and common nouns
  • Swappable via loadDictionaries for a fuller corpus

Usage: Basic Example

import { ES_WIKIPEDIA_DICTIONARY } from "@suaveplan/password-strength/dicts/es";

console.log(ES_WIKIPEDIA_DICTIONARY.get("contraseña")); // 1

Usage: Advanced Example

import { assess } from "@suaveplan/password-strength";
import { ES_DICTIONARIES } from "@suaveplan/password-strength/dicts/es";

const result = assess("contraseña2026", { dictionaries: ES_DICTIONARIES });
console.log(result.score);

API Reference

  • ES_WIKIPEDIA_DICTIONARY: ReadonlyMap<string, number> — frozen frequency-ranked Spanish Wikipedia dictionary.

Implementation Notes

contraseña is rank 1 in the bundled subset to mirror the German locale's passwort placement. The full Wikipedia top-30 000 list belongs in production deployments; the bundled subset stays small so the package bundle does not balloon when consumers import a single locale.

Additional Implementation Notes

The implementation follows the canonical zxcvbn algorithm from Wheeler 2016 with the suaveplan-style additions described in the package proposal: structured error codes via the defineCodes registry, Zod boundaries at every public entry point, OTel histograms and counters keyed to low-cardinality attributes, and a strict input-length guard at 200 characters. Consumers integrate with their existing observability stack by installing a meter provider before importing the package, and with their i18n stack via the MessageResolver callback type declared in @suaveplan/types. The bundled data tables are intentionally small to keep the package bundle compact; production deployments should swap in fuller frequency-ranked tables via loadDictionaries. The default English dictionary set is a frozen DictionarySet that the matcher never mutates; caller-supplied dictionaries override defaults by name.