silk.tls.trust_source.
The TrustSource effect: where a program gets its trust anchors.
When to use#
Require TrustSource in code that needs trust anchors, such as a TLS client, so that the
caller chooses where they come from. Provide silk.tls.trust_source_memory for anchors in memory,
or a native provider for the CA files of the system.
Details#
Each TrustSource.load returns a new TrustSnapshot that the caller owns. It stays valid
after later loads and after the provider changes. No provider is installed by default.
Errors#
TrustSourceErrorif the provider cannot load valid trust.OutOfMemoryErrorif theAllocatorfails.
Gotchas#
Loading anchors does not validate a certificate. A provider must return only the trust that it was configured with: no hidden system roots, environment variables, or caches.
Import as TrustSource with import silk.tls.trust_source { TrustSource }.
Public declarations: 1.
TrustSource#
pub service TrustSourceThe effect that loads a trust snapshot. It needs exclusive access to the provider.
When to use#
Require it in code that needs trust anchors, such as a TLS client, so that the caller chooses
where they come from. Provide silk.tls.trust_source_memory for anchors in memory, or a native
provider for the CA files of the system. No provider is installed by default.
Gotchas#
Loading anchors does not validate a certificate. A provider must return only the trust that it was configured with: no hidden system roots, environment variables, or caches.
Operation load#
effect fn load(
limits: TrustLoadLimits
) -> TrustSnapshot
! TrustSourceError | OutOfMemoryError
? &mut TrustSource | &mut AllocatorReturns a new trust snapshot from the provider, within limits. The caller owns it. It stays
valid after later loads and after the provider changes.
Errors#
TrustSourceErrorif the provider cannot load valid trust.OutOfMemoryErrorif theAllocatorfails.
A failed load returns no snapshot and does not change the trust of the provider.
Category: TLS and certificates.
Profiles: aarch64-apple-darwin, aarch64-unknown-linux-gnu, aarch64-unknown-linux-gnu-no-libc, x86_64-unknown-linux-gnu, x86_64-unknown-linux-gnu-no-libc, wasm32-unknown-unknown, wasm32-wasip1, wasm32-wasip2.