Skip to main content

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 snowflake
  • process: int a process ID that is encoded into each snowflake
  • secret: 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


Download files

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

Source Distribution

flakely-2024.1.31.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flakely-2024.1.31-py3-none-any.whl (2.3 kB view details)

Uploaded Python 3

File details

Details for the file flakely-2024.1.31.tar.gz.

File metadata

  • Download URL: flakely-2024.1.31.tar.gz
  • Upload date:
  • Size: 2.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.0 Darwin/23.2.0

File hashes

Hashes for flakely-2024.1.31.tar.gz
Algorithm Hash digest
SHA256 088c9d28a876eb7b301eabfa316fafc48ae60e44f4cf48c4dbbd5cc5f9fb1c8f
MD5 e10ef1bbc3b892c0cbb66b0caf938a14
BLAKE2b-256 c69a54eadd245c23d0156fdba6e31ae1955f7c8a1b8d0ec91ebaf3fa311bdbd4

See more details on using hashes here.

File details

Details for the file flakely-2024.1.31-py3-none-any.whl.

File metadata

  • Download URL: flakely-2024.1.31-py3-none-any.whl
  • Upload date:
  • Size: 2.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.3.2 CPython/3.10.0 Darwin/23.2.0

File hashes

Hashes for flakely-2024.1.31-py3-none-any.whl
Algorithm Hash digest
SHA256 079e54d674dfc59c9ac86e80e188b173420a68d8d77a331f7ba0df45ac7fd0aa
MD5 c0610fe17a62a0a9d8a66c8751f6e9dc
BLAKE2b-256 39e787beb4ae763411fca9e024d7c5f2f64a6889f12e4fae16138aa8109a0cea

See more details on using hashes here.

Supported by

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