@lumera/sdk-js
    Preparing search index...

    Function buildIndexFile

    • Constructs the index file for a LEP-1 Cascade upload.

      The index file contains metadata about the RaptorQ layout and includes a cryptographic signature to ensure data integrity. It must be serialized using canonical JSON when computing signatures or transmitting to the chain.

      Parameters

      • layout_ids: string[]

        Array of derived layout IDs (typically 50 for LEP-1)

      • layout_signature: string

        Cryptographic signature over the layout data (Base64-encoded bytes)

      Returns IndexFile

      The constructed index file object

      If layout_ids is empty

      If layout_signature is empty

      • The version is currently fixed at 1 per LEP-1 specification
      • layout_ids must be derived using generateIds
      • layout_signature is computed by signing the canonical JSON bytes of the layout using ADR-036 signArbitrary with the uploader's wallet
      • The index file must be serialized deterministically (canonical JSON) for on-chain verification
      // Typical LEP-1 workflow
      const layoutIds = await generateIds(layoutFile, layoutSignature, rq_ids_ic, rq_ids_max);

      // Sign the layout (done by wallet via ADR-036 signArbitrary)
      const layoutBytes = canonicalJsonBytes(layout);
      const signature = await wallet.signArbitrary(chainId, signerAddress, layoutBytes);
      const signatureBytes = fromBase64(signature.signature);

      // Build the index file
      const indexFile = buildIndexFile(layoutIds, signatureBytes);