Skip to main content

Rolling Token verificator & generator

Project description

Rolling Token Authentication

Usage

Initialization

from rolling_token_auth import RollingTokenManager

manager = RollingTokenManager("secret", interval=3600)

The interval defines how long a token is valid in seconds. Shorter = more secure. Both secret and interval must match between generation and verification.

Generation

manager.generate_token()

This generates a token for the current timestamp. Optionally a offset can be declared.

Verification

manager.is_valid(token)

This checks if the given token is valid for the current timestamp. The manager.tolerance parameter defines how many token from the past and future are still valid (default: 1 in each direction).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rolling_token_auth-0.1.2.tar.gz (2.2 kB view hashes)

Uploaded Source

Built Distribution

rolling_token_auth-0.1.2-py3-none-any.whl (2.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page