toip.tools

interface · Browser and Node

MandateTaskHandlers

@toip-tools/mandatesView source
TypeScriptImport
import { type MandateTaskHandlers } from "@toip-tools/mandates";

Declaration

TypeScriptinterface
interface MandateTaskHandlers {
  clock: Clock;
  /** Default: the bundled policy. */
  engine?: MandateEngine;
  /** With a resolver, an issued mandate's status lists are checked too. */
  status?: StatusResolver;
  /** A mandate for this endpoint whose whole chain verifies and narrows. */
  onIssue?(m: IssuePayload & Sender): Maybe;
  /** A list signed by the sender. Check your mandate against it with isRevoked. */
  onRevoked?(n: RevokedPayload & Sender): Maybe;
  /** A request from the leaf of a chain that verifies, with an action matching its hash. */
  onApprovalRequest?(r: ApprovalRequestPayload & Sender): Maybe;
  /** An approval signed by the sender. Pass it to decide, which checks the rest. */
  onApprovalGrant?(g: ApprovalGrantPayload & Sender): Maybe;
  onApprovalDeny?(d: ApprovalDenyPayload & Sender): Maybe;
  /** A message that failed its checks, and why. */
  onRejected?(r: { type: string; sender: string; reasons: Reason[] }): Maybe;
}

Properties

clockrequired
Clock
engineoptional
MandateEngine | undefined

Default: the bundled policy.

statusoptional
StatusResolver | undefined

With a resolver, an issued mandate's status lists are checked too.

onIssueoptional
((m: IssuePayload & Sender) => Maybe) | undefined

A mandate for this endpoint whose whole chain verifies and narrows.

onRevokedoptional
((n: RevokedPayload & Sender) => Maybe) | undefined

A list signed by the sender. Check your mandate against it with isRevoked.

onApprovalRequestoptional
((r: ApprovalRequestPayload & Sender) => Maybe) | undefined

A request from the leaf of a chain that verifies, with an action matching its hash.

onApprovalGrantoptional
((g: ApprovalGrantPayload & Sender) => Maybe) | undefined

An approval signed by the sender. Pass it to decide, which checks the rest.

onApprovalDenyoptional
((d: ApprovalDenyPayload & Sender) => Maybe) | undefined
onRejectedoptional
((r: { type: string; sender: string; reasons: Reason[]; }) => Maybe) | undefined

A message that failed its checks, and why.