Stripe-like tokens in pure-python with no dependencies.
Project description
Heare IDs
A Python module for creating, validating, parsing, and manipulating tokens that are base-62 encoded.
Features
- Generate unique tokens with a prefix, generation character, timestamp, and entropy part
- Validate the structure and character set of tokens
- Parse tokens into their components (prefix, generation, timestamp, entropy)
- Swap the prefix of a token with a new prefix
Installation
pip install heare-ids
Usage
Generating Tokens
from heare import ids
# Generate a new token with default settings
token = ids.new('my_prefix')
# Generate a token with custom generation, timestamp, and entropy
token = ids.new('my_prefix', generation='A', timestamp=1234567890, entropy=15)
Validating Tokens
is_valid = ids.is_valid(token)
Parsing Tokens
parsed = ids.parse(token)
prefix = parsed.prefix
generation = parsed.generation
timestamp = parsed.timestamp
entropy = parsed.entropy
Swapping Prefixes
new_token = ids.swap_prefix(token, 'new_prefix')
License
This project is licensed under the MIT License.
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file heare_ids-0.1.2.tar.gz.
File metadata
- Download URL: heare_ids-0.1.2.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9707f2373d7904005a7295921ab8f93b4409c05ee29900ebb09636248e9a7784
|
|
| MD5 |
2cc007827f0d054002c615d09518e732
|
|
| BLAKE2b-256 |
7003e04f1eaf0e5d3c51446d697b7de9b2b929b4bdc17dd3b1b0dc3dc70e193e
|
Provenance
The following attestation bundles were made for heare_ids-0.1.2.tar.gz:
Publisher:
publish-to-pypi.yml on heare-io/heare-ids
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
heare_ids-0.1.2.tar.gz -
Subject digest:
9707f2373d7904005a7295921ab8f93b4409c05ee29900ebb09636248e9a7784 - Sigstore transparency entry: 158458644
- Sigstore integration time:
-
Permalink:
heare-io/heare-ids@4e1bcf4e56600662240ea7ae296e517c4521aa14 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/heare-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@4e1bcf4e56600662240ea7ae296e517c4521aa14 -
Trigger Event:
push
-
Statement type:
File details
Details for the file heare_ids-0.1.2-py3-none-any.whl.
File metadata
- Download URL: heare_ids-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bdb49937a5aaaf4bf9cbab00075d6dfa9bcfb212999a820475d7a12e0ea3434a
|
|
| MD5 |
f11c37dfb8f104334e20ce2d25aca95e
|
|
| BLAKE2b-256 |
92b433048a473684c5e0aa598121318b02b1356c2da2a1af42576b4c4d253312
|
Provenance
The following attestation bundles were made for heare_ids-0.1.2-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on heare-io/heare-ids
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
heare_ids-0.1.2-py3-none-any.whl -
Subject digest:
bdb49937a5aaaf4bf9cbab00075d6dfa9bcfb212999a820475d7a12e0ea3434a - Sigstore transparency entry: 158458646
- Sigstore integration time:
-
Permalink:
heare-io/heare-ids@4e1bcf4e56600662240ea7ae296e517c4521aa14 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/heare-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@4e1bcf4e56600662240ea7ae296e517c4521aa14 -
Trigger Event:
push
-
Statement type: