Function ipnsSelector

  • Selects the latest valid IPNS record from an array of marshalled IPNS records.

    Records are sorted by:

    1. Sequence number (higher takes precedence)
    2. Validity time for EOL records with same sequence number (longer lived record takes precedence)

    Parameters

    • key: Uint8Array

      The routing key for the IPNS record

    • data: Uint8Array[]

      Array of marshalled IPNS records to select from

    Returns number

    The index of the most valid record from the input array