@arcblock/did
Version:
Javascript lib to work with ArcBlock DID
41 lines (39 loc) • 1.14 kB
text/typescript
import { NameRegistry } from "./name-registry.mjs";
//#region src/name-resolver.d.ts
interface DIDNameResolverOptions {
global?: NameRegistry;
local?: NameRegistry;
maxDepth?: number;
}
interface ResolveTraceResult {
result: string | null;
trace: string[];
}
/**
* DID Name Resolver.
*
* Routes name resolution to the appropriate registry based on the name structure:
* - Global names (single segment) → global registry
* - .local names → local registry
* - Delegated names (multi-segment) → resolve TLD first, then delegate
*/
declare class DIDNameResolver {
private global?;
private local?;
private maxDepth;
constructor(opts?: DIDNameResolverOptions);
/**
* Resolve a name to a DID.
*
* @param name - The name to resolve (can be prefixed with 'did:name:')
* @returns The resolved DID, or null if not found
*/
resolve(name: string): Promise<string | null>;
/**
* Resolve a name with full trace for debugging.
*/
resolveWithTrace(name: string): Promise<ResolveTraceResult>;
private _resolve;
}
//#endregion
export { DIDNameResolver, DIDNameResolverOptions, ResolveTraceResult };