Signed snowflake ID's
Project description
Flakely
Allows for the generation and validation of SHA256 signed snowflakes.
Installation
pip install flakely
Usage
The flakely.Flakely
class handles generation and validation of the signed snowflakes. It accepts the following arguemnts:
device: int
a device ID that is encoded into each snowflakeprocess: int
a process ID that is encoded into each snowflakesecret: str | bytes
used to generate unpredictable signature hashes
Flakely.generate() -> int
Generates a new signed snowflake and returns it as an int
.
Flakely.generate_bytes() -> bytes
Generates a new signed snowflake and returns it as a bytes
object.
Flakely.validate(snowflake: int | bytes) -> bool
Checks that a snowflake's signature is valid for the payload.
Flakely.get_signature(flake: bytes) -> bytes
Generates a signature for the snowflake payload as SHA256 digest.
Flakely.get_tick() -> int
Returns an integer to use as the timestamp.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for flakely-2024.1.31-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 079e54d674dfc59c9ac86e80e188b173420a68d8d77a331f7ba0df45ac7fd0aa |
|
MD5 | c0610fe17a62a0a9d8a66c8751f6e9dc |
|
BLAKE2b-256 | 39e787beb4ae763411fca9e024d7c5f2f64a6889f12e4fae16138aa8109a0cea |