Download the PHP package infocyph/otp without Composer
On this page you can find all versions of the php package infocyph/otp. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package otp
Infocyph OTP
Framework-agnostic PHP 8.4 primitives for Generic OTP, HOTP (RFC 4226), TOTP (RFC 6238), OCRA (RFC 6287), recovery codes, provisioning URIs, SVG QR codes, secret rotation planning, and atomic replay boundaries.
Requirements
- PHP
^8.4on a 64-bit build ext-ctype- Composer
TOTP quickstart
The default SHA-1/6-digit/30-second configuration has the broadest authenticator compatibility.
For replay protection, a factor ID and an atomic store are both required:
factorId must identify one factor and secret generation, not merely a user.
Production stores must implement atomic conditional updates in shared durable
storage. The in-memory stores are process-local and are not production replay
protection.
HOTP
Persist nextCounter, not matchedCounter. Supported counters are
0..PHP_INT_MAX; HOTP/TOTP use 6..9 digits and require at least 128-bit
decoded secrets.
Generic OTP
Issuing again for the same binding atomically replaces the previous code. A successful verification consumes it. A mismatch decrements attempts without changing the absolute expiration. HMAC-SHA-256 storage is mandatory and bound to the challenge. Applications remain responsible for transport, resend cooldowns, endpoint/account throttling, and anti-enumeration behavior.
OCRA
OCRA operation inputs are explicit and suite-driven; an input is rejected when the suite does not authenticate it.
Use fromBase32() for enrolled Base32 secrets. generateMutual() models
client/server challenge composition explicitly. Session input is actual UTF-8;
sessionHex() is an explicit integration helper. Time suites accept a bounded
VerificationWindow. Suites with t=0 return uppercase hexadecimal; truncated
suites allow 4..9 digits. Challenge replay tokens are SHA-256 digests, and a
challenge replay TTL is optional; high-volume systems should choose a retention
policy that covers the complete acceptance window.
otpauth://ocra is a library/client convention, not an RFC-standardized
provisioning format. The consuming client must explicitly support it.
Recovery codes
The active batch is replaced on regeneration. Consumption and its returned counts are one atomic mutation. Custom configurations must provide at least 40 bits of entropy. Submitted input is bounded before normalization.
Security boundary
Correct OTP math is not a complete authentication workflow. Store factor secrets encrypted, keep Generic OTP and recovery HMAC keys separate, use TLS, apply rate limits, protect provisioning URIs/QR SVGs as secrets, rotate factor IDs when secrets rotate, and implement atomic stores in Redis or a database. See the security and storage guides for the required atomic semantics.
Security
Do not disclose suspected vulnerabilities in a public issue, discussion or pull request. Review the GitHub private vulnerability reporting to contact the maintainers confidentially.
OTP is protected by PHPForge, an automated quality and security gate covering tests, static and taint analysis, dependency auditing, architecture checks, and release readiness. Automated controls reduce risk but do not replace responsible disclosure or manual review.
MIT Licensed
Documentation • Security • Code of Conduct • Contributing
🗂️ Bug • Feature • Documentation • Question • CI failure
🔀 General • Bug fix • Feature • Refactor • Performance • Security & reliability • Documentation • Maintenance
All versions of otp with dependencies
php-64bit Version ^8.4
ext-ctype Version *
bacon/bacon-qr-code Version ^3.1.1
infocyph/cachelayer Version ^3.1.1
paragonie/constant_time_encoding Version ^3.1.3