Skip to content

Sync with upstream trezor-agent; preserve OnlyKey features + add native Windows#16

Open
onlykey wants to merge 54 commits into
masterfrom
upstream-sync
Open

Sync with upstream trezor-agent; preserve OnlyKey features + add native Windows#16
onlykey wants to merge 54 commits into
masterfrom
upstream-sync

Conversation

@onlykey
Copy link
Copy Markdown
Owner

@onlykey onlykey commented May 26, 2026

Summary

Brings onlykey/lib-agent up to date with upstream romanz/trezor-agent (~50 commits) while preserving every OnlyKey-specific feature. Reverts PR #15 (the partial pkg_resources removal) and performs a full feature-preserving merge rather than a reset, since upstream's onlykey.py is RSA-stubbed.

Preserved OnlyKey features

  • RSA key support (RSA2048/RSA4096): pubkey retrieval, SSH-RSA wire format, and sig_encode_rsa signing path
  • Stored-key slots via --skey / --dkey (ECC1–16, RSA1–4)
  • --import-pub for loading an existing public key
  • The full libagent/device/onlykey.py backend
  • Package identity lib-agent 1.0.7 (distribution name; import package remains libagent)

New

  • Native Windows support for OnlyKey — generates run-agent.bat on Windows (not just the Unix run-agent.sh / WSL path), sharing upstream's .sh/.bat-aware launcher logic plus win_server.py and doc/README-Windows.md from upstream.

Removed

  • KeepKey and Ledger device backends (and trezor_defs), per project scope.

Cleanup

  • Removed stale pkg_resources / unused semver usage and duplicate from importlib import metadata imports
  • setup.py: dropped a duplicate python-daemon pin and the stale backports.shutil_which (Python-2 backport)

Validation

All tox py3 gates pass locally: pycodestyle, isort, pydocstyle, pytest (81 passed), pylint 10.00/10. CI runs these across Python 3.8–3.13.

Review notes

  • ssh/client.pyparse_ssh_blob was restored to upstream's clean return dict; the OnlyKey sig_hash call now selects the hash type inline (msg['hashalg'] for SSHSIG, else msg['key_type']), which feeds the device the same bytes as before.
  • onlykey.py — removed a no-op self_pubkey = self_pubkey in ecdh_with_pubkey. It did nothing as written; flagging in case it was an incomplete assignment.

gtbuchanan and others added 30 commits September 21, 2021 09:08
Remove unused imports and fix a small lint issue
Mark 'libagent' package as stable
Fix install step instruction
Add Support for ED25519 ssh-certificates
Update README to include Blockstream Jade
Bump CI actions and test on Python 3.12
romanz and others added 24 commits September 5, 2024 21:24
Fixes romanz#491.

Usage example:

  ## generate TREZOR-based SSH CA public key
  $ trezor-agent -v 'SSH Certificate Authority' > /etc/ssh/trezor-ca.pub
  $ echo 'TrustedUserCAKeys /etc/ssh/trezor-ca.pub' | sudo tee -a /etc/ssh/sshd_config
  $ sudo systemctl restart ssh

  ## generate user-specific SSH key and certify it using trezor-agent
  $ ssh-keygen -t ed25519 -f user-key
  $ trezor-agent -v 'SSH Certificate Authority' -- \
      ssh-keygen -Us trezor-ca.pub -V '+10m' -I user-id -n user user-key.pub
  ...
  Signed user key user-key-cert.pub: id "user-id" serial 0 for user valid from 2024-11-23T20:25:00 to 2024-11-23T20:36:27

  ## use the certificate to login
  ssh -v user@localhost -o CertificateFile=user-key-cert.pub -i user-key
  ...
  debug1: Will attempt key: user-key-cert.pub ED25519-CERT SHA256:xdbgtQmUs5tUNf04f4Y3oQl5LGdBAMVjCH63R6EHH5Y explicit
  debug1: Will attempt key: user-key ED25519 SHA256:xdbgtQmUs5tUNf04f4Y3oQl5LGdBAMVjCH63R6EHH5Y explicit
  ...
  debug1: Offering public key: user-key-cert.pub ED25519-CERT SHA256:xdbgtQmUs5tUNf04f4Y3oQl5LGdBAMVjCH63R6EHH5Y explicit
  debug1: Server accepts key: user-key-cert.pub ED25519-CERT SHA256:xdbgtQmUs5tUNf04f4Y3oQl5LGdBAMVjCH63R6EHH5Y explicit
  Authenticated to localhost ([::1]:22) using "publickey".
  ...
replace pkg_resources for python 3.12
Also, simplify invocation examples.
…v-id

libagent: Add USB IDs for Jade Plus
Also support TS7.
Fix passphrase support on Trezor
Lookup GnuPG user ID (instead of assuming it's the first one)
…ative Windows

Reverts PR #15 and merges upstream/master. Preserves all OnlyKey features: RSA, stored-key slots (--skey/--dkey), --import-pub, SSH-RSA wire format, onlykey.py backend. Adds native Windows support (run-agent.bat) for OnlyKey. Drops keepkey/ledger. Keeps package identity lib-agent 1.0.7. Removes stale pkg_resources/semver, duplicate imports, duplicate python-daemon dep, backports.shutil_which. All checks green: pycodestyle, isort, pydocstyle, pytest (81 pass), pylint 10.00.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants