@glinr/theauth-electron
v0.2.0
Published
TheAuth auth client for Electron desktop apps
Readme
@glinr/theauth-electron
Electron integration for TheAuth: secure storage, OAuth windows, and IPC bridge.
Install
npm install @glinr/@glinr/theauth-electronUsage
Set up the IPC bridge in the main process, then use the provider in the renderer.
// main.ts (main process)
import { setupTheAuthIpc, createElectronStorage } from '@glinr/theauth-electron';
const storage = createElectronStorage({ encryptionKey: process.env.STORAGE_KEY });
setupTheAuthIpc({ storage });// renderer.tsx
import { ElectronTheAuthProvider, useElectronTheAuthContext } from '@glinr/theauth-electron';
function App() {
return (
<ElectronTheAuthProvider apiUrl="https://auth.yourapp.com" tenantId="your-tenant-id">
<MainWindow />
</ElectronTheAuthProvider>
);
}// OAuth login from renderer
import { openOAuthWindow } from '@glinr/theauth-electron';
const result = await openOAuthWindow({ provider: 'google', redirectUri: 'kavach://oauth' });Exports
ElectronTheAuthProvider/ElectronTheAuthContext/useElectronTheAuthContext: renderer-side provider (formerlyElectronKavach*, still exported as deprecated aliases)createElectronStorage: encrypted keychain-backed storagecreateMemoryStorage: in-memory storage for testingsetupTheAuthIpc/createIpcStorage/THEAUTH_IPC_CHANNELS: main-process IPC setup (formerlysetupKavachIpc/KAVACH_IPC_CHANNELS, still exported as deprecated aliases)openOAuthWindow: opens a managed OAuth popup window
Docs
License
MIT
