Function generateSAS

  • Generates a Short Authentication String (SAS) from two fingerprints

    The SAS is a 4-digit code that both peers can visually verify to detect active MITM attacks. Both peers should see the same code.

    Parameters

    • localFingerprint: Uint8Array

      Local device's 32-byte fingerprint

    • remoteFingerprint: Uint8Array

      Remote device's 32-byte fingerprint

    Returns Promise<string>

    4-digit string (e.g., "1234")

    const sas = await generateSAS(localFP, remoteFP);
    console.log(`Verify this code matches: ${sas}`); // "1234"