Low-level constructor. Prefer the static factories (Destination.IN,
Destination.OUT, etc.) which also compute the destination hashes.
The application name.
The direction of this destination.
The type of this destination.
The identity associated with this destination.
An object that manages destinations and dispatches link requests.
Per-destination app_data override (§4.5). When set it takes precedence
over identity.appData in announces, so destinations sharing an identity
(e.g. lxmf.delivery and lxmf.propagation) can each advertise their
own app_data.
Registered REQUEST handlers keyed by hex(SHA-256(path)[:16])
(PROTOCOL-SPEC.md §11.3). The path string itself is never sent on the
wire — only its 16-byte truncated hash — so a client must already know
the path to fetch the resource at it.
StaticDEFAULT_Default periodic re-announce interval. The Python reference has no
upstream-mandated default for application destinations — its
Transport.mgmt_announce_interval (2 h) and interface-discovery cadence
(6 h) are transport-internal, not what end-user destinations announce at.
PROTOCOL-SPEC.md §9.7 recommends 30–60 min for a desktop client and notes
Sideband emits roughly every 30 min; 30 min keeps cached mesh paths fresh
against transit-relay TTLs without dominating airtime.
StaticknownStorage for known destinations.
StaticknownKnown ratchet X25519 public key per peer destination (SPEC.md §4.5 step
6.2, §7.4) — the single newest ratchet learned from that peer's validated
announces. Maps hex destination hash → { ratchet, received }. Only the
newest ratchet is retained (a newer announce overwrites); entries expire
after Destination.RATCHET_EXPIRY_MS. Consumed by the outbound
encrypt path for forward secrecy.
StaticMAX_Maximum number of retained ratchet keys for decryption tolerance.
StaticMIN_Floor below which a requested interval is clamped. PROTOCOL-SPEC.md §9.7: "AVOID < 60 s — short intervals trigger ingress rate limiting (§4.5 step 8) and burn ratchet-ring slots without benefit". Sub-minute intervals are clamped to this value with a warning rather than rejected outright.
StaticPR_Seconds a path-response announce payload stays reusable for retransmitted
path? requests with the same tag (Python Destination.PR_TAG_WINDOW).
StaticRATCHET_How long a learned peer ratchet stays valid, in milliseconds (default 30
days). Mirrors RNS.Identity.RATCHET_EXPIRY. Past this a peer ratchet is
dropped and the long-term key is used until a fresh announce arrives.
StaticRATCHET_Default ratchet rotation interval (Destination.RATCHET_INTERVAL = 30 min). A destination with ratchets enabled rotates its key at most this often.
The active re-announce interval in milliseconds. This is the default
(DEFAULT_ANNOUNCE_INTERVAL_MS) until startAnnouncing is
called with an explicit intervalMs, after which it reflects the
(clamped) requested value.
The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.
Optionaloptions: boolean | AddEventListenerOptionsBroadcasts an Announce packet advertising this destination's public key, name hash and signed metadata so peers can learn and remember it.
Emits with context = NONE (a regular periodic announce). Use
announcePathResponse to answer a path? request.
Broadcasts a path-response announce — identical body to a regular
announce (§4.1) but with the outer packet's context byte set to
PATH_RESPONSE = 0x0B (§7.2.4). Emitted in answer to an inbound path?
request so the requester can learn a route back to us. The announce body
validates identically under §4.5; only the context byte distinguishes it.
When called with the requesting PR's tag, the signed announce payload
is cached for PR_TAG_WINDOW seconds and retransmissions with the
same tag reuse it — mirroring the Python reference's path_responses
cache, which keeps PR floods from forcing a fresh signature (and ratchet
rotation) per retransmitted request.
Optionaltag: Uint8Array<ArrayBufferLike> | null = null
The path? request tag that triggered
this response, when known.
Initiates an encrypted link to this remote (OUT) destination.
Delegates to Link.initiate, which generates the ephemeral keypair, builds
and sends the LINKREQUEST, registers the link with the transport, and
transitions to HANDSHAKE. This method then awaits Link.whenActive() so
that the returned link is fully established (LRPROOF validated, session
keys derived) and ready to carry application DATA — e.g. it is safe to call
link.identify(...) immediately on the resolved value.
Decrypts data that was encrypted for this destination's identity.
Tries each owned ratchet private key (newest first) before the long-term
key (§7.4), so messages encrypted to a just-rotated ratchet still decrypt.
Returns null when decryption fails (wrong recipient / unknown key).
The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().
Enables forward-secrecy ratchets on this destination (§7.4).
The owned ratchet private-key ring is persisted (signed by this destination's identity) so a restart can still decrypt messages encrypted to prior ratchets. On the first run (no persisted ring) an initial key is generated immediately; otherwise the persisted ring is loaded and a fresh key is rotated on the next announce. Inbound packets are decrypted against the private ring before the long-term key.
Encrypts data for this destination's identity.
Gets the salt for key derivation.
Whether the periodic re-announce loop is currently running.
Handles incoming packets routed to this destination.
Registers a server-side REQUEST handler for a path string (PROTOCOL-SPEC.md §11.3, §11.4).
The path is hashed to SHA-256(path)[:16] and stored keyed by that hash;
the path string itself never appears on the wire. When a REQUEST arrives
on a Link whose responder destination is this one, Link._handleRequest
looks the handler up by the path hash, enforces the allow mode, and
invokes responseGenerator to produce the response value.
Opaque path token (e.g. "/page/index.mu").
Optionalallow?: numberAuthorization mode.
OptionalallowedList?: Uint8Array<ArrayBufferLike>[]Identity hashes permitted under Allow.LIST.
OptionalautoCompress?: booleanHint for the (future) Resource response path.
Produces the response value.
the 16-byte path hash the handler is keyed under.
The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.
Optionaloptions: boolean | EventListenerOptionsRemoves a previously registered REQUEST handler.
true if a handler was removed.
Responds to an incoming LINKREQUEST by accepting the link.
Delegates to Link.accept, which derives the link_id, generates the
responder ephemeral key, derives the session keys, builds and sends the
LRPROOF, and registers the link with the transport.
Rotates the ratchet ring when the interval has elapsed
(Destination.RATCHET_INTERVAL), inserting the newest key at index 0 and
capping the ring to Destination.MAX_RATCHETS. Pass force to
generate a key unconditionally (used for the initial key). The rotated
ring is persisted (signed by the identity) so a restart retains the
private keys.
No-op when ratchets are not enabled.
Optionalforce: boolean = falseEncrypts the packet payload for this destination and sends it via the bound transport.
Starts periodically re-announcing this destination so cached mesh paths stay fresh (PROTOCOL-SPEC.md §7.5 / §9.7 — "non-optional": without it, transit relays evict the path within minutes and peers can no longer reach you).
The first announce fires immediately (so the destination becomes
reachable as soon as the loop starts), then repeats every intervalMs.
Each tick emits an announce (context NONE); a failed tick is logged and
does not stop the loop. An announce whose cadence is superseded while it
is mid-flight (restart/stop) is dropped before broadcasting, so updating
the cadence never emits a straggler.
Calling this while the loop is already running updates the cadence: the existing timer is cleared and a new one armed at the (possibly new) interval, without emitting an extra immediate announce.
intervalMs defaults to DEFAULT_ANNOUNCE_INTERVAL_MS and is
clamped to MIN_ANNOUNCE_INTERVAL_MS (sub-minute intervals trigger
ingress rate limiting and waste airtime — §9.7).
Optionaloptions: { intervalMs?: number } = {}
OptionalintervalMs?: numberCadence in ms (clamped to the floor).
Stops the periodic re-announce loop started by startAnnouncing. Safe to call when not running (no-op).
StaticcleanDrops expired and obsolete peer ratchets from a known-ratchets map. Called
once at startup after persistence hydration (mirrors
RNS.Identity._clean_ratchets): an entry is removed when it is past
Destination.RATCHET_EXPIRY_MS or its destination is no longer in
knownDestinations (the peer was forgotten).
OptionalknownRatchets: Map<string, { ratchet: Uint8Array; received: number }> = Destination.knownRatchets
Defaults to Destination.knownRatchets.
OptionalknownDestinations: Map<string, any> = Destination.knownDestinations
Defaults to
Destination.knownDestinations.
the number of entries removed.
StaticcreateStaticGROUPCreates a GROUP destination.
StaticINStaticOUTStaticPLAINStaticrecallStaticrecallRecalls the newest non-expired ratchet public key for a destination, or null. Expired entries (past Destination.RATCHET_EXPIRY_MS) are dropped on read. Consumed by the outbound encrypt path (§7.4).
StaticrememberRemember a destination.
StaticrememberRemembers a ratchet X25519 public key announced for a destination (SPEC.md
§4.5 step 6.2). Called only for validated announces where context_flag
was set and the ratchet is non-empty. Only the single newest ratchet is
retained per destination; re-announcing the SAME ratchet is a no-op (the
received time is not refreshed), matching RNS.Identity._remember_ratchet.
32-byte ratchet X25519 public key.
StaticSINGLECreates a SINGLE destination.
Represents a Reticulum destination — an addressable endpoint that can announce, receive packets, encrypt/decrypt, and establish Links.