Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,18 @@ public Boolean Encrypts
}
```

### Adherence to object oriented principles

We are committed to engineering excellence. We welcome creative and pioneering approaches, but we also understand that the most straightforward paths toward success are those paved by professionals who traveled before us. We observe and find great value in the [**SOLID** principles](https://en.wikipedia.org/wiki/SOLID). Our oversimplified statements of expectation with respect to **SOLID** are as follows.

- In most cases, your class or interface should serve one purpose. Don't reuse types for varying workloads.
- When it is meaningful to do so, provide ways for other developers to extend the behavior of your components without disrupting their original purpose.
- Derived types should be usable as instances of the type from which they are derived.
- Try not to create interfaces that do too many things (or, if you must, split them into distinct interfaces with smaller, related groups of functionality).
- Prefer dependency injection over self-composition whenever feasible. Ask for what you need in the constructor rather than creating it yourself.

There are good reasons to deviate from these guidelines and we do. Start a conversation when in doubt.

## Dependencies

The maintainers of **Solid Instruments** make every effort to minimize the inclusion of third-party dependencies. Several of the constituent libraries expose implementations of first-party abstractions for competing third-party product libraries. Those first-party abstractions are listed below with their accompanying implementations.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Security;
using System.Security.Cryptography;
using System.Text;
Expand Down Expand Up @@ -312,9 +311,10 @@ private Rfc2898DeriveBytes InitializePbkdf2Algorithm()

KeySource.Access(memory =>
{
var iterationSumBytes = memory.Take(Pbkdf2IterationSumLengthInBytes);
var saltBytes = memory.Skip(Pbkdf2IterationSumLengthInBytes).Take(Pbkdf2SaltLengthInBytes);
var passwordBytes = memory.Skip(Pbkdf2IterationSumLengthInBytes + Pbkdf2SaltLengthInBytes).Take(Pbkdf2PasswordLengthInBytes);
var memorySpan = memory.ReadOnlySpan;
var iterationSumBytes = memorySpan.Slice(0, Pbkdf2IterationSumLengthInBytes);
var saltBytes = memorySpan.Slice(Pbkdf2IterationSumLengthInBytes, Pbkdf2SaltLengthInBytes);
var passwordBytes = memorySpan.Slice(Pbkdf2IterationSumLengthInBytes + Pbkdf2SaltLengthInBytes, Pbkdf2PasswordLengthInBytes);
var iterationCount = Pbkdf2MinimumIterationCount;

foreach (var iterationSumValue in iterationSumBytes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,10 @@ protected sealed override Task LoadPersistedStateAsync(SecretVault inMemoryStore
/// <returns>
/// A task representing the asynchronous operation.
/// </returns>
protected sealed override Task PersistInMemoryStoreAsync(SecretVault inMemoryStore, IConcurrencyControlToken controlToken) => inMemoryStore.ExportAsync().ContinueWith(async exportTask =>
protected sealed override Task PersistInMemoryStoreAsync(SecretVault inMemoryStore, IConcurrencyControlToken controlToken) => inMemoryStore.ExportAsync().ContinueWith(exportTask =>
{
var inMemoryStoreCiphertext = ObscurityProcessor.EncryptToBase64String(exportTask.Result, ObscurityKey);
await PersistInMemoryStoreAsync(inMemoryStore.SemanticIdentity, inMemoryStoreCiphertext).ConfigureAwait(false);
PersistInMemoryStoreAsync(inMemoryStore.SemanticIdentity, inMemoryStoreCiphertext).Wait();
});

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,13 @@ public void RegisterMessageHandler(Action<PrimitiveMessage> handleMessageAction)
/// </exception>
public Task SendAsync(PrimitiveMessage message) => EntityType switch
{
MessagingEntityType.Queue => EnsureQueueExistanceAsync(Path).ContinueWith(async ensureQueueExistenceTask =>
MessagingEntityType.Queue => EnsureQueueExistanceAsync(Path).ContinueWith(ensureQueueExistenceTask =>
{
await Connection.Transport.SendToQueueAsync(Path, message).ConfigureAwait(false);
Connection.Transport.SendToQueueAsync(Path, message).Wait();
}),
MessagingEntityType.Topic => EnsureTopicExistanceAsync(Path).ContinueWith(async ensureTopicExistenceTask =>
MessagingEntityType.Topic => EnsureTopicExistanceAsync(Path).ContinueWith(ensureTopicExistenceTask =>
{
await Connection.Transport.SendToTopicAsync(Path, message).ConfigureAwait(false);
Connection.Transport.SendToTopicAsync(Path, message).Wait();
}),
_ => throw new UnsupportedSpecificationException($"The specified messaging entity type, {EntityType}, is not supported.")
};
Expand Down