Skip to main content
Version: Preview (0.3.0-preview.205)

Class IdEntropySource

Namespace: AdCodicem.ValueObjects.Identifiers
Assembly: AdCodicem.ValueObjects.Identifiers.dll

The source of the random part of a new entity identifier.

public abstract class IdEntropySource

Inheritance​

object ← IdEntropySource

Inherited Members​

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()

Remarks​

This exists so tests can make identifier generation deterministic without reaching for a seeded in production by mistake. The default, , is a cryptographic generator, and that is not a detail: identifiers appear in URLs and logs, and a -derived body is recoverable from a handful of samples, which would turn every identifier into a guessable one.

An identifier is still not a secret. Unguessability is defence in depth; authorization is the control.

Properties​

System​

Gets the cryptographic source used unless a caller substitutes one.

public static IdEntropySource System { get; }

Property Value​

IdEntropySource

Methods​

Fill(Span<byte>)​

Fills a buffer with uniformly distributed bytes.

public abstract void Fill(Span<byte> destination)

Parameters​

destination Span<byte>

Buffer to fill entirely.