Room and media permissions, encoded as the video claim of a LiveKit JWT.
Field names are snake_case Elixir; LiveKit.Grants.to_claims/1 maps them to
the camelCase names LiveKit expects on the wire.
iex> LiveKit.Grants.to_claims(%LiveKit.Grants.Video{room_join: true, room: "lobby"})
%{"room" => "lobby", "roomJoin" => true}Every field defaults to nil, meaning "unset", and unset fields are omitted
from the token. This matters for the permission fields (can_publish,
can_subscribe, can_publish_data, can_update_own_metadata,
can_subscribe_metrics, can_manage_agent_session) where LiveKit applies a
non-false default when the claim is missing, so an explicit false is
preserved:
iex> LiveKit.Grants.to_claims(%LiveKit.Grants.Video{room_join: true, can_publish: false})
%{"roomJoin" => true, "canPublish" => false}
Summary
Functions
Mapping from struct field to LiveKit JWT claim key.
Types
@type t() :: %LiveKit.Grants.Video{ agent: boolean() | nil, can_manage_agent_session: boolean() | nil, can_publish: boolean() | nil, can_publish_data: boolean() | nil, can_publish_sources: [track_source()] | nil, can_subscribe: boolean() | nil, can_subscribe_metrics: boolean() | nil, can_update_own_metadata: boolean() | nil, destination_room: String.t() | nil, hidden: boolean() | nil, ingress_admin: boolean() | nil, recorder: boolean() | nil, room: String.t() | nil, room_admin: boolean() | nil, room_create: boolean() | nil, room_join: boolean() | nil, room_list: boolean() | nil, room_record: boolean() | nil }
@type track_source() :: String.t()