Registry / security / onetimepass

onetimepass

JSON →
library1.0.1pypypi✓ verified 83d ago

A minimal library for generating and validating HOTP (HMAC-based One-Time Password) and TOTP (Time-based One-Time Password) tokens as per RFC 4226 and RFC 6238. Current version 1.0.1, last updated in 2015; no longer actively maintained.

pip install onetimepass
INSTALL
IMPORT
SIG · ONETIMEPASS
O
onetimepass
securitypythonv1.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

valid_totp
from onetimepass import valid_totp
from otp import valid_totp
Common mistake: confusing with other OTP libraries
get_totp
from onetimepass import get_totp
from onetimepass import totp
Function is named get_totp, not totp

Validate a TOTP token given a base32 secret.

from onetimepass import valid_totp import os secret = os.environ.get('OTP_SECRET', 'JBSWY3DPEHPK3PXP') token = input('Enter token: ') if valid_totp(token, secret): print('Valid!') else: print('Invalid.')
Debug
Known issues
deprecatedLibrary is unmaintained since 2015; does not support Python 3.11+ fully due to reliance on deprecated crypto packages.
fix
Consider using pyotp instead, which is actively maintained.
affects: >=1.0.0
gotchaThe secret must be base32 encoded (string). Passing a raw bytes secret will fail silently or raise confusing errors.
fix
Always use base32-encoded strings (e.g., from pyotp.random_base32()).
affects: all
breakingThe function 'valid_totp' has no drift parameter; it only checks the current time window. If clock skew is an issue, tokens may fail.
fix
Synchronize clocks or use a library with drift support like pyotp.
affects: all
Errors
Common errors & fixes
AttributeError: module 'onetimepass' has no attribute 'valid_totp'
Incorrect import or outdated version that doesn't have the function.
fix
Ensure you installed onetimepass 1.0.1 and use: from onetimepass import valid_totp
ImportError: No module named 'onetimepass'
The library is not installed.
fix
Run: pip install onetimepass
TypeError: expected string or bytes-like object
Passing a non-base32 secret (e.g., raw bytes without encoding).
fix
Convert secret to base32 string: base64.b32encode(secret).decode('utf-8')
Upgrade
Version history
1.0.1latest on PyPI · released Jul 31, 2015
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
8
Resources
onetimepass — pip install onetimepass · libregistry