Skip to main content

flechtctl

Keyrings and flenc: / flsig: secret tokens for Flechtwerk — as a small library and a command line tool, without the framework. flechtctl depends on joserfc only; it never imports flechtwerk, so it installs and runs wherever Python does (including interpreters the full stream-processing framework does not support yet).

It does three things:

  • Keyrings. Create and edit keyring files — an RFC 7517 JWK Set holding oct (symmetric), X25519 (sealing) and Ed25519 (signing) keys, each optionally bound to scopes. Optionally password-protected.
  • Value crypto. Seal, open, sign and verify values: flenc:jwe:… compact JWE tokens and flsig:jws:… Ed25519 compact JWS tokens.
  • Token tooling. Inspect a token's header, re-seal a token under another key.

Install

uvx flechtctl --help            # run it without installing
uv tool install flechtctl       # or install the command
pip install flechtctl           # or use it as a library

Python 3.12 or newer.

Command line quick start

flechtctl keyring new keyring.json --kid prod-2026-10          # a keyring with one fresh 32-byte key
TOKEN=$(flechtctl encrypt -k keyring.json --scope api_key --string 's3cret')
flechtctl inspect "$TOKEN"                                     # the unauthenticated header: kid, scope, alg
flechtctl decrypt -k keyring.json --scope api_key --string "$TOKEN"

-k/--keyring is required for every command that needs key material: the command reads no environment variables. flechtctl keyring --help lists the keyring commands — new, add, remove, primary, signing, show, export, import, protect and unprotect. A keyring file works like a keystore: a set of named entries, handed on one public half at a time with export and import.

Library quick start

The functions take the keyring explicitly — there is no global state:

from pathlib import Path

from flechtctl import Keyring, decrypt, encrypt, sign, verify

keyring = Keyring.from_json(Path("keyring.json").read_text())

token = encrypt(keyring, "s3cret", scope="api_key")        # "flenc:jwe:…"
assert decrypt(keyring, token, scope="api_key") == "s3cret"

signed = sign(keyring, {"order": 17}, scope="orders")       # "flsig:jws:…" — needs a signing key for the scope
assert verify(keyring, signed, scope="orders") == {"order": 17}

encrypt, decrypt, sign and verify work on any JSON value; the *_bytes variants take raw payload bytes. reencrypt moves a token to the scope's current sealing key, read_header shows a token's unauthenticated header, and generate_oct_key, generate_x25519_key and generate_ed25519_key mint key material.

Equivalence with Flechtwerk's codecs

flechtctl.encrypt(keyring, value, scope=s) writes exactly the token that Flechtwerk's ENCRYPTED(inner, scope=s) codec writes for value == inner.encode(x), and every token Flechtwerk writes opens here. For a BYTES field, pass the base64 string. Flechtwerk itself is built on this package: pip install "flechtwerk[secrets]" installs the matching flechtctl.

More

The guide Keyrings and Secret Tokens with flechtctl walks through a complete reader/writer setup, password-protected keyrings and the library API. The format itself is specified on the Encrypted Secrets page.

MIT licensed.

Metadata

Release files for flechtctl 0.17.1

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

Source distribution (sdist)

Source distribution for flechtctl 0.17.1
File Size Uploaded Provenance Actions
flechtctl-0.17.1.tar.gz 35.1 kB Without provenance Details for flechtctl-0.17.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for flechtctl 0.17.1
File Interpreter ABI Platform Actions
flechtctl-0.17.1-py3-none-any.whl Python 3 none any Details for flechtctl-0.17.1-py3-none-any.whl

Total release size: 59.8 kB

Release files / flechtctl-0.17.1.tar.gz

Download URL flechtctl-0.17.1.tar.gz
Size 35.1 kB
Tags Source
SHA-256 checksum
How to use checksums
c6ecf29de6fb42c115373f215bcbf73b74e69b8fa2b4e35f0d19801acd060a32
BLAKE2b-256 checksum
How to use checksums
7b76ed9e0a86c1a4a4ddfa61bb0712ece171feb574dcc76aa7930a6113f79720
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / flechtctl-0.17.1-py3-none-any.whl

Download URL flechtctl-0.17.1-py3-none-any.whl
Size 24.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d24886985dcecedff9bb9c82481f4538876c12147e35011c664ead6e36de3503
BLAKE2b-256 checksum
How to use checksums
07493a5fdf7cc23b685fb7020a8b71b8e9ac929c8d35f6a28db212f2a032430e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for flechtctl 0.17.1

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.

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