Use your OnlyKey as a hardware-based SSH and GPG agent.
onlykey-agent lets you perform SSH authentication and GPG operations (signing,
encryption, and decryption) using keys that are generated and stored on an
OnlyKey hardware security device. Your private keys are created on the device
and never leave it — they are never written to disk or exposed to your computer,
which protects them from malware and key-theft even on a compromised host.
It is part of the lib-agent family of
hardware agents (alongside trezor-agent, ledger_agent, keepkey_agent, and
jade_agent).
- SSH agent — authenticate to servers and Git hosts with a key held on your OnlyKey.
- GPG agent — sign emails, Git commits, and software releases, and decrypt messages.
- age support — encrypt and decrypt files with hardware-backed keys.
- No keys on disk — keys are generated and stored on the device and never reach the host.
pip install onlykey-agentThis installs three console entry points:
onlykey-agent— SSH agentonlykey-gpg— GPG toolonlykey-gpg-agent— GPG agent
Use your OnlyKey to log in over SSH:
onlykey-agent user@example.com -cSet up a GPG identity backed by your OnlyKey:
onlykey-gpg init "Your Name <you@example.com>"Derived keys default to the original derivation, so existing SSH and GPG keys
are unchanged. --skey derived-v2 / --dkey derived-v2 selects the newer
HKDF-based derivation (firmware v3.1.0+), which gives different keys.
Full SSH and GPG instructions, including common use cases, are available in the project documentation.
- Python 3.10+
- An OnlyKey device (composite PQC GPG keys and
--skey/--dkey derived-v2need firmware v3.1.0 or newer) lib-agentand theonlykeyPython package (installed automatically)
- Homepage / source: https://github.com/trustcrypto/onlykey-agent
- OnlyKey: https://onlykey.io
- Documentation: https://docs.onlykey.io
Released under the GNU Lesser General Public License v3 (LGPLv3).