How to use the download.crypto.cat function in download

To help you get started, we’ve selected a few download examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cryptocat / cryptocat / src / js / pinning.js View on Github external
Cryptocat.Pinning.get = function(url, callback) {
		var domain = domains['crypto.cat'];
		if (url.startsWith('https://download.crypto.cat/')) {
			domain = domains['download.crypto.cat'];
		}
		var candidate = {};
		var get = HTTPS.request({
			hostname: domain[0].subject,
			port: 443,
			protocol: 'https:',
			path: NodeUrl.parse(url).pathname,
			agent: false
		}, function(res) {
			if (
				(checkCert(candidate, domain[0])) ||
				(checkCert(candidate, domain[1]))
			) {
				callback(res, true);
			} else {
				callback({}, false);