I am currently developing a web based signing system use hwcrypto When user plug usb-token device to computer then click button, it prompt select certificate and enter password:
window.hwcrypto.getCertificate({lang: lang, filter: filter})
.then(function(cert) {
    window.hwcrypto.sign(cert, {type: hashtype, hex: hash}, {lang: lang})
    .then(function(signature){
        // call jquery ajax to do some important thing
        $.ajax({
            url: 'index.php?action=very_important_action',
            dataType: 'html',
            success: function(response) {
                console.log(response);
        });
    });
});
It works, but i worry users call ajax function directly not use usb-token. How can I protect that?