All use-cases

Secure upload to verifiable certificate

Size, MIME, and magic-byte verified before any byte is stored; SHA-256 over the stored bytes; a QR certificate anyone can verify offline.

Upload gate to certificate — end to end

Mail = email sent Bell = in-app alert Amber diamond = automatic check
Select KYC document bucket + BucketConfig attached Size + MIME allowed? maxBytes · allow-list Magic-byte matches MIME? real header vs declared Rate-limit OK? workspace mutation quota Write to Supabase Storage sanitised workspace-scoped path SHA-256 over stored bytes Web Crypto · recorded in uploads Bind to claimant (KYC) hash + path + uploaded_by Issue verifiable certificate CERT-YYYY-ENTITY · QR · email + in-app yes yes yes Rejected — size / type too large 413 · not allowed 415 BLOCKED no Rejected — spoof detected header ≠ Content-Type · 422 BLOCKED no Rejected — rate limit retry-after · 429 no

No byte reaches storage until size, MIME allow-list, and the magic-byte header all pass — a renamed file is caught at the door. The SHA-256 is taken over the STORED bytes, so the certificate proves exactly what is on disk; the QR makes that proof verifiable offline.

What the certificate guarantees

  • The magic-byte gate is the anti-spoof wall — declared image/png must actually start with the PNG signature, or it is a 422.
  • The stored path is workspace-scoped and sanitised; the SHA-256 + path land in an uploads record bound to uploaded_by.
  • The QR value is self-contained — entity id, cert id, and hash prefix — so verification is a re-hash, not a lookup.