Skip to content
This repository was archived by the owner on Mar 27, 2026. It is now read-only.

Commit 482cc3a

Browse files
committed
Fix requiring a PIN for CAP operations.
pin is apparently always present, but is None if not provided. This confused me a bit when trying to do a test CAP operation.
1 parent 67bd3db commit 482cc3a

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

emv/command/client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ def info(ctx):
170170
@click.option("--amount", "-a", metavar="AMOUNT", help="amount")
171171
@click.pass_context
172172
def cap(ctx, challenge, amount):
173-
if "pin" not in ctx.obj:
173+
pin = ctx.obj.get("pin", None)
174+
if not pin:
174175
click.secho("PIN is required", fg="red")
175176
sys.exit(2)
176177

@@ -181,7 +182,7 @@ def cap(ctx, challenge, amount):
181182
card = get_reader(ctx.obj["reader"])
182183
try:
183184
click.echo(
184-
card.generate_cap_value(ctx.obj["pin"], challenge=challenge, value=amount)
185+
card.generate_cap_value(pin, challenge=challenge, value=amount)
185186
)
186187
except InvalidPINException:
187188
click.secho("Invalid PIN", fg="red")

0 commit comments

Comments
 (0)