first commit

This commit is contained in:
2026-05-29 08:20:56 +01:00
commit 949299f58d
6368 changed files with 527176 additions and 0 deletions

View File

@@ -0,0 +1,60 @@
# `ru/wikipedia` — Russian Wikipedia frequency dictionary
<!-- begin:auto-docs -->
_(no submodules)_
<!-- end:auto-docs -->
## Purpose
Frequency-ranked dictionary of the most common Russian tokens observed in
Wikipedia. Plugs into `assess` for Russian-locale strength evaluation.
## Features
- Frozen `ReadonlyMap<string, number>` keyed by Cyrillic token
- Covers high-frequency Russian stopwords and common nouns
- Swappable via `loadDictionaries`
## Usage: Basic Example
```ts
import { RU_WIKIPEDIA_DICTIONARY } from "@suaveplan/password-strength/dicts/ru";
console.log(RU_WIKIPEDIA_DICTIONARY.get("пароль")); // 1
```
## Usage: Advanced Example
```ts
import { assess } from "@suaveplan/password-strength";
import { RU_DICTIONARIES } from "@suaveplan/password-strength/dicts/ru";
const result = assess("пароль123", { dictionaries: RU_DICTIONARIES });
console.log(result.score);
```
## API Reference
- `RU_WIKIPEDIA_DICTIONARY: ReadonlyMap<string, number>` — frozen
frequency-ranked Russian Wikipedia dictionary.
## Implementation Notes
The bundled subset is intentionally compact; production deployments should
swap in a fuller list. Russian tokens are matched against the lowercased
form of the input, so `assess` will pick up `ПАРОЛЬ` as well via the
uppercase variation factor in `estimateGuesses`.
## 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.