api-key-factory
Overview
api-key-factory is a CLI tool to generate API keys and their corresponding SHA-256 hashes. The secret part of the key is an UUID (Universally Unique Identifier) version 4 (random).
Example of a generated API key:
mykey-8590efb6-0a68-4390-8537-99a54928c669
Usage: api-key-factory [OPTIONS] COMMAND [ARGS]...
A simple CLI tool to generate API keys and their corresponding SHA-256 hashes.
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --version Show the version and exit. │
│ --help Show this message and exit. │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────╮
│ generate Command to generate API keys and their corresponding SHA-256 │
│ hashes. │
╰──────────────────────────────────────────────────────────────────────────────╯
generate
Generate API keys and hashes in standard terminal output (stdout) or in 2 distinct files ([prefix_]keys.txt, [prefix_]hashes.txt) in a defined directory.
The files are created readable and writable by their owner only (mode 0600) and an existing file is never overwritten. The prefix cannot contain whitespace, a path separator (/, \, :) or a control character.
Usage: api-key-factory generate [OPTIONS]
Command to generate API keys and their corresponding SHA-256 hashes.
╭─ Options ────────────────────────────────────────────────────────────────────╮
│ --dir -d <directory> Directory to output keys and hashes. │
│ If not set output to stdout. │
│ --num -n <int range> [x>=1] Number of API keys to generate │
│ [default: 1] │
│ --prefix -p <str> Add a prefix at the beginning of the │
│ key │
│ --help Show this message and exit. │
╰──────────────────────────────────────────────────────────────────────────────╯
Example:
$ api-key-factory generate --num 2
d097dccc-cd24-4137-8ddb-d03f8b07d8d9 8b89600015b273c28f966f368456e45e01df239a36bf939ff72a16881f775679
c2d79a40-388e-4709-9e4b-903035b0e71e fb22be500af1ef0479745bbbce847854da33f5e910361ad278e0282995b95f4d
$ api-key-factory generate --prefix mykey
mykey-3532dceb-f38a-491b-814d-9607bc9a947a 83309f0b7cd16fbd02edc85dbe32fc3326367618cf80a885f649d8e4eaeb43b3
$ api-key-factory generate -p mykey -n 5 --dir out
Success! 5 keys and hashes have been written to the files:
- out/mykey_keys.txt
- out/mykey_hashes.txt
Installation
With Python environment
To use:
- Minimal Python version: 3.13
Installation with Python pip:
python3 -m pip install api-key-factory
api-key-factory --help
Development
With uv and Task
To use:
- Python version: 3.13 or 3.14
uvinstallation documentation: https://docs.astral.sh/uv/getting-started/installation/taskinstallation documentation: https://taskfile.dev/installation/
# Set environment
uv sync
# Format
task 00:110-format
# Lint
task 00:120-lint
# Static typing
task 00:130-type-check
# Tests
task 00:220-run-tests
# Run
uv run api-key-factory --help
Authors
- FX Soubirou - Initial work - GitLab repositories
License
This program is free software: you can redistribute it and/or modify it under the terms of the MIT License (MIT). See the LICENSE for details.
Metadata
Release files for api-key-factory 1.4.0
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 | |
|---|---|---|---|---|
| api_key_factory-1.4.0.tar.gz | 100.7 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| api_key_factory-1.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 109.9 kB
Release files / api_key_factory-1.4.0.tar.gz
| Download URL | api_key_factory-1.4.0.tar.gz |
|---|---|
| Size | 100.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
692da4d4ab6b2130d41d74baa4416484f2cd9da01ee4c72bcb40404b189affd2
|
|
BLAKE2b-256 checksum How to use checksums |
7e52a890aefc6544373cdd15bff7445c26a4be41c8f9b9aea5571c6d3bc3f012
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / api_key_factory-1.4.0-py3-none-any.whl
| Download URL | api_key_factory-1.4.0-py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5acc772f93d113910343d80a0c4b7d69284eaca98f021e641c4568206015a47f
|
|
BLAKE2b-256 checksum How to use checksums |
8a57cd074be4bc836b4c3246c84afa3cc2c2df8c16a1228f7c2944acf3de7971
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for api-key-factory 1.4.0
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.