Skip to content

Add public method for key.requires_touch() - #35

Merged
obelisk merged 9 commits into
mainfrom
thanh/add-key-require-touch
Jun 29, 2026
Merged

Add public method for key.requires_touch()#35
obelisk merged 9 commits into
mainfrom
thanh/add-key-require-touch

Conversation

@timweri

@timweri timweri commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

This pull request introduces a new TouchRequirement API to standardize how the codebase determines whether a hardware-backed key requires user touch for signing operations. The changes add the TouchRequirement enum, implement it for SSH and YubiKey keys, and expose it through public APIs.

@timweri
timweri force-pushed the thanh/add-key-require-touch branch from 5efc465 to 58c11a8 Compare June 1, 2026 16:17
@timweri
timweri requested a review from Copilot June 1, 2026 16:18
@timweri timweri changed the title Add public method for key.require_touch\nAI tool: Codex + gpt5.5 Add public method for key.requires_touch() Jun 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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() on EcdsaSkPrivateKey, Ed25519SkPrivateKey, and PrivateKey (plus a convenience wrapper on FIDOSSHKey).
  • 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.

Comment thread src/yubikey/piv/management.rs
Comment thread src/ssh/privkey.rs
Comment thread src/ssh/privkey.rs
Comment thread src/yubikey/piv/management.rs
Comment thread src/ssh/privkey.rs
Comment thread src/ssh/privkey.rs
@timweri
timweri marked this pull request as ready for review June 27, 2026 15:52
@timweri
timweri requested a review from obelisk June 27, 2026 15:54
@obelisk
obelisk merged commit 0ba3b06 into main Jun 29, 2026
5 checks passed
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.

3 participants