I need to use keytar with electron, but I'm using Angular and Typescript. I have imported the module in main.ts
import * as keytar from 'keytar';
but It fails to load.
Alternatively, in a module, I'm using
import * as keytar from '../../../node_modules/keytar';
But Electron return this error in development console
Uncaught Error: node-loader: Error: Invalid package /home/project/angularelectron/node_modules/electron/dist/resources/electron.asar at Object. (keytar.node:5) at Object../node_modules/keytar/build/Release/keytar.node (keytar.node:6) at webpack_require (bootstrap:79) at Object../node_modules/keytar/lib/keytar.js (keytar.js:1) at webpack_require (bootstrap:79) at Module../src/app/home/home.component.ts (main.js:4089) at webpack_require (bootstrap:79) at Module../src/app/home/home-routing.module.ts (detail.module.ts:13) at webpack_require (bootstrap:79) at Module../src/app/app-routing.module.ts
How I can load keytar correctly? Thanks you
Im using Vue with Electron and have the same issue. So the problem was in using keytar in renderer process, where you cant access native api so easily.
Using keytar like that in my component solved the problem