UNPKG

devcert

Version:

Generate trusted local SSL/TLS certificates for local SSL development

36 lines (35 loc) 1.94 kB
/** * Given a directory or glob pattern of directories, attempt to install the * CA certificate to each directory containing an NSS database. */ export declare function addCertificateToNSSCertDB(nssDirGlob: string, certPath: string, certutilPath: string): void; export declare function removeCertificateFromNSSCertDB(nssDirGlob: string, certPath: string, certutilPath: string): void; /** * Check to see if Firefox is still running, and if so, ask the user to close * it. Poll until it's closed, then return. * * This is needed because Firefox appears to load the NSS database in-memory on * startup, and overwrite on exit. So we have to ask the user to quite Firefox * first so our changes don't get overwritten. */ export declare function closeFirefox(): Promise<void>; /** * 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. */ export declare function openCertificateInFirefox(firefoxPath: string, certPath: string): Promise<void>; export declare function assertNotTouchingFiles(filepath: string, operation: string): void;