Function compareFingerprints

  • Compares two fingerprints for role assignment

    Parameters

    • a: Uint8Array

      First fingerprint

    • b: Uint8Array

      Second fingerprint

    Returns -1 | 0 | 1

    1 if a > b, -1 if a < b, 0 if equal

    const result = compareFingerprints(localFP, remoteFP);
    if (result > 0) {
    role = 'offerer';
    } else if (result < 0) {
    role = 'answerer';
    } else {
    throw new Error('Cannot connect to self');
    }