interface · Browser and Node

# Transport

`@toip-tools/trust-core` · [View source](https://github.com/yourbuddyconner/toip-tools/blob/main/packages/trust-core/src/transport.ts#L4)

Import:

```ts
import { type Transport } from "@toip-tools/trust-core";
```

## Declaration

interface:

```ts
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.

Signature:

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

#### Parameters

- **`vid` (required)**: `string`
- **`deliver` (required)**: `(wire: Uint8Array) => Promise<void>`

#### Returns

`void`

### `detach`

Signature:

```ts
detach(vid: string): void;
```

#### Parameters

- **`vid` (required)**: `string`

#### Returns

`void`

### `post`

Signature:

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

#### Parameters

- **`from` (required)**: `string`
- **`to` (required)**: `string`
- **`wire` (required)**: `Uint8Array<ArrayBufferLike>`

#### Returns

`Promise<Delivery>`

[Usage guide](https://toip.tools/toolkit/trust-core/#usage) · [Error handling](https://toip.tools/toolkit/trust-core/#errors) · [All exports](https://toip.tools/toolkit/trust-core/api/)

---

This is the Markdown version of https://toip.tools/toolkit/trust-core/api/Transport/. An index of the documentation for AI assistants is at https://toip.tools/llms.txt.
