Themia.Conversations 0.48.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Themia.Conversations --version 0.48.0
                    
NuGet\Install-Package Themia.Conversations -Version 0.48.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Themia.Conversations" Version="0.48.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Themia.Conversations" Version="0.48.0" />
                    
Directory.Packages.props
<PackageReference Include="Themia.Conversations" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Themia.Conversations --version 0.48.0
                    
#r "nuget: Themia.Conversations, 0.48.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Themia.Conversations@0.48.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Themia.Conversations&version=0.48.0
                    
Install as a Cake Addin
#tool nuget:?package=Themia.Conversations&version=0.48.0
                    
Install as a Cake Tool

Themia.Conversations

A per-object chat for members and guests: tenant-scoped conversations, participants, messages and attachments. Design: docs/superpowers/specs/2026-10-29-themia-conversations-design.md.

Status: the store and guests. Schema, engine packages, options and the default-deny policy shipped first; this part adds IConversationService (open, join, post, list, mark read, close) and the transaction-aware IConversationEventSink. Guest invites, the token exchange and read-time masking are in; self-service re-invite, notification delivery, retention and erasure, export and the ASP.NET Core endpoints follow in later releases.

services.AddThemiaConversations(o => o.DefaultRetention = TimeSpan.FromDays(180));   // limits + retention; default-deny policy
services.AddThemiaConversationsPostgres(connectionString);                           // dialect + runs the migration

var opened = await conversations.OpenAsync(actor, tenantId, new ConversationSubject("booking", "B-1"));
await conversations.JoinAsync(actor, tenantId, opened.ConversationId!.Value, "Somchai");
var posted = await conversations.PostAsync(actor, tenantId, opened.ConversationId.Value, new PostMessage(clientMessageId, "hello"));
  • Every call takes the Actor and the tenant. Order inside a call: access policy, then the acting participant is resolved inside the transaction (this tenant and conversation, not left, kind matching the actor; a guest is proved by the hash of the GuestSessionKey it holds: unexpired, not revoked, participant not left, this tenant and conversation, checked inside the same transaction), then the idempotency read, the sequence counter, the inserts. A denied call, a stranger and another tenant's conversation all answer Refused.

  • Post is ordered and idempotent. Seq is dense per conversation: the counter row lock serialises posters (PostgreSQL RETURNING, SQL Server OUTPUT, MySQL LAST_INSERT_ID(expr)). The same ClientMessageId returns Duplicate with the original message and overwrites nothing. A deadlock or lock timeout retries the whole transaction up to three times.

  • Events. The default IConversationEventSink writes a conversation_events row (ids and Seq, never the text) in the post transaction, so a failed post leaves none; register your own sink to enlist elsewhere. Draining and debouncing the rows is a later part.

  • Padded keys are refused. Tenant, subject, user reference and client message id with leading or trailing whitespace throw ArgumentException: MySQL and SQL Server compare strings without trailing spaces, PostgreSQL does not.

  • Member and partner references never collide. user_ref is stored with a kind prefix (m: member, p: partner), so member 42 and partner 42 are two participants; a data-subject lookup by reference must use the same form. A reference may be at most 198 characters.

  • Limits. The body cap counts string.Length (UTF-16 units). The per-participant post rate limit belongs to the ASP.NET Core part, with the other limits.

  • System actors are not resolved to a participant yet (system lines arrive with the retention part).

  • Access policy. IConversationAccessPolicy denies everything until you register your own; every later service call asks it first.

  • Tenant isolation is in the schema. Every table carries tenant_id; each child binds its parent on (tenant_id, conversation_id, ...), so a row cannot point at another tenant's, or another conversation's, participant or message. The compared string columns use a byte-exact collation on MySQL and SQL Server (Acme and acme are different tenants).

  • Retention is a setting, pending counsel review: 180 days after the subject closes by default, per SubjectType if you list it. Do not treat the number as decided.

  • MariaDB is not supported, like the rest of Themia.

Guests

A guest is a participant invited by contact (e-mail, E.164 phone or LINE id). The app sends the link; the core only issues the token.

services.AddThemiaChallenges(o => o.ConfigureConversationGuestPurpose(TimeSpan.FromHours(72)));   // + one Challenges engine registration
services.AddThemiaConversationGuests(o =>
{
    o.Peppers["2026-10"] = pepperBytes;      // >= 32 random bytes from your secret store
    o.CurrentPepperId = "2026-10";
});

var invite = await guests.InviteAsync(memberActor, tenantId, conversationId, new GuestContact(GuestContactKind.Email, "guest@example.com"), "Guest");
// hand invite.Token!.Reveal() to your sender; never store or log it (Token and the contact have no property that returns their text, so logging an invite or a contact does not write them out)
var session = await guestAccess.ExchangeAsync(tenantId, tokenFromThePostedForm);          // POST only
var actor = ConversationActor.ForGuest(new GuestSessionKey(cookieValue));
  • The session is the only way to act as a guest. ExchangeAsync redeems the token (one use) and returns a 256-bit key once; the store keeps only its SHA-256. Every call with a guest actor re-proves the session in the same statement, so leaving the conversation, closing it, expiry or revocation end access at once. GuestSessionKey has no member that returns the text, so logging or serialising an actor does not leak it. Session length is SessionLifetime (default 7 days, an interim value).
  • Redeem from a POST, never a GET: mail and chat link previewers fetch URLs and would spend the token. Move the token out of the URL, send Cache-Control: no-store and Referrer-Policy: no-referrer, and rate-limit the endpoint by address and tenant (the .AspNetCore part will).
  • Revocation is read-then-write. A post already in flight can commit after a concurrent redeem revoked its key; the next call is refused.
  • One live link per guest. A re-invite supersedes the earlier link ("the old link stopped working" is expected). The guest's earlier sessions end when the new link is redeemed, not when it is issued, so someone who only knows a contact cannot log the guest out. Every failed exchange is one Refused.
  • Limits are layered. Themia.Challenges throttles per participant. The core adds MaxGuestsPerConversation (default 50). Per-contact and per-inviter delivery throttling (SMS pumping) belongs to the sender you write.
  • Contacts are hashed, never stored. HMAC-SHA256 under a versioned pepper over kind:value; an e-mail is lower-cased, a phone must be E.164 (a national form would make one person two guests), a LINE id keeps its case. Never remove a pepper id while any row carries it: the guest would not be found, a re-invite would add a second participant and a data-subject lookup would miss the person. Rotate by adding an id and making it current; a guest is re-hashed when next invited.
  • Masking is a read-time projection (IConversationMasker, default regex): for a guest viewer e-mail, phone numbers and handles in the text are replaced and staff show their role label (or "Staff"). Best effort, not a control. If the masker throws, the body is hidden ([message hidden]), never shown raw. The stored text stays whole.
  • A guest who left is not re-added by an invite; a call to add them back arrives with the retention part.
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on Themia.Conversations:

Package Downloads
Themia.Conversations.SqlServer

SQL Server dialect + Microsoft.Data.SqlClient driver + FluentMigrator runner for Themia.Conversations.

Themia.Conversations.PostgreSql

PostgreSQL dialect + Npgsql driver + FluentMigrator runner for Themia.Conversations.

Themia.Conversations.MySql

MySQL 8.0.13+ dialect + MySqlConnector driver + FluentMigrator runner for Themia.Conversations.

Themia.Conversations.AspNetCore

HTTP surface for Themia.Conversations: minimal-API endpoints for the guest link exchange, listing, posting (JSON and multipart), read marks and attachment download, with a per-conversation guest cookie, a CSRF header, boundary validation and built-in rate limits. The host supplies identity; the package never decides it.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.69.0 53 11/18/2026
0.68.0 42 11/18/2026
0.67.2 73 11/18/2026
0.67.1 68 11/18/2026
0.67.0 78 11/17/2026
0.66.0 104 11/17/2026
0.65.0 138 11/16/2026
0.64.0 133 11/15/2026
0.63.2 138 11/15/2026
0.63.1 132 11/14/2026
0.63.0 121 11/14/2026
0.62.1 123 11/14/2026
0.62.0 123 11/14/2026
0.61.1 136 11/14/2026
0.61.0 122 11/13/2026
0.60.0 187 11/10/2026
0.59.0 141 11/10/2026
0.58.0 144 11/9/2026
0.57.2 149 11/8/2026
0.48.0 155 10/30/2026
Loading failed