cordova-plugin-certinfo
Version:
This plugin allows allows you to fetch the SSL Certificate of the server you're connecting to. This can be useful for prevention of Man In The Middle attacks.
14 lines (12 loc) • 436 B
JavaScript
;
var exec = require('cordova/exec');
module.exports = {
fetch: function(url, allowUntrusted) {
if (!url || typeof url !== 'string' || url.slice(0, 6).toLowerCase() !== 'https:') {
return Promise.reject(new Error('a valid url with https protocol must be given'));
}
return new Promise(function(resolve, reject) {
exec(resolve, reject, 'CertInfo', 'fetch', [url, !!allowUntrusted]);
});
}
};