function sortSignatures(input, tapLeaf) {
  const leafHash = tapleafHash({
    output: tapLeaf.script,
    version: tapLeaf.leafVersion,
  });
  return (
    (input.tapScriptSig || [])
      // .filter(tss => tss.leafHash.equals(leafHash))
      .filter(tss => tools.compare(tss.leafHash, leafHash) === 0)
      .map(tss => addPubkeyPositionInScript(tapLeaf.script, tss))
      .sort((t1, t2) => t2.positionInScript - t1.positionInScript)
      .map(t => t.signature)
  );
}
Sorts the signatures in the input's tapScriptSig array based on their position in the tapLeaf script.

@param input - The PsbtInput object.
@param tapLeaf - The TapLeafScript object.
@returns An array of sorted signatures as Buffers.