Skip to main content
ctx.frame.as describes the principal for this invocation. Its fields include id, kind, for, email and phone.
  • id is the principal’s stable, kind-qualified PrincipalId: person:… for a signed-in person, service:… for a service, and anonymous:… for a signed-out caller. A signed-out client is one anonymous principal for the whole registered session its calls arrive on (a call on no session is its own), and two sessions’ principals cannot be linked. It holds no grant of its own: only an entry whose allow names role.anyone admits it, through that class grant, and a trial of its call admits it exactly as the call would.
  • kind is "person", "agent" (a principal acting under a delegation grant), "service", "installation" or "anonymous". An exposed function whose allow excludes role.anyone also excludes "anonymous" from the type of ctx.frame.as.kind. Internal functions, reactions and mutations declared with by: "app" keep the full union.
  • In an agent’s frame, id names the agent and for names the delegator. The kernel derives for from the agent’s live delegation grants, never from the call. A once key uses the agent’s id.
  • email and phone hold verified contact details. Each is null when the host has no trusted verification for it.
allow: [role.signedIn] admits every authenticated person, and allow: [role.anyone] admits signed-out callers too. Each is a class grant the program issues at install and the lock prints; nothing is ambient. A function with no allow is internal. To give a principal more than that, grant it a role. The same principal is the as root of every guard, so a rule about the person rather than the role is a guard on its claims:
Store the id in a t.principal field when a fact must name its author or owner. See Storing users.