9 lines
468 B
JavaScript
9 lines
468 B
JavaScript
|
|
// Preload for the HTTP authentication prompt (auth-prompt.html). Main pushes
|
||
|
|
// the challenge via `auth-show`; the page answers once with `auth-answer`
|
||
|
|
// (credentials, or null for cancel). Nothing else is exposed.
|
||
|
|
const { contextBridge, ipcRenderer } = require("electron");
|
||
|
|
contextBridge.exposeInMainWorld("authPrompt", {
|
||
|
|
onShow: (cb) => ipcRenderer.on("auth-show", (_e, req) => cb(req)),
|
||
|
|
answer: (id, creds) => ipcRenderer.invoke("auth-answer", id, creds),
|
||
|
|
});
|