- SUMMARY.md created for 15-01 - STATE.md: plan advanced to 01/02, progress 94%, decisions added - ROADMAP.md: phase 15 progress updated (1/3 plans) - REQUIREMENTS.md: MSIGN-10, MSIGN-11 marked complete
3.6 KiB
3.6 KiB
phase, plan, subsystem, tags, dependency_graph, tech_stack, key_files, decisions, metrics
| phase | plan | subsystem | tags | dependency_graph | tech_stack | key_files | decisions | metrics | |||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 15-multi-signer-backend | 01 | signing |
|
|
|
|
|
|
Phase 15 Plan 01: Multi-Signer Utility Building Blocks Summary
One-liner: Extended createSigningToken with optional signerEmail, added signer-download JWT pair (72h), sendSignerCompletionEmail mailer, and public GET /api/sign/download/[token] route.
Tasks Completed
| Task | Name | Commit | Files |
|---|---|---|---|
| 1 | Extend token.ts with signerEmail param and signer-download token pair | 70c48cc |
src/lib/signing/token.ts |
| 2 | Add sendSignerCompletionEmail to signing-mailer.tsx | e1cdfe9 |
src/lib/signing/signing-mailer.tsx |
| 3 | Create public signer download route GET /api/sign/download/[token] | 14efa1d |
src/app/api/sign/download/[token]/route.ts |
What Was Built
token.ts changes
createSigningTokennow accepts optionalsignerEmail?: string— persists tosigningTokens.signerEmailcolumn (written asnullif absent, preserving all existing call sites)createSignerDownloadToken(documentId)— 72h JWT withpurpose: 'signer-download'claim, no DB recordverifySignerDownloadToken(token)— validates purpose claim, returns{ documentId }
signing-mailer.tsx changes
sendSignerCompletionEmail({ to, documentName, downloadUrl })— plain-text email "All parties have signed...", subject "Signed copy ready: {name}", 72h expiry noted in body
New route: GET /api/sign/download/[token]
- Public (no auth session)
- App Router async params pattern:
{ params }: { params: Promise<{ token: string }> } - Guards: invalid/expired token → 401, doc not Signed or no signedFilePath → 404, path traversal → 403
- Serves PDF with
Content-Type: application/pdfandContent-Disposition: attachment
Verification
npx tsc --noEmitpasses with zero errors- Token utility now has 4 token types: sign, download, agent-download, signer-download
- Mailer now has 3 email functions: sendSigningRequestEmail, sendAgentNotificationEmail, sendSignerCompletionEmail
- Download route file exists at correct App Router path and imports from token.ts
Deviations from Plan
None — plan executed exactly as written.
Known Stubs
None — all functionality is fully implemented. Plans 02 and 03 will wire these utilities into the send route and sign handler.