@arcblock/did
Version:
Javascript lib to work with ArcBlock DID
31 lines • 966 B
text/typescript
//#region src/name-registry.d.ts
/**
* NameRegistry Interface and InMemoryNameRegistry Implementation
*
* Provides a synchronous interface for name→DID registration and lookup.
* InMemoryNameRegistry is a Map-based implementation for testing.
*/
/** Name registry interface (synchronous) */
interface NameRegistry {
resolve(name: string): string | null;
register(name: string, did: string): void;
unregister(name: string): void;
has(name: string): boolean;
list(): string[];
clear(): void;
}
/**
* In-memory name registry implementation.
* Uses upsert semantics: re-registering a name overwrites the previous value.
*/
declare class InMemoryNameRegistry implements NameRegistry {
private store;
resolve(name: string): string | null;
register(name: string, did: string): void;
unregister(name: string): void;
has(name: string): boolean;
list(): string[];
clear(): void;
}
//#endregion
export { InMemoryNameRegistry, NameRegistry };