Skip to content

feat(sign): optionally remember the PIN for 30 minutes - #11

Merged
lorenzocorallo merged 1 commit into
mainfrom
feat/remember-pin
Oct 17, 2026
Merged

lorenzocorallo merged 1 commit into
mainfrom
feat/remember-pin

Conversation

@lorenzocorallo

Copy link
Copy Markdown
Member

Summary

Adds an opt-in Remember the PIN on this computer for 30 minutes checkbox to the sign page. While the PIN is remembered, the page shows "Your PIN is remembered for … until HH:MM, while the CIE stays on the reader". Signing then needs only a click on Sign.

Safeguards

  • Memory only. The agent keeps the PIN in memory, never on disk, and wipes it when it is forgotten.
  • Fixed expiry. The PIN lasts 30 minutes from when it was typed. Using it does not extend that.
  • Card stays on the reader. The agent checks every 2 s and forgets the PIN when no provider sees a card, so a card placed later never receives it.
  • Same card. If a card that accepts the PIN has a different certificate than the one the PIN was typed for, the agent refuses to sign and forgets the PIN. Any error opening the card also forgets it.
  • Same browser. A random key in an HttpOnly, SameSite=Strict cookie (path /api/) ties the PIN to the browser where it was typed. Other browsers, or other local users calling the API, get pin_required.
  • Explicit consent. Every signature still needs a click on Sign. The page and the dashboard never see the PIN.
  • Easy to clear. "Use a different PIN" (POST /api/forget), typing the PIN without ticking the box, or restarting the agent all forget it.

Known limit: a card swapped faster than the 2 s check still receives the remembered PIN. If it is a different CIE, that uses one of its PIN attempts. Nothing is signed, and the PIN is forgotten immediately. Closing this gap would need a card identifier read before the PIN, in every provider.

API

  • POST /api/sign: pin may be omitted to use the remembered PIN. The new remember flag asks the agent to remember the PIN. When no PIN is remembered, the response is pin_required (401).
  • /api/status and /api/job return remembered: {signer, expires}. /api/job also returns rememberMinutes.
  • Options.RememberFor sets the duration (negative turns the feature off). Options.CardWatch sets the card check interval.

Testing

  • New tests in internal/server/remember_test.go:
    • remember and reuse the PIN
    • other browsers and forged cookies are refused
    • expiry
    • card removal
    • card swap
    • error while opening the card
    • wiping the PIN
    • feature turned off
    • cardGone
  • go test -race ./internal/server/ passes.
  • Manual check with --soft against a fake dashboard: signed with the box ticked, signed two documents without a PIN, then "Use a different PIN" brought the PIN field back.
  • Not yet tried with a physical CIE.
  • internal/autostart TestInstalledParsesEntries fails locally on main too, so it is unrelated to this change.

🤖 Generated with Claude Code

The PIN form offers to remember the PIN on this computer for 30 minutes.
The agent keeps it in memory only and forgets it when the time runs out
(not extended by use), when the CIE leaves the reader, when a different
card is on the reader, on any error opening the card, when the user
picks "Use a different PIN" or types the PIN without ticking the box.

Only the browser that typed it can use it, through a random key in an
HttpOnly, SameSite=Strict cookie; every signature still needs a click
on Sign. The page and the dashboard never see the PIN.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 17, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 31 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a48199fc-045e-46eb-b82c-c388ecdd8be8
📥 Commits

Reviewing files that changed from the base of the PR and between 9bfb731 and 067c39c.

📒 Files selected for processing: 8
  • README.md
  • internal/server/remember.go
  • internal/server/remember_test.go
  • internal/server/server.go
  • internal/server/server_test.go
  • internal/server/web/assets/sign.js
  • internal/server/web/assets/style.css
  • internal/server/web/sign.html
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@lorenzocorallo
lorenzocorallo merged commit c124907 into main Oct 17, 2026
15 checks passed
@lorenzocorallo
lorenzocorallo deleted the feat/remember-pin branch October 17, 2026 17:51
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.

1 participant