Combining Electron's deep links with Ceramic's DIDSession to achieve authorization in the browser.
Powered by Electron (Forge) and Svelte.
It's a basic framework for passing data between Electron and the user's default browser.
In this instance, it's used to request a Metamask signature (authorizing a DIDSession
) before passing it back to Electron.
Warning
Application protocol registration does not work in development on Linux and MacOS. You need to package the app before testing out these features.
Electron app will spin up a local server (/electron/runServer.cjs
) to serve the browser part of the app (/browser-frontend
).
I'd recommend hosting this part so you can further modify the connection page (ie. add additional providers, update the style) without having to redistribute the app.
The above advantage of hosting it externally could be seen as a disadvantage by some, since hosting it locally (somewhat) prevents modifications and opportunities to modify the signing behavior (malware injection).
This app provides a barebones authentication flow with DIDSession
as a framework.
The actual authentication (data exchange) could be anything serializable, including OrbisDB
sessions.
/
├── browser-frontend (Svelte app that's launched in the browser)
├── electron
│ │ ├── browser (Build output of browser-frontend)
│ │ └── frontend (Build output of electron-frontend)
│ └── app.config.js (Configure ports and application protocol used)
└── electron-frontend (Svelte app that's launched inside Electron - renderer)
npm install
npm run build:browser
- build the browser part (/browser-frontend
), as it's not served from a live servernpm run dev
- run the Electron app (/electron
) and server the renderer Svelte (/electron-frontend
) from a live server)
npm run package:all
npm run package:electron
npm run make:all
npm run make:electron