Electron SDK integration
Electron apps should run the SDK in the trusted main process, never in the renderer, and start it only after explicit user opt-in.
1. Install
# Same npm package as Node — run in the main process, not the renderer.
# .npmrc (request a token from "Install tokens" above)
@getpassive:registry=https://npm.getpassive.io/
//npm.getpassive.io/:_authToken=<YOUR_TOKEN>
npm install @getpassive/sdk
The package ships both ESM and CommonJS builds. If your main process is CommonJS (the default in most Electron templates), use const { GetPassiveClient } = require('@getpassive/sdk'); instead of the import below.
2. Initialize
// main.js — Electron main process only.
import { GetPassiveClient } from '@getpassive/sdk';
import { app } from 'electron';
let client;
app.whenReady().then(async () => {
// Wait for explicit user opt-in in your UI before this:
client = new GetPassiveClient({
devApiKey: process.env.GETPASSIVE_DEV_API_KEY, // your dev API key - do not hard-code
deviceUuid: stableDeviceUuid // persist this across launches
});
await client.start();
});
app.on('will-quit', async () => {
if (client) await client.stop();
});
3. Binary downloads
This platform uses the private npm package rather than a standalone native binary. See the install command above.
4. Lifecycle notes
- Run in the Electron main process so API keys and network lifecycle are not exposed to renderer code.
- Use IPC for the renderer to request opt-in or opt-out state changes.
- Persist the device UUID in app.getPath("userData") and pass it to the SDK on each launch.
- Stop the client during will-quit and whenever the user disables the integration.
5. Consent flow
Start the SDK only after your app has shown the required disclosure and the user has accepted it. Use the shared consent guide for the wording and placement expectations.
6. Verify
Use the in-dashboard tester at app.getpassive.io for your app key, or follow the shared quickstart verification steps while the key is in test mode.
Last updated June 14, 2026