Repository navigation
feat: sign several documents and several places with one PIN - #6
Merged
Merged
Conversation
A signer can now sign the same PDF in several places, and the dashboard can open the agent's page with up to 10 tickets: the user types the PIN once. - Backend client: jobs carry signatures, marks and pages; prepare sends protocol 2 and returns step and steps; complete answers "next" or "completed". A backend that sends no steps is treated as one signature. - /api/job, /api/sign and /api/cancel take a list of tickets (repeats are dropped). Sign opens one card session, then for each job repeats prepare, card signature and complete until the job is complete. A backend error fails only its job; a card error fails the job and skips the rest. Every failure is reported to the backend. If the session does not open, every job is told why and the PIN error is returned as before. - The timeout grows with the number of signatures (60 s + 30 s each, at most 15 minutes); the server's write timeout is now 16 minutes. - The page lists the documents, signs them with one PIN and shows a result for each, with a retry after a card error.
|
Warning Review limit reachedYou'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 54 minutes. View limit details
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. Comment |
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.
What
Two things the dashboard needs, both with a single PIN:
completed./sign?origin=…&ticket=t1&ticket=t2…with 1 to 10 tickets (repeats are dropped, order kept). The page lists the documents, asks for the PIN once and shows a result for each.How
internal/backend):Jobgainssignatures,marks,pages.Preparealways sendsprotocol: 2and returns the digest withstep/steps.Completeaccepts onlynextorcompleted. If a backend sends no steps, its jobs are treated as one signature each.internal/server):/api/job,/api/signand/api/canceltaketickets: string[]./api/jobreturns{ jobs: [{ticket, job} | {ticket, error}] }, fetched in parallel. A failing ticket doesn't fail the call./api/signfetches the jobs first (so it can size the timeout and skip ones that have already ended), then opens one session with the existing provider fallback rules (token.PINSentis unchanged: no retry and no fallback after the PIN was sent).Failis called on every ticket and the token error is returned as before,retriesLeftincluded.200 { results: [{ticket, status: completed|failed|skipped, error?}], signer }. A backend error (document_changed,job_done, …) fails only that job, andFailis called on it. A card error fails that job and skips the rest;Failis called with the same code on each.WriteTimeoutis now 16 min.{type: "pn-sign-agent"}to the opener with the dashboard origin.Tests
go test ./...,go test -raceon server/backend,go vet ./...,gofmtandgo build ./...all pass on macOS. New server tests:document_changedand the others are still signedFailcalled on each)Failon every ticketA new backend test checks
protocol: 2, the step parsing, a backend that sends no steps, and thenext/completedstatuses.I also checked it by hand: the dev soft token and a throwaway fake backend, with the page open in a 460×600 viewport (batch list, wrong PIN, partial results, one document).
Before merging and releasing
protocol: 2(HTTP 426,agent_outdated), so agents older than this one stop working once it ships.cie-mw,opencie, built-incie). Needs a test with a real card and a multi-place or multi-document job.