sigstore-cache
Flexible caching support for sigstore-rust clients.
Overview
This crate provides a pluggable caching mechanism for Sigstore operations. It allows caching of frequently-accessed resources like public keys, trust bundles, and configuration data to reduce network requests and improve performance.
Features
- Pluggable adapters: Choose between filesystem, in-memory, or custom cache backends
- TTL support: Automatic expiration of cached entries
- Platform-aware: Default cache locations follow OS conventions
- Thread-safe: All adapters are safe for concurrent use
Cache Adapters
| Adapter | Description | Use Case |
|---|---|---|
FileSystemCache |
Persistent disk-based cache | Production use, offline support |
InMemoryCache |
Fast in-process cache with TTL | High-performance, single-session |
NoCache |
No-op cache (disabled) | Testing, when caching is not desired |
Cached Resources
| Resource | Default TTL | Description |
|---|---|---|
| Rekor Public Key | 24 hours | Transparency log signing key |
| Rekor Log Info | 1 hour | Log tree size and root hash |
| Fulcio Trust Bundle | 24 hours | CA certificates |
| Fulcio Configuration | 7 days | OIDC issuer configuration |
Usage
use ;
use Duration;
// Filesystem cache (persistent)
let cache = default_location?;
// Or in-memory cache (fast, non-persistent)
let cache = new;
// Store and retrieve values
cache.set.await?;
if let Some = cache.get.await?
With Sigstore Clients
Enable the cache feature on the client crates:
use FileSystemCache;
use FulcioClient;
use RekorClient;
let cache = default_location?;
let fulcio = builder
.with_cache
.build;
let rekor = builder
.with_cache
.build;
Cache Locations
FileSystemCache uses platform-specific directories with URL-namespaced subdirectories:
- Linux:
~/.cache/sigstore-rust/<url-encoded-instance>/ - macOS:
~/Library/Caches/dev.sigstore.sigstore-rust/<url-encoded-instance>/ - Windows:
C:\Users\<User>\AppData\Local\sigstore\sigstore-rust\cache\<url-encoded-instance>\
Instance-Specific Caching
To prevent cache collisions between different Sigstore instances (e.g., production vs staging), use instance-specific caches:
use FileSystemCache;
// Production cache (uses https://sigstore.dev namespace)
let prod_cache = production?;
// Staging cache (uses https://sigstage.dev namespace)
let staging_cache = staging?;
// Custom instance
let custom_cache = for_instance?;
Using default_location() without URL namespacing is still available but not recommended if you use multiple instances.
Custom Adapters
Implement the CacheAdapter trait for custom backends:
use ;
use Duration;
use Pin;
use Future;
;
Related Crates
Used by:
sigstore-fulcio- Caches configuration and trust bundlessigstore-rekor- Caches public keys and log info
License
BSD-3-Clause