Issho.Identity (Issho v0.1.0)

Copy Markdown View Source

An actor as a room knows it: its key, what others see of it, and on whose behalf it acts.

Issho builds one from an Issho.Actor when an actor joins (new/2), signs it into the join token, and gives it to your policy's Issho.Policy.authorize/3. claims is a small map of your own that travels with it (a tenant's id, a plan), so that a policy can answer without reading your database on every message.

Summary

Functions

The identity of an actor. Options: :on_behalf_of, another actor (an agent acting for a person), and :claims.

The identity as the other people of a room receive it: string keys, no claims, and the palette index of an actor with no colour of its own.

Types

kind()

@type kind() :: :human | :agent | :service

t()

@type t() :: %Issho.Identity{
  avatar: String.t() | nil,
  claims: map(),
  color: String.t() | nil,
  key: String.t(),
  kind: kind(),
  name: String.t() | nil,
  on_behalf_of: t() | nil
}

Functions

new(actor, opts \\ [])

@spec new(Issho.Actor.t() | t(), keyword()) :: t()

The identity of an actor. Options: :on_behalf_of, another actor (an agent acting for a person), and :claims.

public(identity)

@spec public(t()) :: map()

The identity as the other people of a room receive it: string keys, no claims, and the palette index of an actor with no colour of its own.