Skip to content

Commit f93c820

Browse files
committed
docs(readme): detail time token parameters
1 parent e11be12 commit f93c820

2 files changed

Lines changed: 15 additions & 10 deletions

File tree

README-RU.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -226,13 +226,15 @@ int otp = get_totp_code_at(key, time_at);
226226

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

229-
Библиотека также включает **облегчённую реализацию временных HMAC-токенов**, не связанную напрямую с RFC 4226/6238 (HOTP/TOTP). Эти токены:
230-
231-
- Основаны на `HMAC(timestamp)`
232-
- Возвращаются в виде `hex`-строки
233-
- Не требуют хранения состояния (stateless)
234-
- Поддерживают привязку к отпечатку клиента (например, ID устройства)
235-
- Поддерживают `SHA1`, `SHA256` и `SHA512`
229+
Библиотека также включает **облегчённую реализацию временных HMAC-токенов**. Это **не** TOTP/HOTP; используется простой механизм `HMAC(timestamp)`. Эти токены:
230+
231+
- Основаны на `HMAC(timestamp)` — не TOTP/HOTP
232+
- По умолчанию применяется `SHA256` (поддерживаются также `SHA1` и `SHA512`)
233+
- Тег — полный HMAC: 32 байта (64 hex-символа) при `SHA256`
234+
- Кодирование: `hex` в нижнем регистре
235+
- Токен принимается для предыдущего, текущего и следующего интервала (±`interval_sec`)
236+
- Не требуют хранения состояния и могут привязываться к *отпечатку клиента* (например, ID устройства)
237+
- Обеспечивают базовую защиту от повторного воспроизведения и подходят только для задач с низким риском
236238

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

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,13 +267,16 @@ int otp = get_totp_code_at(key, time_at);
267267

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

270-
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:
270+
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:
271271

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

278281
#### Example:
279282

0 commit comments

Comments
 (0)