Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions README-RU.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,15 @@ int otp = get_totp_code_at(key, time_at);

### 🕓 Временные токены на основе HMAC (Custom HMAC Time Tokens)

Библиотека также включает **облегчённую реализацию временных HMAC-токенов**, не связанную напрямую с RFC 4226/6238 (HOTP/TOTP). Эти токены:

- Основаны на `HMAC(timestamp)`
- Возвращаются в виде `hex`-строки
- Не требуют хранения состояния (stateless)
- Поддерживают привязку к отпечатку клиента (например, ID устройства)
- Поддерживают `SHA1`, `SHA256` и `SHA512`
Библиотека также включает **облегчённую реализацию временных HMAC-токенов**. Это **не** TOTP/HOTP; используется простой механизм `HMAC(timestamp)`. Эти токены:

- Основаны на `HMAC(timestamp)` — не TOTP/HOTP
- По умолчанию применяется `SHA256` (поддерживаются также `SHA1` и `SHA512`)
- Тег — полный HMAC: 32 байта (64 hex-символа) при `SHA256`
- Кодирование: `hex` в нижнем регистре
- Токен принимается для предыдущего, текущего и следующего интервала (±`interval_sec`)
- Не требуют хранения состояния и могут привязываться к *отпечатку клиента* (например, ID устройства)
- Обеспечивают базовую защиту от повторного воспроизведения и подходят только для задач с низким риском

Пример использования:

Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,16 @@ int otp = get_totp_code_at(key, time_at);

### 🕓 Time-Based HMAC Tokens (Custom HMAC Time Tokens)

The library also includes a **lightweight implementation of time-based HMAC tokens**, which are not directly based on RFC 4226/6238 (HOTP/TOTP). These tokens:
The library also includes a **lightweight implementation of time-based HMAC tokens**. This is *not* TOTP or HOTP; it's a simple `HMAC(timestamp)` approach. These tokens:

- Are based on `HMAC(timestamp)`
- Are returned as `hex` strings
- Default to `SHA256` but also support `SHA1` and `SHA512`
- Use the full HMAC digest as the tag (32 bytes → 64 hex chars with `SHA256`)
- Are returned as lowercase `hex` strings
- Are valid for the previous, current, and next interval (±`interval_sec`)
- Require no server-side state (stateless)
- Support binding to a *client fingerprint* (e.g. device ID)
- Support `SHA1`, `SHA256`, and `SHA512`
- Provide basic replay protection and are intended for low-risk scenarios

#### Example:

Expand Down
Loading