flakely


Nameflakely JSON
Version 2024.1.31 PyPI version JSON
download
home_page
SummarySigned snowflake ID's
upload_time2024-02-01 00:19:40
maintainer
docs_urlNone
authorZech Zimmerman
requires_python>=3.10,<4.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Flakely

Allows for the generation and validation of SHA256 signed snowflakes.

## Installation

```shell
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.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "flakely",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Zech Zimmerman",
    "author_email": "hi@zech.codes",
    "download_url": "https://files.pythonhosted.org/packages/c6/9a/54eadd245c23d0156fdba6e31ae1955f7c8a1b8d0ec91ebaf3fa311bdbd4/flakely-2024.1.31.tar.gz",
    "platform": null,
    "description": "# Flakely\n\nAllows for the generation and validation of SHA256 signed snowflakes.\n\n## Installation\n\n```shell\npip install flakely\n```\n\n## Usage\n\nThe `flakely.Flakely` class handles generation and validation of the signed snowflakes. It accepts the following arguemnts:\n\n- `device: int` a device ID that is encoded into each snowflake\n- `process: int` a process ID that is encoded into each snowflake\n- `secret: str | bytes` used to generate unpredictable signature hashes\n\n`Flakely.generate() -> int`\n\nGenerates a new signed snowflake and returns it as an `int`.\n\n`Flakely.generate_bytes() -> bytes`\n\nGenerates a new signed snowflake and returns it as a `bytes` object.\n\n`Flakely.validate(snowflake: int | bytes) -> bool`\n\nChecks that a snowflake's signature is valid for the payload.\n\n`Flakely.get_signature(flake: bytes) -> bytes`\n\nGenerates a signature for the snowflake payload as SHA256 digest.\n\n`Flakely.get_tick() -> int`\n\nReturns an integer to use as the timestamp.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Signed snowflake ID's",
    "version": "2024.1.31",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "39e787beb4ae763411fca9e024d7c5f2f64a6889f12e4fae16138aa8109a0cea",
                "md5": "c0610fe17a62a0a9d8a66c8751f6e9dc",
                "sha256": "079e54d674dfc59c9ac86e80e188b173420a68d8d77a331f7ba0df45ac7fd0aa"
            },
            "downloads": -1,
            "filename": "flakely-2024.1.31-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c0610fe17a62a0a9d8a66c8751f6e9dc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<4.0",
            "size": 2265,
            "upload_time": "2024-02-01T00:19:39",
            "upload_time_iso_8601": "2024-02-01T00:19:39.058351Z",
            "url": "https://files.pythonhosted.org/packages/39/e7/87beb4ae763411fca9e024d7c5f2f64a6889f12e4fae16138aa8109a0cea/flakely-2024.1.31-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c69a54eadd245c23d0156fdba6e31ae1955f7c8a1b8d0ec91ebaf3fa311bdbd4",
                "md5": "e10ef1bbc3b892c0cbb66b0caf938a14",
                "sha256": "088c9d28a876eb7b301eabfa316fafc48ae60e44f4cf48c4dbbd5cc5f9fb1c8f"
            },
            "downloads": -1,
            "filename": "flakely-2024.1.31.tar.gz",
            "has_sig": false,
            "md5_digest": "e10ef1bbc3b892c0cbb66b0caf938a14",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10,<4.0",
            "size": 2160,
            "upload_time": "2024-02-01T00:19:40",
            "upload_time_iso_8601": "2024-02-01T00:19:40.249611Z",
            "url": "https://files.pythonhosted.org/packages/c6/9a/54eadd245c23d0156fdba6e31ae1955f7c8a1b8d0ec91ebaf3fa311bdbd4/flakely-2024.1.31.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-01 00:19:40",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "flakely"
}
        
Elapsed time: 0.16580s