Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

keylet -- Client library for Tillitis TKey

keylet on GitHub keylet on PyPI keylet documentation

Keylet is a Python client library and CLI tool for the Tillitis TKey security token, and implements a ML-DSA / Ed25519 signer application for TKey.

TKeys unique feature is that it has no long-term memory: signing keys are always generated from a seed at runtime. This seed is built by combining a Unique Device Secret, a Device Application hash and an optional User Supplied Secret. Both the Device Application and User Supplied Secret are provided at runtime by keylet.

The unique design leads to some API peculiarities:

  • User Supplied Secret (passphrase) is not directly validated by keylet: a "wrong" passphrase will just lead to using a different signing key. In practice the calling application should look at TKeySign.get_pubkey(): if the key is unexpected, then potentially the wrong passphrase was used.
  • In long-term use (where the same signing key is expected to be used over a period of time) the calling application is responsible for always selecting the same Device Application: keylet provides a mechanism for this, see examples.
  • The only way to change the device application or passphrase after initialization is to unplug the device and start over.
  • Signer initialization has an optimization where the initialization succeeds if the TKey has already been initialized with matching device application name and version. Unfortunately keylet cannot confirm that the exact device binary is the expected one or that the passphrase is still the same one (but again, the calling application can compare TKeySign.get_pubkey() to the expected key)

Installation

pip install keylet

CLI Usage

The package installs a keylet command-line tool for signing and verification. This is primarily a test/demo application for the library.

# Sign without a passphrase, then verify
$ keylet sign README.md
$ keylet verify README.md

# Get public key, sign with a passphrase, and verify using the saved public key
$ keylet --passphrase hunter2 pubkey --output pub.key
$ keylet --passphrase hunter2 sign README.md
$ keylet verify --pubkey pub.key README.md

# When using keylet long-term, remember to specify device app digest (keylet default
# app version may change, but you will need a specific application to keep using the
# same key)
$ keylet --passphrase hunter2 --digest 186bcf6 sign README.md

Library Usage

from keylet import TKeySign, SignApp

# Load the default embedded ML-DSA signer
app = SignApp.load_mldsa()
digest = app.digest

# Initialize the signer with a passphrase
with TKeySign(app=app, secret="hunter2") as signer:
    # Sign a payload
    signature = signer.sign(b"my payload")

In long-term use, the device app digest should be used to ensure the same application is always used for a specific key:

# Load application with a digest stored earlier
app = SignApp.load_mldsa(digest=digest)

# Initialize the signer with a passphrase
with TKeySign(app=app, secret="hunter2") as signer:
    # Sign a payload
    signature = signer.sign(b"my payload")

See the API Reference for more details.

Development

uv is a required development tool.

# Run keylet CLI from source
uv run keylet sign README.md

# run linters and type checker
make lint

# Fix formatting and lint issues
make fix

# run tests
make test

# run tests, including on-device tests
make test-device

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

keylet-0.2.1.dev0.tar.gz (55.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

keylet-0.2.1.dev0-py3-none-any.whl (57.4 kB view details)

Uploaded Python 3

File details

Details for the file keylet-0.2.1.dev0.tar.gz.

File metadata

  • Download URL: keylet-0.2.1.dev0.tar.gz
  • Upload date:
  • Size: 55.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for keylet-0.2.1.dev0.tar.gz
Algorithm Hash digest
SHA256 08a1b175ea05940de15046718a1480a4f0747598dbda68b2ab03e3a40592d31d
MD5 007b0d14815c7ad999ea707a978ce9af
BLAKE2b-256 ab6070bfbc12dec9a0b52cf4579871838d46ad16b40434c6b02b75f055ffdba1

See more details on using hashes here.

Provenance

The following attestation bundles were made for keylet-0.2.1.dev0.tar.gz:

Publisher: release.yml on jku/keylet

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file keylet-0.2.1.dev0-py3-none-any.whl.

File metadata

  • Download URL: keylet-0.2.1.dev0-py3-none-any.whl
  • Upload date:
  • Size: 57.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for keylet-0.2.1.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 bf22bc1c3e717b5a99ed329992f82498466e6ba3ebe731698d4e3bf801635651
MD5 de0b69462a3f56dde926d77487be9c65
BLAKE2b-256 09d2b2228d44e3d87a350e445b04ec7bc5e2677fb6761fc73fd9eacf54744ad9

See more details on using hashes here.

Provenance

The following attestation bundles were made for keylet-0.2.1.dev0-py3-none-any.whl:

Publisher: release.yml on jku/keylet

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page