rkeys
Version:
A platform for creating tablet/HTML5 virtual-keyboard apps to send keystrokes to remote X11
44 lines (43 loc) • 1.29 kB
JavaScript
// Generated by LiveScript 1.3.0
(function(){
var Cp, Sh, LIFE;
Cp = require('child_process');
Sh = require('shelljs/global');
LIFE = 30000;
module.exports = step1;
function checkExit(code, signal, step, cb){
if (code !== 0) {
return log("Error! Step " + step + " exited with code=" + code);
}
if (signal) {
return log("Error! Step " + step + " exited with signal=" + signal);
}
return cb();
}
function step1(){
var ARGSSTEP1, cp;
ARGSSTEP1 = ['req', '-x509', '-newkey', 'rsa:2048', '-keyout', 'key.pem', '-out', 'cert.pem', '-nodes', '-days'].concat([LIFE]);
cp = Cp.spawn('openssl', ARGSSTEP1, {
stdio: 'inherit'
});
return cp.on('exit', function(code, signal){
return checkExit(code, signal, 1, step2);
});
}
function step2(){
var ARGSSTEP2, cp;
ARGSSTEP2 = ['x509', '-inform', 'PEM', '-outform', 'DM', '-in', 'cert.pem', '-out', 'cert.crt'];
cp = Cp.spawn('openssl', ARGSSTEP2, {
stdio: 'inherit'
});
return cp.on('exit', function(code, signal){
return checkExit(code, signal, 2, verify);
});
}
function verify(){
if (test('-e', 'cert.crt')) {
return;
}
return log('Error! Certificate file cert.crt was not generated');
}
}).call(this);