/// <inheritdoc /> public async Task <ISafeByte> GetByByteAsync(byte @byte) { await EnsureInitializedAsync().ConfigureAwait(false); var id = await _byteIdGenerator .GenerateAsync(@byte) //Do not skip or cache this step to minimize the amount of time for ids to be seen. .ConfigureAwait(false); return(_safeBytesDictionary.Object[id]); }
/// <inheritdoc /> /// <inheritdoc cref="DisposableBase.ThrowIfDisposed"/> /// <inheritdoc cref="EnsureByteIsNotSet"/> public async Task SetAsync(byte b) { ThrowIfDisposed(); EnsureByteIsNotSet(); // Generate ID _id = await _byteIdGenerator.GenerateAsync(b) .ConfigureAwait(false); // Encrypt await InitializeAsync(b).ConfigureAwait(false); IsByteSet = true; }