Reputation: 524
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?
Upvotes: 1
Views: 877
Reputation: 4537
I have a few approaches in mind, but it depends on your implementation -
$.ajax.beforeSend
and check if you have usb-token available. Upvotes: 1