electron / electron

:electron: Build cross-platform desktop apps with JavaScript, HTML, and CSS

Home Page:https://electronjs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature Request]: Add an API to create a `Certificate` object from a `pem` file

Prinzhorn opened this issue · comments

Preflight Checklist

Problem Description

Every use of dialog.showCertificateTrustDialog I've seen uses it to react to some event that passes certificate as an argument. There doesn't appear to be a way to create a Certificate from a file (without manually building the object I guess). I want to use dialog.showCertificateTrustDialog to trust certificates generated by mitmproxy. What I have are *.pem files.

Proposed Solution

I'm not sure where this belongs, certainly not in the dialog namespaces. Maybe import { Certificate } from 'electron'; and have a static method on it like Certificate.fromFile().

Alternatives Considered

I assume it's possible to parse the file manually and re-create whatever shape electron expects the object to be. Or is {data} actually enough for showCertificateTrustDialog and all other fields are irrelevant? I don't have access to Windows or Mac right now to test it.

Additional Information

No response