Open the console

Verifying an Onboarding Step with a Cryptographic Signature

A database flag says a step is done. A signature says who said so, with what, and when. Here's when the difference is worth the extra code.

Verifying an Onboarding Step with a Cryptographic Signature

Most onboarding steps complete the same way: your server writes a row, the row has a boolean, and the checklist reads the boolean. That's fine for a step like "set your profile photo." It stops being fine for a step like "accepted the data processing agreement" or "confirmed you are the account owner" — anything where someone, later, might ask you to prove the step actually happened the way your database says it did, not just that a flag got flipped.

A database row answers "is this true right now." It does not answer "who asserted this was true, against exactly what content, and can that assertion be checked independently of trusting your own database." If an engineer with write access to the table can set the flag directly — and on most teams, someone can — then the flag is not evidence, it's a claim. For steps where that distinction matters, a signature is cheaper than it sounds.

What gets signed, and by what

The thing worth signing is not "step complete," it's a specific payload: the step id, the account id, the exact version of the agreement or content the user accepted, and a timestamp. Hash that payload and sign the hash with a key your application controls server-side — the user never sees a private key, and nothing changes about their actual click.

function signCompletion(payload: StepCompletion, privateKey: CryptoKey) {
  const data = canonicalize(payload); // stable field order, no whitespace ambiguity
  const hash = sha256(data);
  return { payload, signature: sign(hash, privateKey) };
}

Store the payload and the signature together, not just the signature. A signature without the exact bytes it was computed over is useless — you can't re-verify it, and you can't show anyone what was actually agreed to. The canonicalization step matters more than the signing step: if your JSON serializer can reorder fields or vary whitespace between the time you sign and the time you verify, the signature will fail for reasons that have nothing to do with tampering.

What this protects against, and what it doesn't

A signature protects against a specific threat: someone editing the completion row after the fact without also having the private key, and against your own future self wondering whether a row was ever legitimately written versus backfilled by a migration script. It does not protect against the user lying when they clicked — if they weren't actually authorized to accept the agreement, a signature confirms the click happened, not that the click was meaningful. Keep those two guarantees separate in how you describe this to anyone asking "is this secure."

It also doesn't replace an audit log. A signature on one completion record answers "was this record tampered with." It says nothing about sequence — whether this step was completed before or after another one, or whether a record was deleted entirely. If you need tamper-evidence across a sequence of events rather than one record at a time, you want a hash chain or an append-only log, which is a related but larger piece of engineering than signing individual completions.

Verifying without re-trusting your own database

The useful property only shows up if verification can happen somewhere that doesn't just read the same table back. A support tool that re-derives the hash from the stored payload and checks it against the stored signature using the public key is proving something; a support tool that just reads the "complete" column is not. If every verification path in your product reads from the same table that the signature was meant to protect, you've built a feature that looks rigorous and isn't — the signature needs at least one consumer that treats the database as untrusted input.

When it isn't worth building

Most steps don't need this. If nobody will ever ask "prove this happened" — a profile photo, a UI tour step, picking a theme — a signature is pure cost: key management, a canonicalization bug waiting to happen, and a verification path nobody will build correctly under deadline pressure. Reserve it for the small set of steps tied to consent, compliance, or anything that could become a dispute: contract acceptance, identity confirmation, anything a customer's legal team might eventually ask about. If you're not sure which of your steps qualify, that's itself the thing to figure out before writing any signing code, not after.

This sits alongside marking a step complete from a background job — signing doesn't change who or what calls the completion endpoint, only what gets stored once it does. For the broader question of what a completion record should contain before you add cryptography to it, see the steps API reference. You can see step completions recorded in practice in the live preview.

Try it on your app