pub struct IdentityResolver { /* private fields */ }Expand description
DID and handle resolver with TTL-backed in-memory cache.
Use state.identity.resolve("did:plc:...") or state.identity.resolve("alice.bsky.social")
to resolve identities. Results are cached for the configured TTL.
Implementations§
Source§impl IdentityResolver
impl IdentityResolver
Sourcepub fn new(config: &IdentityConfig, http: Client) -> Self
pub fn new(config: &IdentityConfig, http: Client) -> Self
Create a new resolver with the given configuration and HTTP client.
Sourcepub fn with_defaults(http: Client) -> Self
pub fn with_defaults(http: Client) -> Self
Create a new resolver with default configuration.
Sourcepub async fn resolve(&self, subject: &str) -> Result<ResolvedIdentity>
pub async fn resolve(&self, subject: &str) -> Result<ResolvedIdentity>
Resolve a DID or handle to a ResolvedIdentity.
The subject can be either a DID (did:plc:..., did:web:...) or
a handle (alice.bsky.social). Results are cached.
Sourcepub async fn invalidate(&self, subject: &str)
pub async fn invalidate(&self, subject: &str)
Invalidate a cached entry by DID or handle.
Sourcepub fn metrics(&self) -> IdentityMetrics
pub fn metrics(&self) -> IdentityMetrics
Return current cache metrics.
Auto Trait Implementations§
impl !Freeze for IdentityResolver
impl !RefUnwindSafe for IdentityResolver
impl Send for IdentityResolver
impl Sync for IdentityResolver
impl Unpin for IdentityResolver
impl UnsafeUnpin for IdentityResolver
impl !UnwindSafe for IdentityResolver
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more