UNPKG

@web5/agent

Version:
30 lines 1.64 kB
import { DidResolutionResult, DidResolverCache, DidResolverCacheLevel, DidResolverCacheLevelParams } from '@web5/dids'; import { Web5PlatformAgent } from './types/agent.js'; /** * AgentDidResolverCache keeps a stale copy of the Agent's managed Identity DIDs and only evicts and refreshes upon a successful resolution. * This allows for quick and offline access to the internal DIDs used by the agent. */ export declare class AgentDidResolverCache extends DidResolverCacheLevel implements DidResolverCache { /** * Holds the instance of a `Web5PlatformAgent` that represents the current execution context for * the `AgentDidApi`. This agent is used to interact with other Web5 agent components. It's vital * to ensure this instance is set to correctly contextualize operations within the broader Web5 * Agent framework. */ private _agent?; /** A map of DIDs that are currently in-flight. This helps avoid going into an infinite loop */ private _resolving; constructor({ agent, db, location, ttl }: DidResolverCacheLevelParams & { agent?: Web5PlatformAgent; }); get agent(): Web5PlatformAgent; set agent(agent: Web5PlatformAgent); /** * Get the DID resolution result from the cache for the given DID. * * If the DID is managed by the agent, or is the agent's own DID, it will not evict it from the cache until a new resolution is successful. * This is done to achieve quick and offline access to the agent's own managed DIDs. */ get(did: string): Promise<DidResolutionResult | void>; } //# sourceMappingURL=agent-did-resolver-cache.d.ts.map