UNPKG

@tbd54566975/dwn-proxy-js

Version:

Bidirectional proxy between DWM's <> RESTful

26 lines 838 B
import { DwnHttpClient } from './dwn-http-client.js'; import { DwnHttpServer } from './dwn-http-server.js'; import type { DwnRequest, DwnResponse, DidStateWithSignatureInput } from './dwn-types.js'; import { Dwn } from '@tbd54566975/dwn-sdk-js'; interface IMatch { (req: DwnRequest): boolean; } interface IHandler { (dwnRequest: DwnRequest): Promise<void | DwnResponse>; } export type DwnProxyOptions = Partial<{ serviceEndpoint: string; didState: DidStateWithSignatureInput; }>; export declare class DwnProxy { #private; options: DwnProxyOptions; server: DwnHttpServer; client: DwnHttpClient; dwn: Dwn; constructor(options: DwnProxyOptions); addHandler: (match: IMatch, handler: IHandler) => number; listen(port: number): Promise<void>; } export {}; //# sourceMappingURL=dwn-proxy.d.ts.map