API reference · Browser and Node

# @toip-tools/mesh-transport

70 public exports.

Module import:

```ts
import { ackMac, addressTag, AirtimeBudget } from "@toip-tools/mesh-transport";
```

## Functions

- [`ackMac`](https://toip.tools/toolkit/mesh-transport/api/ackMac/)

  An ACK's MAC, under k(R→S).

- [`addressTag`](https://toip.tools/toolkit/mesh-transport/api/addressTag/)

  The 4-byte address tag of a packet from S to R, under k(S→R).

- [`custodyMessage`](https://toip.tools/toolkit/mesh-transport/api/custodyMessage/)

  What a gateway signs in a custody receipt.

- [`decodeFrame`](https://toip.tools/toolkit/mesh-transport/api/decodeFrame/)

- [`decodePacket`](https://toip.tools/toolkit/mesh-transport/api/decodePacket/)

- [`encodeFrame`](https://toip.tools/toolkit/mesh-transport/api/encodeFrame/)

- [`encodePacket`](https://toip.tools/toolkit/mesh-transport/api/encodePacket/)

- [`estimate`](https://toip.tools/toolkit/mesh-transport/api/estimate/)

  Frames and airtime (frames plus one ACK) to send a packet once over \`link\`.

- [`exportBundle`](https://toip.tools/toolkit/mesh-transport/api/exportBundle/)

- [`fragment`](https://toip.tools/toolkit/mesh-transport/api/fragment/)

  Cuts a packet into DATA frames of at most \`mtu\` bytes.

- [`joinTsp`](https://toip.tools/toolkit/mesh-transport/api/joinTsp/)

- [`keyHint`](https://toip.tools/toolkit/mesh-transport/api/keyHint/)

  H(Ed25519 key)\[0..8\], naming a door or gateway in its beacons and VIA packets.

- [`loraAirtimeMs`](https://toip.tools/toolkit/mesh-transport/api/loraAirtimeMs/)

  Semtech's time-on-air formula, explicit header, CRC on.

- [`maxBytesUnder`](https://toip.tools/toolkit/mesh-transport/api/maxBytesUnder/)

  The largest payload (up to 255 bytes) whose airtime is at most \`ms\`.

- [`memoryContacts`](https://toip.tools/toolkit/mesh-transport/api/memoryContacts/)

- [`memoryGatewayStore`](https://toip.tools/toolkit/mesh-transport/api/memoryGatewayStore/)

- [`memoryOutbox`](https://toip.tools/toolkit/mesh-transport/api/memoryOutbox/)

- [`openBundle`](https://toip.tools/toolkit/mesh-transport/api/openBundle/)

  The messages in a bundle.

- [`openRoute`](https://toip.tools/toolkit/mesh-transport/api/openRoute/)

- [`openSender`](https://toip.tools/toolkit/mesh-transport/api/openSender/)

- [`packetId`](https://toip.tools/toolkit/mesh-transport/api/packetId/)

  pid = H(packet)\[0..4\].

- [`pairKeys`](https://toip.tools/toolkit/mesh-transport/api/pairKeys/)

  k(me→peer) and k(peer→me), from one X25519 agreement.

- [`planMtu`](https://toip.tools/toolkit/mesh-transport/api/planMtu/)

  The MTU a plan really allows: its own, capped by the largest frame under the dwell limit.

- [`postBundle`](https://toip.tools/toolkit/mesh-transport/api/postBundle/)

  Posts every message through a relay transport signed in as the courier.

- [`readVidForm`](https://toip.tools/toolkit/mesh-transport/api/readVidForm/)

- [`receiptMac`](https://toip.tools/toolkit/mesh-transport/api/receiptMac/)

  The MAC of a receipt with status 0 or 2, under k(R→S).

- [`receiptTag`](https://toip.tools/toolkit/mesh-transport/api/receiptTag/)

  A RECEIPT's tag, under k(R→S).

- [`sealRoute`](https://toip.tools/toolkit/mesh-transport/api/sealRoute/)

  A VIA's route block for the gateway: both VIDs, sealed to it.

- [`sealSender`](https://toip.tools/toolkit/mesh-transport/api/sealSender/)

  An INTRO's sealed sender: HPKE base mode to R, bound to the packet's \`enc\`.

- [`splitTsp`](https://toip.tools/toolkit/mesh-transport/api/splitTsp/)

  The parts of a TSP message.

- [`tspSignatureValid`](https://toip.tools/toolkit/mesh-transport/api/tspSignatureValid/)

  Checks the TSP signature, so a mesh node can drop forgeries and tag collisions before delivery.

- [`vidForm`](https://toip.tools/toolkit/mesh-transport/api/vidForm/)

  \`0x01 ‖ key\` for an Ed25519 did:key, otherwise \`0x02 ‖ length ‖ UTF-8\`.

## Classes

- [`AirtimeBudget`](https://toip.tools/toolkit/mesh-transport/api/AirtimeBudget/)

  A sliding-window airtime ledger.

- [`ChallengeBeacon`](https://toip.tools/toolkit/mesh-transport/api/ChallengeBeacon/)

- [`LinkEvents`](https://toip.tools/toolkit/mesh-transport/api/LinkEvents/)

  A small helper for adapters: listener sets for frames and state.

- [`MeshGateway`](https://toip.tools/toolkit/mesh-transport/api/MeshGateway/)

- [`MeshTransport`](https://toip.tools/toolkit/mesh-transport/api/MeshTransport/)

- [`VirtualScheduler`](https://toip.tools/toolkit/mesh-transport/api/VirtualScheduler/)

  Virtual time.

## Interfaces

- [`AirtimePolicy`](https://toip.tools/toolkit/mesh-transport/api/AirtimePolicy/)

  A link's airtime budget: a sliding window with a ceiling, and a per-frame cap (dwell time).

- [`BeaconInfo`](https://toip.tools/toolkit/mesh-transport/api/BeaconInfo/)

- [`BundleItem`](https://toip.tools/toolkit/mesh-transport/api/BundleItem/)

- [`ChannelPlan`](https://toip.tools/toolkit/mesh-transport/api/ChannelPlan/)

- [`Contact`](https://toip.tools/toolkit/mesh-transport/api/Contact/)

- [`ContactStore`](https://toip.tools/toolkit/mesh-transport/api/ContactStore/)

- [`GatewayStore`](https://toip.tools/toolkit/mesh-transport/api/GatewayStore/)

- [`Link`](https://toip.tools/toolkit/mesh-transport/api/Link/)

- [`LinkInfo`](https://toip.tools/toolkit/mesh-transport/api/LinkInfo/)

- [`LoRaSetting`](https://toip.tools/toolkit/mesh-transport/api/LoRaSetting/)

  LoRa time on air, channel plans and region rules (design §12, §14.4).

- [`MeshOptions`](https://toip.tools/toolkit/mesh-transport/api/MeshOptions/)

- [`MeshOutboxItem`](https://toip.tools/toolkit/mesh-transport/api/MeshOutboxItem/)

- [`MeshOutboxStore`](https://toip.tools/toolkit/mesh-transport/api/MeshOutboxStore/)

- [`MeshStats`](https://toip.tools/toolkit/mesh-transport/api/MeshStats/)

- [`ReceivedFrame`](https://toip.tools/toolkit/mesh-transport/api/ReceivedFrame/)

- [`RelayLike`](https://toip.tools/toolkit/mesh-transport/api/RelayLike/)

  Anything that posts to the internet relay: a RelayTransport signed in as the gateway.

- [`Scheduler`](https://toip.tools/toolkit/mesh-transport/api/Scheduler/)

  Where the mesh gets time and timers.

- [`TspParts`](https://toip.tools/toolkit/mesh-transport/api/TspParts/)

- [`ViaArrival`](https://toip.tools/toolkit/mesh-transport/api/ViaArrival/)

  What a gateway gets for each VIA packet that names it.

## Types

- [`Frame`](https://toip.tools/toolkit/mesh-transport/api/Frame/)
- [`LinkState`](https://toip.tools/toolkit/mesh-transport/api/LinkState/)
- [`MeshEvent`](https://toip.tools/toolkit/mesh-transport/api/MeshEvent/)
- [`Packet`](https://toip.tools/toolkit/mesh-transport/api/Packet/)
- [`PacketKind`](https://toip.tools/toolkit/mesh-transport/api/PacketKind/)
- [`TrafficClass`](https://toip.tools/toolkit/mesh-transport/api/TrafficClass/)

## Constants

- [`FRAME_HEADER`](https://toip.tools/toolkit/mesh-transport/api/FRAME_HEADER/)

- [`MAX_FRAGMENTS`](https://toip.tools/toolkit/mesh-transport/api/MAX_FRAGMENTS/)

- [`plans`](https://toip.tools/toolkit/mesh-transport/api/plans/)

- [`realScheduler`](https://toip.tools/toolkit/mesh-transport/api/realScheduler/)

- [`regions`](https://toip.tools/toolkit/mesh-transport/api/regions/)

- [`US915_DOWN`](https://toip.tools/toolkit/mesh-transport/api/US915_DOWN/)

- [`US915_UP`](https://toip.tools/toolkit/mesh-transport/api/US915_UP/)

  904.6 MHz: the stock US915 gateway's 500 kHz receive channel.

Signatures and source documentation are generated from [`packages/mesh-transport/src/index.ts`](https://github.com/yourbuddyconner/toip-tools/blob/main/packages/mesh-transport/src/index.ts).

---

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