silk/trust_snapshot
Profiles: aarch64-apple-darwin, aarch64-unknown-linux-gnu, aarch64-unknown-linux-gnu-no-libc, wasm32-unknown-unknown, x86_64-unknown-linux-gnu, x86_64-unknown-linux-gnu-no-libc.
Bounded immutable owners for explicit trust-anchor sequences.
When to use
Use fromAnchors when the application already owns explicit authorities. Use fromPem to
import strict certificate PEM as unconstrained anchors. Use copy or combine when a new
owner must survive release of its source snapshots.
Details
A snapshot preserves every anchor, restriction, duplicate, and input position. All limits are inclusive. Zero permits no corresponding resource. An empty anchor vector is valid explicit trust that authenticates no peer.
Gotchas
A snapshot stores explicit authority only. It does not validate a path, identity, time, revocation state, or OS trust policy. Empty or whitespace-only PEM remains invalid.
Import as TrustSnapshot with import silk.trust_snapshot { TrustSnapshot }.
Public declarations: 7.
SnapshotLimits
pub struct SnapshotLimitsInclusive budgets for one complete trust snapshot.
Field anchors
pub anchors: usizeMaximum anchor count, including duplicate certificate values.
Field encodedBytes
pub encodedBytes: usizeMaximum aggregate certificate and configured-constraint bytes.
Associated function SnapshotLimits.defaults
pub fn defaults() -> SnapshotLimitsReturns finite defaults of 1024 anchors and 8 MiB of retained encoded data.
Implementation Copy for SnapshotLimits
impl Copy for SnapshotLimitsTrustLoadLimits
pub struct TrustLoadLimitsInclusive strict-decoder and snapshot budgets for one trust-source load.
Field decode
pub decode: DecodeLimitsBounds used by strict PEM, DER, and certificate decoding.
Field snapshot
pub snapshot: SnapshotLimitsBounds used by the complete returned snapshot.
Associated function TrustLoadLimits.defaults
pub fn defaults() -> TrustLoadLimitsReturns the finite certificate-decoder and snapshot defaults.
Implementation Copy for TrustLoadLimits
impl Copy for TrustLoadLimitsTrustLimitKind
pub enum TrustLimitKindA bounded trust-source resource category.
AnchorCount
AnchorCount = 0The complete snapshot has too many anchors, including duplicates.
EncodedBytes
EncodedBytes = 1The aggregate certificate and configured-constraint bytes exceed the budget.
InputBytes
InputBytes = 2A native provider input exceeds its acquisition budget.
TrustConfigurationReason
pub enum TrustConfigurationReasonA rejected native trust-source configuration rule.
EmptyRoot
EmptyRoot = 0An explicit native root path has no bytes.
NonAbsoluteRoot
NonAbsoluteRoot = 1An explicit native root path is not absolute.
NulRoot
NulRoot = 2An explicit native root path contains a zero byte.
PathBytes
PathBytes = 3A native root path exceeds its byte budget.
TrustFileOperation
pub enum TrustFileOperationA native trust-source file stage.
Open
Open = 0Opening the configured trust file failed.
Read
Read = 1Reading the configured trust file failed.
Close
Close = 2Closing the configured trust file failed.
TrustSourceError
pub union TrustSourceErrorA semantic trust-source failure that does not include allocation refusal.
Decode
TrustSourceError.Decode { error: DecodeError }: TrustSourceErrorStrict PEM, DER, or certificate decoding failed at the retained decoder location.
Field error
pub error: DecodeErrorThe complete structured decoder failure.
LimitExceeded
TrustSourceError.LimitExceeded { kind: TrustLimitKind, limit: usize }: TrustSourceErrorA finite trust-source budget was exceeded.
Field kind
pub kind: TrustLimitKindThe exhausted resource category.
Field limit
pub limit: usizeThe inclusive configured budget.
InvalidConfiguration
TrustSourceError.InvalidConfiguration { reason: TrustConfigurationReason }: TrustSourceErrorA native provider configuration is invalid.
Field reason
pub reason: TrustConfigurationReasonThe rejected configuration rule.
File
TrustSourceError.File { operation: TrustFileOperation, error: FileError }: TrustSourceErrorA native provider file operation failed.
Field operation
pub operation: TrustFileOperationThe failed file stage.
Field error
pub error: FileErrorThe complete portable file failure with its provider code.
TrustSnapshot
pub struct TrustSnapshotOne immutable independently owned sequence of explicit trust authorities.
Details
The snapshot preserves input order and duplicates. Each borrowed anchor remains valid only while this snapshot remains valid. Construction does not inspect certificate semantics.
Associated function TrustSnapshot.fromAnchors
pub fn fromAnchors(anchors: silk/vector.Vector<silk/trust_anchor.TrustAnchor>, limits: SnapshotLimits) -> silk/result.Result<silk/trust_snapshot.TrustSnapshot, silk/trust_snapshot.TrustSourceError>Consumes a complete anchor vector after allocation-free count and byte-budget validation.
Details
Success preserves the vector allocation, order, duplicates, and configured restrictions. Failure releases the consumed input and publishes no snapshot. Empty explicit trust is valid.
Associated function TrustSnapshot.fromPem
pub effect<'life0> fn fromPem<'life0>(input: &'life0 [u8], limits: TrustLoadLimits) -> silk/result.Result<silk/trust_snapshot.TrustSnapshot, silk/trust_snapshot.TrustSourceError> ! OutOfMemoryError ? &mut AllocatorStrictly decodes certificate PEM and moves each certificate into an unconstrained anchor.
Details
The result preserves order and duplicates. It reparses no DER and copies no certificate after
decoding. Decoder failures retain their structured locations. Allocation refusal remains an
OutOfMemoryError Effect failure. Every failure publishes no snapshot.
Gotchas
Empty or whitespace-only PEM is invalid. Import assigns explicit authority but does not authenticate a path or reproduce OS trust policy.
Method TrustSnapshot.anchors
pub fn anchors<'life0>(self: &'life0 TrustSnapshot) -> &'life0 [silk/trust_anchor.TrustAnchor]Borrows all anchors in their original order, including every duplicate.
Method TrustSnapshot.copy
pub effect<'life0> fn copy<'life0>(self: &'life0 TrustSnapshot, limits: SnapshotLimits) -> silk/result.Result<silk/trust_snapshot.TrustSnapshot, silk/trust_snapshot.TrustSourceError> ! OutOfMemoryError ? &mut AllocatorCreates an independently owned copy under the supplied inclusive limits.
Details
Every certificate and configured constraint is copied. Allocation refusal releases partial output and leaves this snapshot unchanged.
Associated function TrustSnapshot.combine
pub effect<'env> fn combine<'life0: 'env, 'life1: 'env, 'env>(primary: &'life0 silk/trust_snapshot.TrustSnapshot, additional: &'life1 silk/trust_snapshot.TrustSnapshot, limits: SnapshotLimits) -> silk/result.Result<silk/trust_snapshot.TrustSnapshot, silk/trust_snapshot.TrustSourceError> ! OutOfMemoryError ? &mut AllocatorCopies primary anchors, then additional anchors, into one independent owner.
Details
The operation preserves every duplicate and configured restriction. It does not merge equal certificate DER. A less-restricted additional authority can therefore widen trust.