Skip to content

Commit

Permalink
Improve error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
dainnilsson committed Jun 19, 2024
1 parent b00294d commit 5dbaa7a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions ykman/_cli/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ def reset(ctx, force):
This action will wipe all data and restore factory settings for
all applications on the YubiKey.
"""
dev = ctx.obj["device"]
if not dev.supports_connection(SmartCardConnection):
raise CliFail("Full device reset requires the CCID interface to be enabled.")

info = ctx.obj["info"]
# reset_blocked is a sure indicator of the command
if not info.reset_blocked:
Expand Down
4 changes: 2 additions & 2 deletions ykman/_cli/openpgp.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ def change_pin(ctx, pin, new_pin):
"""
Change the User PIN.
The PIN has a minimum length of 6, and supports any type of
alphanumeric characters.
The PIN has a minimum length of 6 (or 8, for YubiKey 5.7+ FIPS when not using KDF),
and supports any type of alphanumeric characters.
"""

session = ctx.obj["session"]
Expand Down
2 changes: 1 addition & 1 deletion ykman/_cli/piv.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def reset(ctx, force):
info = ctx.obj["info"]
if CAPABILITY.PIV in info.reset_blocked:
raise CliFail(
"Cannot perform PIV reset when biometrics are configured, "
"Cannot perform PIV reset when FIDO is configured, "
"use 'ykman config reset' for full factory reset."
)

Expand Down

0 comments on commit 5dbaa7a

Please sign in to comment.