UNPKG

@digitalcredentials/issuer-registry-client

Version:

Known issuers / verifiers registry client, for use in Typescript, browser, and React Native.

86 lines (85 loc) 2.14 kB
/** * Example registry: * @example * ``` * { * "name": "DCC Sandbox Registry", * "url": "https://digitalcredentials.github.io/sandbox-registry/registry.json" * } * ``` */ export declare class KnownDidRegistry { name: string; url: string; constructor(name: string, url: string); } export declare class DidMapRegistry extends KnownDidRegistry { version: string; /** * @example rawContents * { * did:key:z6MkpLDL3RoAoMRTwTgo3rs39ZwssfaPKtGdZw7AGRN7CK4W: { * name: "(Example) My University", * location: "Cambridge, MA, USA", * url: "https://digitalcredentials.mit.edu" * } * } */ rawContents?: any; constructor({ name, url, rawContents }: { name: string; url: string; rawContents: any[]; }); } /** * @example * ``` * // did:key:z6MkpLDL3RoAoMRTwTgo3rs39ZwssfaPKtGdZw7AGRN7CK4W * { * name: "(Example) My University", * location: "Cambridge, MA, USA", * url: "https://digitalcredentials.mit.edu", * inRegistries: ["DCC Community Registry", "DCC Sandbox Registry"] * } * ``` */ export declare class DidMapRegistryEntry { name: string; url: string; location?: string; inRegistries?: Set<KnownDidRegistry>; constructor({ name, url, location }: { name: string; url: string; location: string; }); } export interface LoadResult { name: string; url: string; loaded: boolean; error?: any; } export declare class RegistryClient { registries?: DidMapRegistry[]; didMap: Map<string, DidMapRegistryEntry>; /** * @example * ``` * const config = [ * { * "name": "DCC Sandbox Registry", * "url": "https://digitalcredentials.github.io/sandbox-registry/registry.json" * } * ] * const client = new RegistryClient() * await client.load({ config }) * ``` * @param registries - Config object with a list of registries to load */ load({ config }: { config: any; }): Promise<LoadResult[]>; didEntry(did: string): DidMapRegistryEntry | undefined; }