Themia.Conversations
0.49.0
See the version list below for details.
dotnet add package Themia.Conversations --version 0.49.0
NuGet\Install-Package Themia.Conversations -Version 0.49.0
<PackageReference Include="Themia.Conversations" Version="0.49.0" />
<PackageVersion Include="Themia.Conversations" Version="0.49.0" />
<PackageReference Include="Themia.Conversations" />
paket add Themia.Conversations --version 0.49.0
#r "nuget: Themia.Conversations, 0.49.0"
#:package Themia.Conversations@0.49.0
#addin nuget:?package=Themia.Conversations&version=0.49.0
#tool nuget:?package=Themia.Conversations&version=0.49.0
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
Actorand 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 theGuestSessionKeyit 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 answerRefused.Post is ordered and idempotent.
Seqis dense per conversation: the counter row lock serialises posters (PostgreSQLRETURNING, SQL ServerOUTPUT, MySQLLAST_INSERT_ID(expr)). The sameClientMessageIdreturnsDuplicatewith the original message and overwrites nothing. A deadlock or lock timeout retries the whole transaction up to three times.Events. The default
IConversationEventSinkwrites aconversation_eventsrow (ids andSeq, 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_refis 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.
IConversationAccessPolicydenies 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 (Acmeandacmeare different tenants).Retention is a setting, pending counsel review: 180 days after the subject closes by default, per
SubjectTypeif 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.
ExchangeAsyncredeems 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.GuestSessionKeyhas no member that returns the text, so logging or serialising an actor does not leak it. Session length isSessionLifetime(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-storeandReferrer-Policy: no-referrer, and rate-limit the endpoint by address and tenant (the.AspNetCorepart 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.Challengesthrottles per participant. The core addsMaxGuestsPerConversation(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 | Versions 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. |
-
net10.0
- Dapper (>= 2.1.79)
- FluentMigrator (>= 8.0.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.9)
- Microsoft.Extensions.DependencyInjection (>= 10.0.9)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Logging (>= 10.0.9)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Options (>= 10.0.9)
- Themia.Challenges (>= 0.49.0)
-
net8.0
- Dapper (>= 2.1.79)
- FluentMigrator (>= 8.0.1)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.9)
- Microsoft.Extensions.DependencyInjection (>= 10.0.9)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Logging (>= 10.0.9)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.9)
- Microsoft.Extensions.Options (>= 10.0.9)
- Themia.Challenges (>= 0.49.0)
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 | 65 | 11/18/2026 |
| 0.68.0 | 53 | 11/18/2026 |
| 0.67.2 | 82 | 11/18/2026 |
| 0.67.1 | 79 | 11/18/2026 |
| 0.67.0 | 88 | 11/17/2026 |
| 0.66.0 | 113 | 11/17/2026 |
| 0.65.0 | 147 | 11/16/2026 |
| 0.64.0 | 143 | 11/15/2026 |
| 0.63.2 | 147 | 11/15/2026 |
| 0.63.1 | 141 | 11/14/2026 |
| 0.63.0 | 131 | 11/14/2026 |
| 0.62.1 | 132 | 11/14/2026 |
| 0.62.0 | 133 | 11/14/2026 |
| 0.61.1 | 145 | 11/14/2026 |
| 0.61.0 | 131 | 11/13/2026 |
| 0.60.0 | 187 | 11/10/2026 |
| 0.59.0 | 142 | 11/10/2026 |
| 0.58.0 | 144 | 11/9/2026 |
| 0.57.2 | 149 | 11/8/2026 |
| 0.49.0 | 153 | 10/31/2026 |