function openCertificateInFirefox(firefoxPath, certPath) {
    return tslib_1.__awaiter(this, void 0, void 0, function* () {
        debug('Adding devert to Firefox trust stores manually. Launching a webserver to host our certificate temporarily ...');
        let port = yield get_port_1.default();
        let server = http_1.default.createServer((req, res) => tslib_1.__awaiter(this, void 0, void 0, function* () {
            let { pathname } = url_1.default.parse(req.url);
            if (pathname === '/certificate') {
                res.writeHead(200, { 'Content-type': 'application/x-x509-ca-cert' });
                res.write(fs_1.readFileSync(certPath));
                res.end();
            }
            else {
                res.writeHead(200);
                res.write(yield user_interface_1.default.firefoxWizardPromptPage(`http://localhost:${port}/certificate`));
                res.end();
            }
        })).listen(port);
        debug('Certificate server is up. Printing instructions for user and launching Firefox with hosted certificate URL');
        yield user_interface_1.default.startFirefoxWizard(`http://localhost:${port}`);
        utils_1.run(firefoxPath, [`http://localhost:${port}`]);
        yield user_interface_1.default.waitForFirefoxWizard();
        server.close();
    });
}
/**
 * Firefox manages it's own trust store for SSL certificates, which can be
 * managed via the certutil command (supplied by NSS tooling packages). In the
 * event that certutil is not already installed, and either can't be installed
 * (Windows) or the user doesn't want to install it (skipCertutilInstall:
 * true), it means that we can't programmatically tell Firefox to trust our
 * root CA certificate.
 *
 * There is a recourse though. When a Firefox tab is directed to a URL that
 * responds with a certificate, it will automatically prompt the user if they
 * want to add it to their trusted certificates. So if we can't automatically
 * install the certificate via certutil, we instead start a quick web server
 * and host our certificate file. Then we open the hosted cert URL in Firefox
 * to kick off the GUI flow.
 *
 * This method does all this, along with providing user prompts in the terminal
 * to walk them through this process.
 */
Firefox manages it's own trust store for SSL certificates, which can be
managed via the certutil command (supplied by NSS tooling packages). In the
event that certutil is not already installed, and either can't be installed
(Windows) or the user doesn't want to install it (skipCertutilInstall:
true), it means that we can't programmatically tell Firefox to trust our
root CA certificate.

There is a recourse though. When a Firefox tab is directed to a URL that
responds with a certificate, it will automatically prompt the user if they
want to add it to their trusted certificates. So if we can't automatically
install the certificate via certutil, we instead start a quick web server
and host our certificate file. Then we open the hosted cert URL in Firefox
to kick off the GUI flow.

This method does all this, along with providing user prompts in the terminal
to walk them through this process.
Firefox manages it ' s own trust store for SSL certificates which can be managed via the certutil command ( supplied by NSS tooling packages ) . In the event that certutil is not already installed and either can ' t be installed ( Windows ) or the user doesn ' t want to install it ( skipCertutilInstall : true ) it means that we can ' t programmatically tell Firefox to trust our root CA certificate . There is a recourse though . When a Firefox tab is directed to a URL that responds with a certificate it will automatically prompt the user if they want to add it to their trusted certificates . So if we can ' t automatically install the certificate via certutil we instead start a quick web server and host our certificate file . Then we open the hosted cert URL in Firefox to kick off the GUI flow . This method does all this along with providing user prompts in the terminal to walk them through this process .
function openCertificateInFirefox(firefoxPath, certPath) {
    return tslib_1.__awaiter(this, void 0, void 0, function* () {
        debug('Adding devert to Firefox trust stores manually. Launching a webserver to host our certificate temporarily ...');
        let port = yield get_port_1.default();
        let server = http_1.default.createServer((req, res) => tslib_1.__awaiter(this, void 0, void 0, function* () {
            let { pathname } = url_1.default.parse(req.url);
            if (pathname === '/certificate') {
                res.writeHead(200, { 'Content-type': 'application/x-x509-ca-cert' });
                res.write(fs_1.readFileSync(certPath));
                res.end();
            }
            else {
                res.writeHead(200);
                res.write(yield user_interface_1.default.firefoxWizardPromptPage(`http://localhost:${port}/certificate`));
                res.end();
            }
        })).listen(port);
        debug('Certificate server is up. Printing instructions for user and launching Firefox with hosted certificate URL');
        yield user_interface_1.default.startFirefoxWizard(`http://localhost:${port}`);
        utils_1.run(firefoxPath, [`http://localhost:${port}`]);
        yield user_interface_1.default.waitForFirefoxWizard();
        server.close();
    });
}
function openCertificateInFirefox ( firefoxPath , certPath ) { return tslib_1 . __awaiter ( this , void 0 , void 0 , function * ( ) { debug ( 'Adding devert to Firefox trust stores manually. Launching a webserver to host our certificate temporarily ...' ) ; let port = yield get_port_1 . default ( ) ; let server = http_1 . default . createServer ( ( req , res ) => tslib_1 . __awaiter ( this , void 0 , void 0 , function * ( ) { let { pathname } = url_1 . default . parse ( req . url ) ; if ( pathname === '/certificate' ) { res . writeHead ( 200 , { 'Content-type' : 'application/x-x509-ca-cert' } ) ; res . write ( fs_1 . readFileSync ( certPath ) ) ; res . end ( ) ; } else { res . writeHead ( 200 ) ; res . write ( yield user_interface_1 . default . firefoxWizardPromptPage ( ` ${ port } ` ) ) ; res . end ( ) ; } } ) ) . listen ( port ) ; debug ( 'Certificate server is up. Printing instructions for user and launching Firefox with hosted certificate URL' ) ; yield user_interface_1 . default . startFirefoxWizard ( ` ${ port } ` ) ; utils_1 . run ( firefoxPath , [ ` ${ port } ` ] ) ; yield user_interface_1 . default . waitForFirefoxWizard ( ) ; server . close ( ) ; } ) ; }
Firefox manages it's own trust store for SSL certificates, which can be
 managed via the certutil command (supplied by NSS tooling packages).
Firefox manages it ' s own trust store for SSL certificates which can be managed via the certutil command ( supplied by NSS tooling packages ) .