Guard / foldkit-guard
Who the client is: Me
Use Guards.me to expose the current visitor's sign-in state and global
capabilities (such as "Show the Admin link") as a single-row Entity me,
served by GuardServer.me:
ts
const OpenAdmin = Interaction.make('OpenAdmin')
// Shared domain code, beside the other Entities.
export const Me = Guards.me(G, {
interactions: { [OpenAdmin.key]: [G.isAdmin] },
})
// The server: one Source among the others.
const MeSource = GuardServer.me(Me, Policy)- Select
{ signedIn: true, key: true, may: true }through Remote like any row, and callRemote.forgeton sign-in or sign-out soMeupdates. MeusesGuards.anyoneforReadand denies all writes;keyexposesG.key(user)to that user, so keep it to a public ID rather than a token.