This release is a pre-release and may not be stable for production use.
Python Bindings for the Timelock Library
Python bindings for the Timelock library. It enables timelock encryption and decryption with support for Drand's quicknet. In the futurue we will expand the supported networks to include the IDN beacon.
Build
Build with:
pip install --upgrade build
python -m build
Publish
Note that this requires the timelock-wasm-wrapper python package be published as well.
pip install --upgrade twine
twine upload --repository testpypi dist/*
Usage
See the example for an e2e demo.
Encrypt a message
from timelock import Timelock
# Setup encryption input
# The drand quicknet public key
pk_hex = "83cf0f2896adee7eb8b5f01fcad3912212c437e0073e911fb90022d3e760183c8c4b450b6a0a6c3ac6a5776a2d1064510d1fec758c921cc22b0e17e63aaf4bcb5ed66304de9cf809bd274ca73bab4af5a6e9c76a4bc09e76eae8991ef5ece45a"
timelock = Timelock(pk_hex)
# An ephemeral secret key
sk = bytearray([0x01, 0x02, 0x03, 0x04] * 8)
# A "future" round number
round_number = 1000
# The message to encrypt
plaintext = "Hello, Timelock!"
# timelock encrypt
ct = timelock.tle(round_number, plaintext, sk)
Decrypt a Message
# get a signature at some point in the future
signature_hex = "b44679b9a59af2ec876b1a6b1ad52ea9b1615fc3982b19576350f93447cb1125e342b73a8dd2bacbe47e4b6b63ed5e39"
sig = bytearray.fromhex(signature_hex)
# and finally decrypt the message
maybe_plaintext = timelock.tld(ct, sig)
maybe_plaintext = maybe_plaintext.decode("utf-8")
assert plaintext == maybe_plaintext
License
Apahce-2.0
Metadata
Release files for timelock 0.0.1.dev0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| timelock-0.0.1.dev0.tar.gz | 6.2 kB | Without provenance | Details for timelock-0.0.1.dev0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| timelock-0.0.1.dev0-py3-none-any.whl | Python 3 | none | any | Details for timelock-0.0.1.dev0-py3-none-any.whl |
Total release size: 12.8 kB
Release files / timelock-0.0.1.dev0.tar.gz
| Download URL | timelock-0.0.1.dev0.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
47d23f55e9007f07ced0d6e76751ee8870151ae5ef3765e4af566313dcd28e47
|
|
BLAKE2b-256 checksum How to use checksums |
8afd50b2708bacfa0d397228205c493b30d4916b3c4f0ac5ca363ceb6278bb9f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.12
|
Release files / timelock-0.0.1.dev0-py3-none-any.whl
| Download URL | timelock-0.0.1.dev0-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d6e9249a2ee06548983af8de887c7aa63fdbaedffae474a493307390f74f72ee
|
|
BLAKE2b-256 checksum How to use checksums |
2c17670d49f7bacff2c1617bbc93b99b16c87da0bc9b6fe962d349f4de0c9c60
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.10.12
|
Security for timelock 0.0.1.dev0
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.