reticulum-js
    Preparing search index...

    Class LXMRouter

    Handles LXMF routing and message processing.

    LXMF Router for managing incoming and outgoing messages

    Hierarchy

    • EventTarget
      • LXMRouter
    Index
    deliveryDest: Destination | null
    displayName: string | null
    identifiedLinks: Set<any>
    identity: Identity
    pendingLinks: Map<any, any>
    pendingMessages: Map<any, any>
    processedTransientIds: Map<string, number>
    stampCost: number | null
    • The addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.

      MDN Reference

      Parameters

      • type: string
      • callback: EventListenerOrEventListenerObject | null
      • Optionaloptions: boolean | AddEventListenerOptions

      Returns void

    • Announces the lxmf.delivery destination with the given display name.

      Builds the §4.3 msgpack app_data ([name(bin8), stamp_cost, [SF_COMPRESSION]]) and attaches it to the identity so Destination.announce signs it as part of the announce body.

      Parameters

      • displayName: string

        Human-readable node name shown to peers.

      • OptionalstampCost: number | null = null

        Active stamp cost (1-254), or null to advertise stamping as disabled.

      Returns Promise<void>

    • 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().

      MDN Reference

      Parameters

      • event: Event

      Returns boolean

    • Ingests a paper message delivered as an lxm:// URI (LXMRouter.ingest_lxm_uri).

      The URI body is base64-decoded into the paper payload, de-duplicated by its transient_id (so re-ingesting the same QR/URI is a no-op), decrypted with the local lxmf.delivery destination, and dispatched through the same message event path as a network-delivered message. Paper messages always disable stamp enforcement (LXMRouter.lxmf_propagation is_paper_message).

      The sender's signature is verified when their identity is already known (recalled from a prior announce); otherwise the message is still delivered with an unverified signature, exactly like the Python reference.

      Parameters

      • uri: string

        The lxm:// paper message URI.

      Returns Promise<LXMessage | null>

      The reconstructed message, or null when the URI is not addressed to this node (decryption fails) or was already ingested.

    • Initializes the router and registers the LXMF delivery destination.

      Returns Promise<void>

    • Call this when a new Identity is cached (e.g., in your IDENTIFY handler). It checks if any parked messages are now ready for processing.

      Parameters

      • linkId: Uint8Array<ArrayBufferLike>

      Returns Promise<void>

    • 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.

      MDN Reference

      Parameters

      • type: string
      • callback: EventListenerOrEventListenerObject | null
      • Optionaloptions: boolean | EventListenerOptions

      Returns void

    • Serializes and sends an LXMF message.

      When delivering over a link, this waits for the link to become ACTIVE and then sends LINKIDENTIFY (once per initiator link) before the message DATA — Python LXMF otherwise drops packets that arrive before identify.

      Parameters

      • message: LXMessage
      • senderIdentity: Identity
      • linkId: Uint8Array<ArrayBufferLike> | null

      Returns Promise<void>