toip.tools

interface · Browser and Node

Transport

@toip-tools/trust-coreView source
TypeScriptImport
import { type Transport } from "@toip-tools/trust-core";

Declaration

TypeScriptinterface
interface Transport {
  /** Registers the function that receives wires addressed to `vid`. It resolves once the wire is processed. */
  attach(vid: string, deliver: (wire: Uint8Array) => Promise<void>): void;
  detach(vid: string): void;
  post(from: string, to: string, wire: Uint8Array): Promise<Delivery>;
}

Methods

attach

Registers the function that receives wires addressed to vid. It resolves once the wire is processed.

TypeScriptSignature
attach(vid: string, deliver: (wire: Uint8Array) => Promise<void>): void;

Parameters

vidrequired
string
deliverrequired
(wire: Uint8Array) => Promise<void>

Returns

void

detach

TypeScriptSignature
detach(vid: string): void;

Parameters

vidrequired
string

Returns

void

post

TypeScriptSignature
post(from: string, to: string, wire: Uint8Array): Promise<Delivery>;

Parameters

fromrequired
string
torequired
string
wirerequired
Uint8Array<ArrayBufferLike>

Returns

Promise<Delivery>