Skip to main content

Intro

This is an experimental auth library. It has not been tested in production yet. The scope of this experiment is to provide an auth method where the user can remember a target pin (much like a cipher) and calculate a one time code (otc) relative to the current time.

Foreword

From a security standpoint, this is not very secure, but does prevent brute forcing to some extent.

Problem 1:

If a third party knows the code and the timestamp of the code, they can easily compute the target and validate whenever they want.

Problem 2:

Once the code has been computed, it is incremental, meaning that depending on the method, the code increments or decrements by 1 every minute.

Problem 3:

Every day at the same time of the day the code will be the same if the target does not change.

How it works

Given a pin only the user knows which will be referenced as the "target", validation is done by manually computing a code based on the difference between the current time and a code they manually compute.

Depending on the method, subtracting or adding, the code is calculated differently.

Given the method is adding

If the target is 1111 and the current time is 12:34, the code would be 0987.

If the method is subtracting

Using the same approach, the code would be 0123.

The code is then hashed and compared to the hash of the target.

How to use

Install

pip install timedotc

Import

from timedotc import timedotc

Create the auth object

method = "sub"
auth = timedotc(
    method=method,
    secret_key=secret_key,
)

target = auth.hash("0000")

Validate

code = "1111"
auth.verify(code, target)

Usage scenarios

This might be useful for loggin into an admin panel where there is only one user intended.

Improvements

Problem 3:

The target could have a parent target which depends on the current date (month and day) which once computed would modify the initial target (calulated based on H:M). This is still susceptible to problem 1 however.

Metadata

Release files for timedotc 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for timedotc 0.1.0
File Size Uploaded Provenance Actions
timedotc-0.1.0.tar.gz 3.6 kB Without provenance Details for timedotc-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for timedotc 0.1.0
File Interpreter ABI Platform Actions
timedotc-0.1.0-py3-none-any.whl Python 3 none any Details for timedotc-0.1.0-py3-none-any.whl

Total release size: 7.4 kB

Release files / timedotc-0.1.0.tar.gz

Download URL timedotc-0.1.0.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
af5115aee73e20ca6c8a7dc2ac6e2a2cbfdfbf51aa0bbe49165de1288caf2a78
BLAKE2b-256 checksum
How to use checksums
7a9bcfe1f4f4761dedfe737f00f42dc879f4dc6fcfed878ee1fa69ddfb925f3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Release files / timedotc-0.1.0-py3-none-any.whl

Download URL timedotc-0.1.0-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2e7fb23f4926130b4633721a79f2a39ad0689e6c63b432304018f000300fb771
BLAKE2b-256 checksum
How to use checksums
22186207e076715be00bb9e7b85ebd521ecb564a5bd77d1e6e0a7545177e4aad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.8

Security for timedotc 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page