pub struct InMemoryTokenBroker { /* private fields */ }Expand description
Reference broker for unit tests + small deployments. Production
adopters should implement their own TokenBroker against a real
secret manager (Vault, AWS Secrets Manager, Doppler, …).
SP-capability-v2 (2026-05-11): gained a UCAN-JWT branch in
TokenBroker::resolve_bearer. Adopters register a mapping from
a UCAN did:key:z... audience to the caller id they want assigned
to that DID via Self::register_ucan_audience. JWT-shape bearers
then resolve to that caller id with the chain’s attenuated caps.
Non-JWT bearers continue to return BrokerError::NotConfigured
(unchanged from phase 1).
Implementations§
Source§impl InMemoryTokenBroker
impl InMemoryTokenBroker
pub fn new() -> Self
pub fn insert(&mut self, caller_id: impl Into<String>, bundle: SecretBundle)
Sourcepub fn register_ucan_audience(
&mut self,
did_key: impl Into<String>,
caller_id: impl Into<String>,
)
pub fn register_ucan_audience( &mut self, did_key: impl Into<String>, caller_id: impl Into<String>, )
Register a UCAN did:key:z... audience as a known identity for
this broker. A UCAN bearer whose leaf aud matches did_key
will resolve to BearerIdentity::caller_id = caller_id.
SP-capability-v2 §4.6 + §6 — celia’s analogous mapping is the
new consent.did_to_grantee column.
Sourcepub fn with_max_chain_depth(self, depth: u8) -> Self
pub fn with_max_chain_depth(self, depth: u8) -> Self
Set the verifier’s max chain depth (default 5).
Sourcepub fn with_revocation_store(self, store: Arc<dyn UcanRevocationStore>) -> Self
pub fn with_revocation_store(self, store: Arc<dyn UcanRevocationStore>) -> Self
Attach a revocation store consulted on every UCAN link.
Trait Implementations§
Source§impl Default for InMemoryTokenBroker
impl Default for InMemoryTokenBroker
Source§fn default() -> InMemoryTokenBroker
fn default() -> InMemoryTokenBroker
Source§impl TokenBroker for InMemoryTokenBroker
impl TokenBroker for InMemoryTokenBroker
Source§fn resolve<'a>(&'a self, caller_id: Option<&'a str>) -> ResolveFuture<'a>
fn resolve<'a>(&'a self, caller_id: Option<&'a str>) -> ResolveFuture<'a>
Source§fn accepted_token_formats(&self) -> &'static [&'static str]
fn accepted_token_formats(&self) -> &'static [&'static str]
["ce-pairing-code"],
["jwt-rs256"], ["opaque"]). Listener does NOT route on this
— it is informational, surfaced through atd-ref-server --doctor
and the /initialize server-info echo. Default &[] means
“unspecified / introspect via try-resolve”. SP-token-broker-phase2
§4.2.Source§fn resolve_bearer<'a>(&'a self, bearer: &'a str) -> ResolveBearerFuture<'a>
fn resolve_bearer<'a>(&'a self, bearer: &'a str) -> ResolveBearerFuture<'a>
Authorization: Bearer …
header) to a BearerIdentity. The HTTP listener calls this
once per request before dispatch (SP-streamable-http §4.3). Read more