warn raspberry pi (ARM) users of slowness

This commit is contained in:
AJ ONeal 2016-08-01 10:22:17 -04:00
parent 4de65e1053
commit f9d4c28952
1 changed files with 17 additions and 0 deletions

17
node.js
View File

@ -43,6 +43,23 @@ function create(deps) {
};
RSA.generateKeypair = function (length, exponent, options, cb) {
if (!RSA._URSA && /arm|mips/i.test(require('os').arch) && !RSA._SLOW_WARN) {
console.warn("================================================================");
console.warn(" WARNING");
console.warn("================================================================");
console.warn("");
console.warn("WARNING: You are generating an RSA key using pure JavaScript on");
console.warn(" a VERY SLOW cpu. This could take DOZENS of minutes!");
console.warn("");
console.warn(" We recommend installing a C compiler and 'ursa'");
console.warn("");
console.warn("EXAMPLE:");
console.warn("");
console.warn(" sudo apt-get install build-essential && npm install ursa");
console.warn("");
console.warn("================================================================");
RSA._SLOW_WARN = true;
}
var keypair = {
privateKeyPem: undefined
, publicKeyPem: undefined