This commit is contained in:
HueByte
2026-07-16 18:34:55 +00:00
parent c7f47c5104
commit dfbe5be317
34 changed files with 3098 additions and 86 deletions
@@ -6,7 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="title" content="Class RoomKeyStore | EchoHub Documentation ">
<meta name="description" content="Holds room content keys for end-to-end encrypted channels: in-memory for the active session, persisted per-server in the client config (like saved sessions) so users don&#39;t retype the passphrase every launch. Keys never leave this machine.">
<meta name="description" content="Holds room content keys for end-to-end encrypted channels: in-memory for the active session, persisted per-server in the client config (like saved sessions) so users don&#39;t retype the passphrase every launch. Keys never leave this machine and are encrypted at rest by . Also tracks which channels are known to be end-to-end encrypted, so senders can refuse to emit plaintext into a room whose key isn&#39;t cached yet.">
<link rel="icon" href="../../images/hue_icon.svg">
<link rel="stylesheet" href="../../public/docfx.min.css">
<link rel="stylesheet" href="../../public/main.css">
@@ -99,7 +99,10 @@ Class RoomKeyStore <a class="header-action link-secondary" title="View source"
<div class="markdown summary"><p>Holds room content keys for end-to-end encrypted channels: in-memory for the
active session, persisted per-server in the client config (like saved sessions)
so users don't retype the passphrase every launch. Keys never leave this machine.</p>
so users don't retype the passphrase every launch. Keys never leave this machine
and are encrypted at rest by <a class="xref" href="EchoHub.Client.Services.RoomKeyProtector.html">RoomKeyProtector</a>. Also tracks which
channels are known to be end-to-end encrypted, so senders can refuse to emit
plaintext into a room whose key isn't cached yet.</p>
</div>
<div class="markdown conceptual"></div>
@@ -178,6 +181,37 @@ so users don't retype the passphrase every launch. Keys never leave this machine
<a id="EchoHub_Client_Services_RoomKeyStore__ctor_" data-uid="EchoHub.Client.Services.RoomKeyStore.#ctor*"></a>
<h3 id="EchoHub_Client_Services_RoomKeyStore__ctor_EchoHub_Client_Services_RoomKeyProtector_" data-uid="EchoHub.Client.Services.RoomKeyStore.#ctor(EchoHub.Client.Services.RoomKeyProtector)">
RoomKeyStore(RoomKeyProtector)
<a class="header-action link-secondary" title="View source" href="https://github.com/HueByte/EchoHub/blob/master/src/EchoHub.Client/Services/RoomKeyStore.cs"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public RoomKeyStore(RoomKeyProtector protector)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>protector</code> <a class="xref" href="EchoHub.Client.Services.RoomKeyProtector.html">RoomKeyProtector</a></dt>
<dd></dd>
</dl>
<h2 class="section" id="methods">Methods
</h2>
@@ -244,6 +278,42 @@ so users don't retype the passphrase every launch. Keys never leave this machine
<a id="EchoHub_Client_Services_RoomKeyStore_IsChannelEncrypted_" data-uid="EchoHub.Client.Services.RoomKeyStore.IsChannelEncrypted*"></a>
<h3 id="EchoHub_Client_Services_RoomKeyStore_IsChannelEncrypted_System_String_" data-uid="EchoHub.Client.Services.RoomKeyStore.IsChannelEncrypted(System.String)">
IsChannelEncrypted(string)
<a class="header-action link-secondary" title="View source" href="https://github.com/HueByte/EchoHub/blob/master/src/EchoHub.Client/Services/RoomKeyStore.cs"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"></div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public bool IsChannelEncrypted(string channelName)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>channelName</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd></dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></dt>
<dd></dd>
</dl>
<a id="EchoHub_Client_Services_RoomKeyStore_LoadForServer_" data-uid="EchoHub.Client.Services.RoomKeyStore.LoadForServer*"></a>
<h3 id="EchoHub_Client_Services_RoomKeyStore_LoadForServer_System_String_" data-uid="EchoHub.Client.Services.RoomKeyStore.LoadForServer(System.String)">
@@ -276,6 +346,42 @@ so users don't retype the passphrase every launch. Keys never leave this machine
<a id="EchoHub_Client_Services_RoomKeyStore_MarkChannelEncrypted_" data-uid="EchoHub.Client.Services.RoomKeyStore.MarkChannelEncrypted*"></a>
<h3 id="EchoHub_Client_Services_RoomKeyStore_MarkChannelEncrypted_System_String_System_Boolean_" data-uid="EchoHub.Client.Services.RoomKeyStore.MarkChannelEncrypted(System.String,System.Boolean)">
MarkChannelEncrypted(string, bool)
<a class="header-action link-secondary" title="View source" href="https://github.com/HueByte/EchoHub/blob/master/src/EchoHub.Client/Services/RoomKeyStore.cs"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Records whether a channel is end-to-end encrypted (from channel listings, crypto
metadata, or join outcomes). Senders consult this to block plaintext into rooms
whose key isn't cached.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public void MarkChannelEncrypted(string channelName, bool isEncrypted)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>channelName</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd></dd>
<dt><code>isEncrypted</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></dt>
<dd></dd>
</dl>
<a id="EchoHub_Client_Services_RoomKeyStore_RemoveKey_" data-uid="EchoHub.Client.Services.RoomKeyStore.RemoveKey*"></a>
<h3 id="EchoHub_Client_Services_RoomKeyStore_RemoveKey_System_String_" data-uid="EchoHub.Client.Services.RoomKeyStore.RemoveKey(System.String)">
@@ -379,6 +485,50 @@ so users don't retype the passphrase every launch. Keys never leave this machine
<a id="EchoHub_Client_Services_RoomKeyStore_TryStoreFromEnvelope_" data-uid="EchoHub.Client.Services.RoomKeyStore.TryStoreFromEnvelope*"></a>
<h3 id="EchoHub_Client_Services_RoomKeyStore_TryStoreFromEnvelope_System_String_System_String_System_Byte___" data-uid="EchoHub.Client.Services.RoomKeyStore.TryStoreFromEnvelope(System.String,System.String,System.Byte[])">
TryStoreFromEnvelope(string, string, byte[])
<a class="header-action link-secondary" title="View source" href="https://github.com/HueByte/EchoHub/blob/master/src/EchoHub.Client/Services/RoomKeyStore.cs"><i class="bi bi-code-slash"></i></a>
</h3>
<div class="markdown level1 summary"><p>Unwraps a fresh key envelope and caches the key, overwriting any stale cached key
(e.g. the channel was deleted and recreated under the same name, so the old key
would encrypt messages nobody else can read). Returns false when the KEK doesn't
open the envelope — the cache is left untouched.</p>
</div>
<div class="markdown level1 conceptual"></div>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public bool TryStoreFromEnvelope(string channelName, string wrappedRoomKey, byte[] kek)</code></pre>
</div>
<h4 class="section">Parameters</h4>
<dl class="parameters">
<dt><code>channelName</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd></dd>
<dt><code>wrappedRoomKey</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.string">string</a></dt>
<dd></dd>
<dt><code>kek</code> <a class="xref" href="https://learn.microsoft.com/dotnet/api/system.byte">byte</a>[]</dt>
<dd></dd>
</dl>
<h4 class="section">Returns</h4>
<dl class="parameters">
<dt><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></dt>
<dd></dd>
</dl>
</article>