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.18.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.18.1
File Size Uploaded Provenance Actions
flechtctl-0.18.1.tar.gz 35.1 kB Without provenance Details for flechtctl-0.18.1.tar.gz

Built distribution (wheel)

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

Total release size: 59.8 kB

Release files / flechtctl-0.18.1.tar.gz

Download URL flechtctl-0.18.1.tar.gz
Size 35.1 kB
Tags Source
SHA-256 checksum
How to use checksums
cbbf1e9a40bf6d8c29194c09fcae0e3c8056ec4ee650de9bf576bd2a2fe7f781
BLAKE2b-256 checksum
How to use checksums
d21e14fbbecacded9b032a150823f97532a6b42b13b9a8c2ba14685246fe360b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","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.18.1-py3-none-any.whl

Download URL flechtctl-0.18.1-py3-none-any.whl
Size 24.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
631def88497c54368e72762f33c94114bcb95a83904341fae6097ecccbd580dc
BLAKE2b-256 checksum
How to use checksums
7f232620b561646725a2c079a85f17b88b0d4a29d37282b3ee218666ac93b425
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","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.18.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