reticulum-js
    Preparing search index...

    In-memory subscription table.

    On-disk persistence (msgpack subscriptions.rmp, hashes only) is a @reticulum/node concern; this in-memory form keeps the full identity so fanout works without an Identity::recall round-trip.

    Index
    _entries: SubscriptionEntry[]
    • Every backup entry held by this node, as { subscriberHash, channelHash, ownerNodeHash }. Used by the failover tick to scan for offline owners. Mirrors Rust backup_entries_for_tick.

      Returns {
          channelHash: Uint8Array;
          ownerNodeHash: Uint8Array;
          subscriberHash: Uint8Array;
      }[]

    • Parameters

      • subscriberHash: Uint8Array<ArrayBufferLike>

      Returns Uint8Array<ArrayBufferLike>[]

    • Finds the subscription entry whose rfed.delivery hash matches, if any (used to resolve an incoming announce to a subscriber).

      Parameters

      • deliveryHash: Uint8Array<ArrayBufferLike>

      Returns SubscriptionEntry | null

    • Exports all subscriptions as serializable records (the subscriber identity is serialized as its 64-byte public key; the Identity object is rebuilt on import). Used by the @reticulum/node FS adapter.

      Returns Promise<
          {
              added: number;
              channelHash: Uint8Array;
              deliveryHash: Uint8Array;
              lastRefreshed: number;
              pubkey: Uint8Array;
              subscriberHash: Uint8Array;
          }[],
      >

    • Replaces the table with the given records (rebuilt identities from their public keys). Used on load.

      Parameters

      • records: {
            added: number;
            channelHash: Uint8Array;
            deliveryHash: Uint8Array<ArrayBufferLike> | null;
            lastRefreshed: number;
            ownerNodeHash: Uint8Array<ArrayBufferLike> | null;
            pubkey: Uint8Array<ArrayBufferLike> | null;
            subscriberHash: Uint8Array;
        }[]

      Returns Promise<void>

    • Parameters

      • subscriberHash: Uint8Array<ArrayBufferLike>
      • channelHash: Uint8Array<ArrayBufferLike>

      Returns boolean

    • Removes backup entries whose lastRefreshed is older than maxAgeSecs. Primary entries (no owner) are always kept. This is the passive chain unravel: when an upstream custodian stops re-pushing (owner recovered), entries expire naturally. Mirrors Rust prune_stale_backups.

      Parameters

      • maxAgeSecs: number

      Returns number

      pruned count

    • Registers (subscriberIdentity, channelHash). Idempotent.

      Parameters

      • subscriberIdentity: Identity
      • channelHash: Uint8Array<ArrayBufferLike>

      Returns Promise<SubscriptionEntry>

    • Registers or refreshes a backup subscription adopted from an owner node (SPEC §11). Backup entries carry no subscriber identity (the owner pushed only the hashes); they are served via the deferred queue + /rfed/pull, never live fanout. If an identical (sub, ch, owner) entry already exists, its lastRefreshed heartbeat is bumped (chain-of-custody TTL). Mirrors Rust subscribe_backup.

      Parameters

      • subscriberHash: Uint8Array<ArrayBufferLike>
      • channelHash: Uint8Array<ArrayBufferLike>
      • ownerNodeHash: Uint8Array<ArrayBufferLike>

        The owner's rfed.node destination hash.

      Returns void

    • All subscription entries for a channel (each carries the subscriber identity + delivery hash needed by fanout).

      Parameters

      • channelHash: Uint8Array<ArrayBufferLike>

      Returns SubscriptionEntry[]

    • Removes (subscriberIdentity, channelHash).

      Parameters

      • subscriberHash: Uint8Array<ArrayBufferLike>
      • channelHash: Uint8Array<ArrayBufferLike>

      Returns boolean

      true if a subscription was removed.