wasmcloud_runtime/component/
identity.rs

1use async_trait::async_trait;
2use tracing::instrument;
3
4use crate::capability::identity::{self, store};
5
6use super::{Ctx, Handler};
7
8/// `wasmcloud:identity/store` implementation
9#[async_trait]
10pub trait Identity {
11    /// Handle `wasmcloud:identity/store.get`
12    async fn get(
13        &self,
14        audience: &str,
15    ) -> anyhow::Result<Result<Option<String>, identity::store::Error>>;
16}
17
18impl<H: Handler> store::Host for Ctx<H> {
19    #[instrument(skip(self))]
20    async fn get(
21        &mut self,
22        audience: String,
23    ) -> anyhow::Result<Result<Option<String>, identity::store::Error>> {
24        self.attach_parent_context();
25        Identity::get(&self.handler, &audience).await
26    }
27}