feat: create managed profiles atomically

- Require a fresh cookie MFA proof before creation\n- Create the credential-less profile and initial Guardian grant together
This commit is contained in:
Marc-André Bombeck committed 2026-08-06 02:28:56 +02:00
1 parent 51cbbae17f
commit 58434a2b44
5 files changed
+171 -11

No files matched your search

@@ -16,11 +16,10 @@
--
-- A timestamp rather than a boolean, deliberately. It says since when, which
-- the activity trail needs to be readable across the transition, and clearing
-- it is the emancipation act: the day the person takes the record over,
-- credentials attach (`email` and `password_hash` are already nullable, so
-- nothing here has to change for that) and this goes back to NULL. The grants
-- survive untouched — the handover changes who holds the revoke button, not
-- which rows exist.
-- it leaves a future-compatible NULL state. This migration deliberately adds
-- no transition route or credential attachment flow. If a later handover is
-- designed, `email` and `password_hash` are already nullable and the grants
-- can survive untouched while the product defines who holds the revoke button.
--
-- No index. The column is read by primary key, on a row the request already
-- loaded, and the one enumeration that scans for marked rows (the reminder
+5 -5
View File
@@ -62,11 +62,11 @@ model User {
/// former and stay shut for the latter, and the gate is this column rather
/// than the grant, so no argument about a grant level can reach them.
///
/// A timestamp rather than a boolean, for a reason the schema has to keep
/// possible: it says since when, and clearing it is the emancipation act —
/// the day the person takes their own record over, credentials attach and
/// this goes back to NULL, with the grants and the whole activity trail
/// spanning the transition untouched.
/// A timestamp rather than a boolean: it says since when, and preserves a
/// future-compatible null state without adding a transition surface here.
/// This release does not expose a way to clear the marker or attach
/// credentials; the grants and activity trail remain intact if a later,
/// separately designed handover ever needs that state.
///
/// Consumers land in this release: the guardian resolver in
/// `src/lib/api-handler.ts` reads it on every guardian request, the