spire-api
A Rust library providing access to SPIRE-specific gRPC APIs that are not part of the core SPIFFE standards.
This crate is intended for applications and services that need to interact directly with SPIRE agent or server APIs beyond the Workload API.
Scope
Currently supported APIs include:
- Delegated Identity API
Allows authorized workloads to obtain X.509 and JWT SVIDs (and bundles) on behalf of other workloads that cannot be directly attested by the SPIRE agent.
This is particularly useful in advanced or constrained environments where direct workload attestation is not feasible.
Installation
Add spire-api to your Cargo.toml:
[]
= "0.5"
Quick start
The Delegated Identity API uses the SPIRE Agent admin socket (not the Workload API socket).
Set the SPIRE_ADMIN_ENDPOINT_SOCKET environment variable to the admin socket path:
Fetch a delegated X.509 SVID
Using selector-based attestation:
use ;
use selectors;
let client = connect_env.await?;
let x509_svid = client
.fetch_x509_svid
.await?;
Using PID-based attestation (let the agent attest the PID and generate selectors):
let x509_svid = client
.fetch_x509_svid
.await?;
Fetch JWT SVIDs
let jwt_svids = client
.fetch_jwt_svids
.await?;
Fetch trust bundles
// X.509 bundles
let x509_bundles = client.fetch_x509_bundles.await?;
// JWT bundles
let jwt_bundles = client.fetch_jwt_bundles.await?;
Streaming updates
The client also supports streaming methods for continuous updates:
stream_x509_svids()- Stream X.509 SVID updatesstream_x509_bundles()- Stream X.509 bundle updatesstream_jwt_bundles()- Stream JWT bundle updates
Delegated Identity API
The Delegated Identity API allows authorized workloads to obtain X.509 and JWT SVIDs (and bundles) on behalf of other workloads that cannot be directly attested by the SPIRE agent.
Important: This API must be used over the SPIRE Agent admin socket, not the Workload API socket.
The admin socket path is typically configured via the SPIRE_ADMIN_ENDPOINT_SOCKET environment variable.
For background and protocol-level details, see the SPIRE Delegated Identity API documentation.
Documentation
Full API documentation is available on docs.rs.
License
Licensed under the Apache License, Version 2.0. See LICENSE for details.