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.20.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.20.1
File Size Uploaded Provenance Actions
flechtctl-0.20.1.tar.gz 36.2 kB Without provenance Details for flechtctl-0.20.1.tar.gz

Built distribution (wheel)

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

Total release size: 61.5 kB

Release files / flechtctl-0.20.1.tar.gz

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

Download URL flechtctl-0.20.1-py3-none-any.whl
Size 25.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f0616ed141ea645e4c6fad0712b1eb12a3ea7d03c5e3490646db8dd8ade3bfa7
BLAKE2b-256 checksum
How to use checksums
416cfff4e3f55570e1f53f9be0fa28f1dcb1bde79f0dd1412232d7b555dd0548
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","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.20.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