Skip to content
Paykit
Esc
↑↓navigate↵open⌘Jpreview
On this page

Actor

The caller of a request, provided by the Session or Admin middleware and carried with the command.

Source: packages/paykit/src/Auth/Actor.ts Kind: Primitive

The caller of a request, provided by the Session or Admin middleware and carried with the command. Read it in a View’s validate and in your own middleware; decide stays pure and does not read it.

Declaring a request context

import * as Effect from "effect/Effect";

validate: Effect.fn(function* ({ key }) {
  const actor = yield* Actor;
  if (actor.kind === "account" && actor.id !== key.id) {
    return yield* new Forbidden({ account: key.id, actor: actor.id, kind: actor.kind, scope: "account" });
  }
}),

Was this page helpful?