Skip to main content

api-key-factory

Software License semantic-release: angular Pipeline Status

Built with Material for MkDocs Source code documentation

Logo of 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:

# 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

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.23

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for api-key-factory 1.3.23
File Size Uploaded
api_key_factory-1.3.23.tar.gz 16.1 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for api-key-factory 1.3.23
File Interpreter ABI Platform
api_key_factory-1.3.23-py3-none-any.whl Python 3 none any Details

Total release size: 16.1 MB

Release files / api_key_factory-1.3.23.tar.gz

Download URL api_key_factory-1.3.23.tar.gz
Size 16.1 MB
Tags Source
SHA-256 checksum
How to use checksums
dc91a12adbbfbaec1a609d069075e8925b8c133dbc8216630567199617ce726c
BLAKE2b-256 checksum
How to use checksums
7677b146be4959d33e750aed9e90a625c2d90bcf7b8c6945470a6c1d2ac45eb8
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.23-py3-none-any.whl

Download URL api_key_factory-1.3.23-py3-none-any.whl
Size 9.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1838cfa868f79856ac0e2a573337fb69eea8a2b11ed690781705a6d8984e3398
BLAKE2b-256 checksum
How to use checksums
c92ac8cd480f417067c3008bcc104f06e5ef7df7573c99202c6c95ec3a33870e
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 history Release notifications | RSS feed

This release

1.3.23 This release

2 release files

1.3.22

2 release files

1.3.20

2 release files

1.3.19

2 release files

1.3.18

2 release files

1.3.17

2 release files

1.3.16

2 release files

1.3.15

2 release files

1.3.14

2 release files

1.3.13

2 release files

1.3.12

2 release files

1.3.10

2 release files

1.3.9

2 release files

1.3.8

2 release files

1.3.7

2 release files

1.3.6

2 release files

1.3.5

2 release files

1.3.4

2 release files

1.3.3

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page