Guard / foldkit-guard
foldkit-guard
Who may do what, declared once on a Foldkit Plus domain, and enforced on every path a row is read or written by.
What it is
Authorization in an application is usually several callbacks, one per seam, each with its own idea of who is asking. A guard set says it once, in the shared domain code the client imports too, and keeps the rule's logic on the server:
- a principal guard is declared by name; its body is supplied only on the server, so it never ships to the browser;
- a row guard is an
Exprover one Entity's fields, with the principal's fields as inputs. It is data, so the SQL compiler andevaluaterun it, and the client may hold it without learning anything a query does not.