mirror of
https://github.com/element-hq/element-desktop
synced 2025-03-15 08:53:31 +01:00
Added some dummy TLS client auth
This commit is contained in:
parent
783117fea9
commit
dc6ffb605a
@ -985,6 +985,41 @@ app.on('activate', () => {
|
|||||||
mainWindow.show();
|
mainWindow.show();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.on('select-client-certificate', (event, webContents, url, list, callback) => {
|
||||||
|
console.log('select-client-certificate', url, list)
|
||||||
|
|
||||||
|
const clientCertPickFirst = vectorConfig['clientCertPickFirst']
|
||||||
|
const clientCertFingerprint = vectorConfig['clientCertFingerprint']
|
||||||
|
|
||||||
|
if (clientCertFingerprint) {
|
||||||
|
let found = false
|
||||||
|
for (const cert of list) {
|
||||||
|
if (cert.fingerprint === clientCertFingerprint) {
|
||||||
|
console.log('Selected client certificate ' + cert.fingerprint)
|
||||||
|
event.preventDefault()
|
||||||
|
callback(cert)
|
||||||
|
found = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(found === false) {
|
||||||
|
console.log('No certificate found')
|
||||||
|
}
|
||||||
|
} else if (clientCertPickFirst === true && list.length > 0) {
|
||||||
|
console.log('Selected first available client certificate ' + list[0].fingerprint)
|
||||||
|
event.preventDefault()
|
||||||
|
callback(list[0])
|
||||||
|
} else {
|
||||||
|
console.log('No client certificate available')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
app.on('certificate-error', (event, webContents, url, error, certificate, callback) => {
|
||||||
|
// Ensure we don't trust certificate causing a verification error
|
||||||
|
console.log('Untrusted server certificate')
|
||||||
|
callback(false)
|
||||||
|
})
|
||||||
|
|
||||||
function beforeQuit() {
|
function beforeQuit() {
|
||||||
global.appQuitting = true;
|
global.appQuitting = true;
|
||||||
if (mainWindow) {
|
if (mainWindow) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user