Add public method for key.requires_touch() - #35
Merged
Conversation
AI tool: Codex + gpt5.5
timweri
force-pushed
the
thanh/add-key-require-touch
branch
from
June 1, 2026 16:17
5efc465 to
58c11a8
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a public requires_touch() API to expose “user presence required” / touch requirement information for hardware-backed SSH keys (SK/FIDO) and YubiKey PIV slots, and expands test coverage around the new behavior.
Changes:
- Add
requires_touch()onEcdsaSkPrivateKey,Ed25519SkPrivateKey, andPrivateKey(plus a convenience wrapper onFIDOSSHKey). - Add YubiKey PIV helpers to fetch touch policy metadata and compute whether touch is required.
- Add/extend tests validating
requires_touch()for SK keys and non-SK keys.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
tests/sk-privkey.rs |
Adds assertions and new tests for PrivateKey::requires_touch() behavior across SK/non-SK keys and flag values. |
src/yubikey/piv/management.rs |
Introduces touch policy -> touch-required mapping plus new fetch_touch_policy() / requires_touch() APIs and unit tests. |
src/ssh/privkey.rs |
Implements requires_touch() for SK private key types and on the top-level PrivateKey. |
src/fido/generate/mod.rs |
Exposes requires_touch() on generated FIDOSSHKey by delegating to the underlying PrivateKey. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
timweri
marked this pull request as ready for review
June 27, 2026 15:52
obelisk
approved these changes
Jun 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new
TouchRequirementAPI to standardize how the codebase determines whether a hardware-backed key requires user touch for signing operations. The changes add theTouchRequirementenum, implement it for SSH and YubiKey keys, and expose it through public APIs.