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 andflsig: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.16.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 | |
|---|---|---|---|
| flechtctl-0.16.0.tar.gz | 34.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flechtctl-0.16.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 59.2 kB
Release files / flechtctl-0.16.0.tar.gz
| Download URL | flechtctl-0.16.0.tar.gz |
|---|---|
| Size | 34.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d55b39fe7f690cf50327550aa5328dd25b5ffeb1925292e274dc96538956fc72
|
|
BLAKE2b-256 checksum How to use checksums |
33a860b281e139878aeb2e27f37841115c7ca455f38c8bf9d1d75c130a9834ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / flechtctl-0.16.0-py3-none-any.whl
| Download URL | flechtctl-0.16.0-py3-none-any.whl |
|---|---|
| Size | 24.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1a2d76035826c4b65bdd6b127be52ad34bd585b675da1b45df218cf168819969
|
|
BLAKE2b-256 checksum How to use checksums |
39f751578fbda777ce2b2d732c5ca2b8636ecbb5cd1c2efb1ef8b1763d4480bc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.0 {"installer":{"name":"uv","version":"0.13.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|