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 generated a 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...
generate
Generate api keys and hashes in standart terminal output (stdout) or in 2 distinct files ([prefix_]keys.txt, [prefix_]hashes.txt) in a defined directory.
Usage: api-key-factory generate [OPTIONS]
Command to generate API keys and their corresponding SHA-256 hashes.
Args: output_dir (click.Path): Directory to output keys and hashes.
num (int): Number of API keys to generate. Default 1. prefix (str):
Prefix at the beginning of the key.
Raises: click.ClickException: Error when writing output files
Options:
-d, --dir DIRECTORY Directory to output keys and hashes. If not set
output to stdout.
-n, --num INTEGER RANGE Number of API keys to generate [x>=1]
-p, --prefix TEXT 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.10
Installation with Python pip:
python3 -m pip install api-key-factory
api-key-factory --help
Developement
With uv and Task
To use:
- Minimal Python version: 3.10
uvinstallation documentation: https://docs.astral.sh/uv/getting-started/installation/taskinstallation documentation: https://taskfile.dev/installation/
# Set environment
uv sync
# Format
task 00:10-format
# Lint
task 00:20-lint
# Tests
task 00:40-test
# 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.
Release files for api-key-factory 1.3.24
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| api_key_factory-1.3.24.tar.gz | 16.1 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| api_key_factory-1.3.24-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 16.1 MB
Release files / api_key_factory-1.3.24.tar.gz
| Download URL | api_key_factory-1.3.24.tar.gz |
|---|---|
| Size | 16.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
50421289d298fba475f10b1877da7fe943dc1586a9b6bab8414a039dc2a09661
|
|
BLAKE2b-256 checksum How to use checksums |
180bb784f38af0580f0e5a9cdee63d5eeefed43c56cd6fd066932a171d1375fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","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.3.24-py3-none-any.whl
| Download URL | api_key_factory-1.3.24-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
152e5750164ecc7507577dbe25642580d238e24d3935c1aaee35d1a3ba709a11
|
|
BLAKE2b-256 checksum How to use checksums |
13187b2451b1a800d0a0a04bd915ed49cb7cf6522d9eb913d737fd73a96141ac
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"12","id":"bookworm","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|