Homework

Homework — single-use in SQL, and the caveat in your words

Expand the app. Give your app a tamper-evident artifact if it has one, or work on SignFlow.

  1. Prove single-use in SQL. Open psql and run UPDATE signers SET status='signed', signed_at=now() WHERE id='<a pending signer>'; — then try to sign that link. You get the signed state, not an error, and SignSigner reports zero rows. Explain, in one sentence, why the WHERE status='pending' guard makes signing idempotent without any Go bookkeeping.

  2. Recompute vs trust. In Sign, temporarily write doc.FileHash into signed_doc_hash instead of integ.CurrentHash. Now tamper with the file and sign. What does the signature record? Why is that a lie, and why does recomputing from the bytes fix it? Revert.

  3. The completion boundary. Send a document to three signers. Sign as two of them and check the document status (sent). Sign as the third and check again (completed). Look at the log line's remaining= count across the three signs. Where, exactly, does completion happen — and why is it in the same transaction as the final signature?

  4. Say the caveat in your own words. In three sentences, write what this signature is and three things it is not. Then name one real situation where tamper-evidence is enough, and one where it is not (and a qualified/eIDAS signature would be required). This is the honesty the lesson is built on.

Next lesson makes every one of these state changes permanent: an append-only audit trail, enforced by the database itself — so "who did what, when" survives even the deletion of the document it describes.