Lumoin.Base
0.0.5
See the version list below for details.
dotnet add package Lumoin.Base --version 0.0.5
NuGet\Install-Package Lumoin.Base -Version 0.0.5
<PackageReference Include="Lumoin.Base" Version="0.0.5" />
<PackageVersion Include="Lumoin.Base" Version="0.0.5" />
<PackageReference Include="Lumoin.Base" />
paket add Lumoin.Base --version 0.0.5
#r "nuget: Lumoin.Base, 0.0.5"
#:package Lumoin.Base@0.0.5
#addin nuget:?package=Lumoin.Base&version=0.0.5
#tool nuget:?package=Lumoin.Base&version=0.0.5
<img style="display: block; margin-inline-start: auto; margin-inline-end: auto;" src="resources/lumoin-base-github-logo.svg" width="600" alt="Lumoin.Base project logo: a circular emblem of concentric dashed arcs in blue hues evoking layered bedrock, followed by the wordmark 'base'.">
Lumoin.Base
Dependency-free primitives shared across the Lumoin family of .NET libraries.
Lumoin.Base holds the small set of primitives that every Lumoin library needs and none of them should own. It is dependency-free and AOT-, trim-, and browser-clean, so any family member — including browser/WASM builds — can consume it, and no member depends on another.
The repository ships two packages. Lumoin.Base is the dependency-free leaf: BaseMemoryPool,
an exact-size, zero-on-return MemoryPool<byte> whose caller chooses how each buffer is backed
(Managed, Pinned, or Native), and Tag, an immutable type-keyed metadata container. The
native tier is an injection seam (NativeBackingAllocator), never a compiled-in dependency.
Lumoin.Base.Sodium is the non-browser libsodium implementation of that seam: wiring
SodiumBacking.Allocate into a pool serves AllocationKind.Native rents as per-rent isolated
sodium_malloc guarded allocations — canary, guard pages, best-effort memory locking, zero on
free. The binding is RID-agnostic and carries no native binaries; the libsodium library itself is
resolved at runtime from family-built native asset packages.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- No dependencies.
NuGet packages (35)
Showing the top 5 NuGet packages that depend on Lumoin.Base:
| Package | Downloads |
|---|---|
|
Lumoin.Verisync.Core
Core primitives for Lumoin.Verisync: replica identity, causal contexts, version vectors, dot stores, base CRDT shapes, and the consensus registers - the QuePaxa versioned register with dynamic membership and readiness reporting, and the Fast CASPaxos rewritable register. |
|
|
Lumoin.Veridical.Core
Core primitives for Lumoin.Veridical: field arithmetic, group operations, polynomial primitives, transcripts, and base proof-system shapes. |
|
|
Lumoin.Verisync.Cbor
System.Formats.Cbor serialization adapters for Lumoin.Verisync message channels. Deterministic canonical CBOR for digest-stable encoding. |
|
|
Lumoin.Verisync.Json
System.Text.Json serialization adapters for Lumoin.Verisync message channels and the QuePaxa consensus wire messages. AOT-safe; channel records use source-generated JsonTypeInfo. |
|
|
Lumoin.Veridical.Hashing
Managed hash implementations for Lumoin.Veridical. Currently ships BLAKE3 with per-ISA backends; additional hash functions land here as use cases arise. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.0.15 | 385 | 11/10/2026 |
| 0.0.14 | 551 | 9/13/2026 |
| 0.0.13 | 152 | 9/10/2026 |
| 0.0.12 | 238 | 9/2/2026 |
| 0.0.11 | 181 | 9/2/2026 |
| 0.0.10 | 187 | 9/1/2026 |
| 0.0.9 | 1,544 | 8/12/2026 |
| 0.0.8 | 328 | 7/27/2026 |
| 0.0.7 | 305 | 7/22/2026 |
| 0.0.6 | 332 | 7/11/2026 |
| 0.0.5 | 155 | 7/10/2026 |
| 0.0.4 | 547 | 6/27/2026 |
| 0.0.3 | 156 | 6/27/2026 |
| 0.0.2 | 627 | 6/15/2026 |
| 0.0.1 | 149 | 6/15/2026 |
Added:
- Initial package: `Lumoin.Base`. Bedrock primitives shared across the Lumoin family.
- `BaseMemoryPool`: a `MemoryPool<byte>` that lets the caller choose how a buffer is backed
through an `AllocationKind` passed at rent time (`Managed`, `Pinned`, `Native`), with exact-size
slabs, deterministic zero-on-return, and OpenTelemetry metrics. Native backing is injected through
the `NativeBackingAllocator` seam, keeping the assembly dependency-free and AOT / trim /
browser-clean. A `Native` rent with no backing wired throws by default; the graceful fallback to
`Pinned` is an explicit opt-in (`allowNativeDegradation`) and telemetry records the effective
allocation kind plus a degradation event.
- `Tag`: a metadata container for purpose-specific classification of pooled memory.
- `SlabBufferWriter`: an `IBufferWriter<byte>` over a `MemoryPool<byte>` (e.g. `BaseMemoryPool`) that grows by
renting linked slabs and `Detach()`-es into a single exact-length owned buffer — the streaming-serialization
sink for the family, so writers never pre-size and never copy-to-grow.
- `SensitiveMemory` / `SensitiveData`: a domain-agnostic base for a pooled, `Tag`-carrying block of sensitive
bytes that exposes only read-only views and clears its memory on disposal — so a naked `byte[]` never crosses a
public boundary and potentially sensitive (e.g. reporting) bytes are wiped deterministically. Construction
optionally accepts an OpenTelemetry `Activity` bounding the value's lifetime.
- `EmptyMemoryOwner`: a shared, allocation-free `IMemoryOwner<byte>` singleton over a zero-length buffer with a
no-op dispose — the stand-in for empty payloads where a pool would reject a zero-size rental, and recognized by
`SensitiveMemory` so shared `Empty` singletons are never wiped or poisoned.
- `SensitiveMemoryTelemetry`: the telemetry tag-key (`sensitive_memory.lifetime_ms`) the sensitive-memory
primitives emit on the lifetime span.
- `Utf8String`: a non-owning, byte-native UTF-8 string value type (`readonly struct` over `ReadOnlyMemory<byte>`)
for encoding and I/O boundaries — byte-defined equality/ordering with an optionally precomputed hash, zero-copy
`Slice`/`Range` views, byte-search helpers, `IUtf8SpanFormattable`/`ISpanFormattable`, and an explicit
`TryFromUtf8` validating factory (construction itself does not validate).
- `Utf8StringComparer`: equality, ordering, and zero-allocation alternate lookup by raw `ReadOnlySpan<byte>` for
`Utf8String` (`IAlternateEqualityComparer`), so a `HashSet`/`Dictionary`/`FrozenSet` of `Utf8String` is probed
with a `u8` literal or wire span without allocating. `Create(Utf8HashFunction)` swaps in a deterministic hash for
bucketing that is stable across processes.
- `Utf8StringPool`: a single-writer arena that interns UTF-8 bytes into bulk-freed slabs rented from a
`MemoryPool<byte>` (default a private `BaseMemoryPool`), with zero-allocation probing on a cache hit, a chosen
`AllocationKind` for how interned memory is protected, UTF-8 validation on by default (opt out with
`validateOnIntern: false`), OpenTelemetry metrics via `Utf8StringPoolMetrics`, and an optional static,
application-installed `Instance` ambient pool (the library never creates one implicitly). Materialization is
pool-only — there is no heap-allocating factory; `Utf8String` either views caller memory or is interned.
- `Utf8StringPool.Reset()`: bulk-reclaims all interned memory and clears the table so the pool can be reused
without being recreated, with the same "no live views" contract as disposal — a cheap shrink for scoped reuse.
- `Utf8StringInterner`: a process-wide, thread-safe interner for recurring UTF-8 bytes and .NET strings — the
concurrent, self-bounding counterpart to `Utf8StringPool`. Values live in hot/cold generations and the cold one
is evicted when the hot fills, bounding the live set to about twice a configured capacity; eviction is safe
because interned memory is managed and an outstanding `Utf8String` keeps its own bytes alive (the GC reclaims
only once no view remains), so it never dangles a value already handed out. Cache hits are lock-free; `Clear()`
drops everything; an optional static, application-installed `Instance` mirrors the pool's ambient. Managed-only
by design (it relies on GC liveness, so no `Native`/`Pinned` backing). Optional OpenTelemetry metrics via
`Utf8StringInternerMetrics` (intern, hit, and rotation counters plus a live-count gauge), and an optional maximum
value length that returns oversized values uncached so no single value can bloat the resident set.
- New package `Lumoin.Base.Sodium`: the libsodium implementation of the `NativeBackingAllocator`
seam. Wiring `SodiumBacking.Allocate` into a `BaseMemoryPool` serves `AllocationKind.Native`
rents as per-rent isolated `sodium_malloc` guarded allocations — canary, guard pages, best-effort
memory locking, and zero on free — with `sodium_memzero` defense-in-depth and a finalizer
backstop on the owner. The managed binding is RID-agnostic and carries no native assets; the
libsodium native library is resolved at runtime (family-built native asset packages to follow),
and `SodiumBacking.IsAvailable` reports whether it loaded so hosts wire the backing only where
it exists.
- Protected-slab native tier: `BaseMemoryPool` gains a pool-level `NativeRentMode`
(`PerRentIsolated`, the default, or `ProtectedSlab`). In protected-slab mode injected backing
regions are allocated on demand per buffer size, each subdivided into exact-size segments
bracketed by per-segment software canaries (verified on return; a stomped canary zeroes the
secret, retires the segment,
records the `Lumoin.BaseMemoryPool.CanaryViolationsTotal` counter and a `CanaryViolation`
activity event, and surfaces as the new `CanaryViolationException`). Density in place of
per-secret hardware guards: hundreds of transient secrets fit a locked-memory budget that holds
only a handful of isolated allocations. Native rent activities now carry a `nativeRentMode` tag,
and `TrimExcess` reclaims idle protected regions.
Changed:
- `SensitiveMemory`: documented the wipe's threat model — exposure it reduces versus what it cannot defend, and
that the wipe is only fully reliable on non-relocatable (`Pinned`/`Native`) backing.
- `SensitiveMemory`: `Dispose` now stops and stamps an optional OpenTelemetry lifetime `Activity`, and skips
wiping/disposing (and the disposed-state transition) when backed by the shared `EmptyMemoryOwner`.
- `SlabBufferWriter`: its empty-detach owner is now the shared `EmptyMemoryOwner` rather than a private copy.
- `Tag`: redesigned as a bespoke type with content-based, order-independent equality (the previous record
derived equality from its backing dictionary, comparing by reference). The `(Type, object)` tuple factory
overloads, the `Data` property, and the `Type` indexer are removed in favor of the typed `Create<T>` /
`With<T>` / `Get<T>` / `TryGet<T>` / `Contains<T>` API and a read-only `Entries` projection. **Breaking.**
- Segment clearing throughout the pool now uses `CryptographicOperations.ZeroMemory` instead of
`Span.Clear`/`Array.Clear`, so the zeroing of returned secrets cannot be elided.
- `BaseMemoryPool` constructors gained the optional `nativeRentMode` parameter (source-compatible;
recompile against this version).
See full changelog at https://github.com/Lumoin/Lumoin.Base/blob/main/CHANGELOG.md.