function ensureCACertReadable(options = {}) {
    return tslib_1.__awaiter(this, void 0, void 0, function* () {
        if (!certErrors()) {
            return;
        }
        /**
         * on windows, writeProtectedFile left the cert encrypted on *nix, the cert
         * has no read permissions either way, openssl will fail and that means we
         * have to fix it
         */
        try {
            const caFileContents = yield platforms_1.default.readProtectedFile(constants_1.rootCACertPath);
            platforms_1.default.deleteProtectedFiles(constants_1.rootCACertPath);
            fs_1.writeFileSync(constants_1.rootCACertPath, caFileContents);
        }
        catch (e) {
            return installCertificateAuthority(options);
        }
        // double check that we have a live one
        const remainingErrors = certErrors();
        if (remainingErrors) {
            return installCertificateAuthority(options);
        }
    });
}
/**
 * Smoothly migrate the certificate storage from v1.0.x to >= v1.1.0.
 * In v1.1.0 there are new options for retrieving the CA cert directly,
 * to help third-party Node apps trust the root CA.
 *
 * If a v1.0.x cert already exists, then devcert has written it with
 * platform.writeProtectedFile(), so an unprivileged readFile cannot access it.
 * Pre-detect and remedy this; it should only happen once per installation.
 */
Smoothly migrate the certificate storage from v1.0.x to >= v1.1.0.
In v1.1.0 there are new options for retrieving the CA cert directly,
to help third-party Node apps trust the root CA.

If a v1.0.x cert already exists, then devcert has written it with
platform.writeProtectedFile(), so an unprivileged readFile cannot access it.
Pre-detect and remedy this; it should only happen once per installation.
Smoothly migrate the certificate storage from v1 . 0 . x to > = v1 . 1 . 0 . In v1 . 1 . 0 there are new options for retrieving the CA cert directly to help third - party Node apps trust the root CA . If a v1 . 0 . x cert already exists then devcert has written it with platform . writeProtectedFile () so an unprivileged readFile cannot access it . Pre - detect and remedy this ; it should only happen once per installation .
function ensureCACertReadable(options = {}) {
    return tslib_1.__awaiter(this, void 0, void 0, function* () {
        if (!certErrors()) {
            return;
        }
        try {
            const caFileContents = yield platforms_1.default.readProtectedFile(constants_1.rootCACertPath);
            platforms_1.default.deleteProtectedFiles(constants_1.rootCACertPath);
            fs_1.writeFileSync(constants_1.rootCACertPath, caFileContents);
        }
        catch (e) {
            return installCertificateAuthority(options);
        }
        const remainingErrors = certErrors();
        if (remainingErrors) {
            return installCertificateAuthority(options);
        }
    });
}
function ensureCACertReadable ( options = { } ) { return tslib_1 . __awaiter ( this , void 0 , void 0 , function * ( ) { if ( ! certErrors ( ) ) { return ; } try { const caFileContents = yield platforms_1 . default . readProtectedFile ( constants_1 . rootCACertPath ) ; platforms_1 . default . deleteProtectedFiles ( constants_1 . rootCACertPath ) ; fs_1 . writeFileSync ( constants_1 . rootCACertPath , caFileContents ) ; } catch ( e ) { return installCertificateAuthority ( options ) ; } const remainingErrors = certErrors ( ) ; if ( remainingErrors ) { return installCertificateAuthority ( options ) ; } } ) ; }
Smoothly migrate the certificate storage from v1.0.x to >= v1.1.0.
Smoothly migrate the certificate storage from v1 . 0 . x to > = v1 . 1 . 0 .
/**
         * on windows, writeProtectedFile left the cert encrypted on *nix, the cert
         * has no read permissions either way, openssl will fail and that means we
         * have to fix it
         */ // double check that we have a live one