Skip to main content

Module credentials

Module credentials 

Source
Expand description

Host side of act:credentials/store.

Session handling lives here rather than in the transports so both MCP and HTTP get identical behaviour; runtime/sessions.rs is the single point both already pass through.

§Two layers, on purpose

CredentialHost is synchronous, owns no wasmtime types, and is the whole of the credential logic: compartment projection, session liveness, the audit record. It is unit-testable against a real store with no engine, no linker and no guest.

Around it sits the generated-trait bridge. act:credentials/store’s two functions are async func in WIT, so bindgen lowers them through func_wrap_concurrent: the generated HostWithStore<T> methods are associated functions taking a wasmtime::component::Accessor, not methods on &self, and the impl target is the HasData marker rather than HostState. The bridge reaches host state through the accessor, resolves the capability decision (which may await a human), and then calls the synchronous host. Nothing about the credential logic itself has to be written twice, or written async.

Structs§

CredentialHost
RefreshRequest
What the runtime knows and a refresher needs.
Refreshed
What a renewal produced.

Enums§

HostError
Why the host refused, in the terms CredentialHost can decide in. Maps onto the WIT secret-error variants and nothing else, through this type’s private to_wit.

Traits§

CredentialRefresher
How a credential too close to expiry is renewed.

Functions§

add_to_linker
Register both act:credentials instances in the linker.
backend_root
The directory a BackendChoice lives in. A match rather than an irrefutable let, so a second variant is a compile error here instead of a silent assumption at every call site.
default_store_root
Where the file backend lives when the operator has not named one.
issuer_slot
Where the issuer of a std:oauth2 field is kept, alongside its refresh token: <field key>:std:issuer and <field key>:std:refresh-token.
refresh_token_slot
resolve_backend
Parse --credentials-backend, or fall back to default_store_root.