You've already forked tribes-plugin-aether
forked from tribes/tribes-plugin-template
c1f4339dde
Use TribeOne.TribesPlugin.Aether modules throughout the plugin and expose chat@1 from the entry module for capability-based consumers.
42 lines
1.1 KiB
Elixir
42 lines
1.1 KiB
Elixir
defmodule TribeOne.TribesPlugin.Aether.Chat.Backends.Marmot do
|
|
@moduledoc """
|
|
Marmot/MLS group backend scaffold.
|
|
|
|
Marmot events should be stored canonically as Parrhesia/Nostr events while the
|
|
browser/client maintains MLS state. The current web UI does not claim true E2EE.
|
|
"""
|
|
|
|
@behaviour TribeOne.TribesPlugin.Aether.Chat.Backend
|
|
|
|
alias TribeOne.TribesPlugin.Aether.Chat
|
|
alias TribeOne.TribesPlugin.Aether.Chat.Channel
|
|
|
|
@impl true
|
|
def capabilities do
|
|
%{
|
|
canonical_store: :parrhesia_events,
|
|
nostr_compatible?: true,
|
|
non_custodial_signing?: true,
|
|
conversation_kinds: [:marmot_group],
|
|
read_only?: false,
|
|
required_protocols: [:marmot, :mls]
|
|
}
|
|
end
|
|
|
|
@impl true
|
|
def ensure_conversation(attrs, opts) when is_map(attrs) do
|
|
attrs
|
|
|> Map.put(:backend, :marmot)
|
|
|> Chat.ensure_channel(opts)
|
|
end
|
|
|
|
@impl true
|
|
def list_messages(%Channel{}, _opts), do: {:ok, []}
|
|
|
|
@impl true
|
|
def send_message(%Channel{}, _attrs, _opts), do: {:error, :not_implemented}
|
|
|
|
@impl true
|
|
def subscribe(%Channel{} = channel, _pid, _opts), do: Chat.subscribe_channel(channel)
|
|
end
|