Communication
Access Control
Authorize inbound actor entrypoints with the canInvoke hook.
Use canInvoke to allow or deny inbound actor entrypoints.
This is authorization, not authentication:
- Use authentication to identify who is calling.
- Use
canInvoketo decide what they are allowed to do.
Supported Entrypoints
canInvoke runs for inbound:
- Actions (
kind: "action") - Queue sends (
kind: "queue") - Event subscriptions (
kind: "subscribe") - Raw HTTP handler requests (
kind: "request") - Raw WebSocket handler connections (
kind: "websocket")
Fail By Default
Structure canInvoke as fail-by-default:
- Add explicit allow rules with
ifstatements. - End with
return false.
TypeScript
Return Value Contract
canInvoke must return a boolean:
true: allow invocationfalse: deny invocation withforbidden
Returning undefined, null, or any non-boolean throws an internal error.
Hook Shape
TypeScript
Notes
- This hook applies to inbound client invocations.
- Denied invocations return
forbiddento the client.