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
18#[async_trait]
19impl<H: Handler> store::Host for Ctx<H> {
20    #[instrument(skip(self))]
21    async fn get(
22        &mut self,
23        audience: String,
24    ) -> anyhow::Result<Result<Option<String>, identity::store::Error>> {
25        self.attach_parent_context();
26        Identity::get(&self.handler, &audience).await
27    }
28}