using DodoSSH.Client.Domain;
using DodoSSH.Client.Storage;
namespace DodoSSH.Client.Sync;
///
/// The host keys this vault trusts, decrypted, with unpushed local changes laid over them.
///
///
///
/// The fourth facade over the same generic repository, and it needed no new sync logic at all — which was the
/// point of the item-kind seam.
///
///
/// Nothing here is on the SSH handshake path. Listing decrypts every pin in the vault, and the
/// handshake asks about host key trust from inside a synchronous SSH.NET event where a decryption per lookup
/// would be I/O and AEAD work on the thread completing the key exchange. VaultKnownHostStore exists to
/// keep those apart: it reads through here when a vault opens and after each synchronisation pass, and answers
/// the handshake from an in-memory snapshot.
///
///
public sealed class KnownHostRepository(
ItemStore items,
OutboxStore outbox,
VaultKeyring keyring,
IActivityLogSink? activity = null)
{
private readonly VaultItemRepository knownHosts =
new(KnownHostKeyKind.Instance, items, outbox, keyring, activity);
///
public Task> ListAsync(
Guid vaultId,
CancellationToken cancellationToken) =>
knownHosts.ListAsync(vaultId, cancellationToken);
///
public Task CreateAsync(
Guid vaultId,
KnownHostSecret knownHost,
CancellationToken cancellationToken) =>
knownHosts.CreateAsync(vaultId, knownHost, cancellationToken);
///
public Task UpdateAsync(
Guid vaultId,
Guid entityId,
KnownHostSecret knownHost,
CancellationToken cancellationToken) =>
knownHosts.UpdateAsync(vaultId, entityId, knownHost, cancellationToken);
///
public Task DeleteAsync(Guid vaultId, Guid entityId, CancellationToken cancellationToken) =>
knownHosts.DeleteAsync(vaultId, entityId, cancellationToken);
}