Desktop: let a lock pressed during an unlock win, instead of the unlock finishing behind it

This commit is contained in:
jaap-jan committed 2026-10-02 14:37:52 +02:00
1 parent 37e9d74938
commit 079a273d46
3 files changed
+99 -6

No files matched your search

@@ -25,8 +25,18 @@ internal sealed class FakeDeviceKeyStore : IDeviceKeyStore
internal void Overwrite(byte[] replacement) => key = replacement;
/// <inheritdoc />
public ValueTask<bool> IsAvailableAsync(CancellationToken cancellationToken) =>
ValueTask.FromResult(IsAvailable);
public async ValueTask<bool> IsAvailableAsync(CancellationToken cancellationToken)
{
if (HoldAvailability is { } hold)
{
await hold.WaitAsync(cancellationToken).ConfigureAwait(false);
}
return IsAvailable;
}
/// <summary>When set, availability is not answered until it completes: an unlock held part-way.</summary>
internal Task? HoldAvailability { get; set; }
/// <inheritdoc />
public ValueTask SaveAsync(ReadOnlyMemory<byte> devicePrivateKey, CancellationToken cancellationToken)