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
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ name = "totp-rfc"
version = "0.1.1"
edition = "2021"
rust-version = "1.85"
description = "Strict no_std HOTP and TOTP with constant-time code comparison, implementing RFC 4226 and RFC 6238"
description = "Security-hardened, allocation-free no_std HOTP and TOTP for Rust with strict RFC 4226/6238 behavior"
documentation = "https://docs.rs/totp-rfc"
homepage = "https://github.com/copyleftdev/totp-rfc"
repository = "https://github.com/copyleftdev/totp-rfc"
license = "MIT"
readme = "README.md"
publish = ["crates-io"]
keywords = ["totp", "hotp", "2fa", "authentication", "no-std"]
keywords = ["totp", "hotp", "2fa", "no-std", "constant-time"]
categories = ["authentication", "cryptography", "no-std"]
exclude = ["/mutants.out/", "/mutants.out.old/", "/tools/"]

Expand Down
27 changes: 21 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.md)
[![Core-only](https://img.shields.io/badge/no__std-supported-success.svg)](#no_std)

Strict, `no_std` HOTP and TOTP with constant-time code comparison for Rust.
Security-hardened, allocation-free, `no_std` HOTP and TOTP primitives for
Rust.

`totp-rfc` implements the HMAC-based one-time password algorithm from
`totp-rfc` is a compact Rust authentication library implementing the HMAC-based
one-time password algorithm from
[RFC 4226](https://www.rfc-editor.org/rfc/rfc4226) and the time-based one-time
password algorithm from [RFC 6238](https://www.rfc-editor.org/rfc/rfc6238).
It is designed for security-sensitive 2FA and MFA systems that need a small,
auditable, `no_std` foundation instead of provisioning, QR-code, or storage
abstractions.
It is designed for embedded, server, and security-sensitive 2FA and MFA systems
that need a small, auditable verification core instead of provisioning,
QR-code, or storage abstractions.

## Why totp-rfc?

Expand All @@ -23,7 +25,8 @@ abstractions.
- Six-, seven-, and eight-digit decimal one-time passwords
- Mandatory 128-bit minimum secret length
- Strict ASCII input parsing with preserved leading zeroes
- Constant-time comparison for well-formed authentication codes
- Constant-address dynamic truncation across every RFC-defined digest offset
- Constant-time comparison and first-match selection for well-formed codes
- Checked 64-bit counters and timestamps beyond the year 2038
- Bounded HOTP resynchronization and TOTP clock-drift windows
- Borrowed secrets and zeroized transient HMAC/hash state
Expand All @@ -32,6 +35,18 @@ abstractions.
The [RFC compliance matrix](docs/compliance.md) maps each protocol requirement
to its implementation and test evidence.

## Deliberately a primitive layer

Choose `totp-rfc` when the trusted OTP core should remain compact, portable,
allocation-free, and independently testable. It exposes explicit timestamps,
counters, validation windows, drift, and next-counter state so the surrounding
authentication service can enforce its own replay and throttling policy.

Base32, `otpauth://` provisioning, QR generation, random-secret generation,
database access, and system-clock policy remain outside the crate. Applications
that want an all-in-one enrollment toolkit can compose those concerns above
`totp-rfc` without adding them to the cryptographic verification boundary.

## Installation

Add the crate with Cargo:
Expand Down
4 changes: 3 additions & 1 deletion docs/repository-metadata.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Canonical repository: `copyleftdev/totp-rfc`

## About description

> Strict no_std HOTP and TOTP for Rust with constant-time code comparison, implementing RFC 4226 and RFC 6238 for secure 2FA and MFA systems.
> Security-hardened, allocation-free no_std HOTP/TOTP for Rust with strict RFC 4226/6238 behavior and constant-time verification.

## Website

Expand All @@ -30,6 +30,8 @@ Canonical repository: `copyleftdev/totp-rfc`
- `no-std`
- `embedded`
- `rustcrypto`
- `constant-time`
- `security`

## CI badge

Expand Down