UNPKG

@m-ld/gateway

Version:

m-ld gateway for services

36 lines (35 loc) 1.14 kB
import { AccountOwnedId } from './AccountOwnedId.js'; import { MeldConfig, Reference } from '@m-ld/m-ld'; import { AuthKeyConfig } from './AuthKey.js'; /** * The basic config used by both clients (using this lib) and servers */ export interface BaseGatewayConfig extends MeldConfig, AuthKeyConfig { /** * Public Gateway address, may be a domain name or a URL * @see resolveGateway */ gateway: string | URL; /** The user; undefined if this is a service */ user?: string; /** Allow any other keys for config */ [key: string]: any; } /** * Utility base class for things that represent a Gateway, may be a client proxy */ export declare class BaseGateway { readonly domainName: string; constructor(domainName: string); ownedRefAsId(tsRef: Reference): AccountOwnedId; ownedId({ account, name }: { account: string; name: string; }): AccountOwnedId; absoluteId(iri: string): string; } /** * */ export declare function resolveGateway(address: string | URL): URL | Promise<URL>; export declare function resolveDomain(gateway: BaseGatewayConfig['gateway']): string;